qnx.media.MediaServiceConnection

MediaServiceConnection

Methods | Events


Packageqnx.media
Classpublic class MediaServiceConnection
InheritanceMediaServiceConnection Inheritance flash.events.EventDispatcher

The MediaServiceConnection class negotiates access to the media playback engine to prevent multiple clients from playing back audio or video at the same time.

Class information:
BlackBerry 10 Version:   10.0.0

See also

MediaPlayer



Public Methods

 MethodDefined By
  
Create a MediaServiceConnection object.
MediaServiceConnection
  
canSendData():Boolean
Indicates whether the caller should send metadata and play state information to the media service or not.
MediaServiceConnection
  
connect():void
Connects to the media service.
MediaServiceConnection
  
disconnect():void
Disconnects from the media service.
MediaServiceConnection
  
hasAudioService():Boolean
Indicates whether you have been granted access to the media engine.
MediaServiceConnection
  
register(name:String, overlayType:String):void
Registers your application with the now playing service.
MediaServiceConnection
  
Requests access to the media engine.
MediaServiceConnection
  
sendMetadata(metadata:Object):void
Provides the media service with a set of metadata for the current playback.
MediaServiceConnection
  
setPlayState(state:*):void
Provides the media service with the current state of playback.
MediaServiceConnection

Events

 Event Summary Defined By
   Dispatched when the media service has requested you to change playback to the next track.MediaServiceConnection
   Dispatched when the media service has requested you to pause playback.MediaServiceConnection
   Dispatched when the media service has requested that you start playback.MediaServiceConnection
   Dispatched when the media service has requested you to change playback to the previous track.MediaServiceConnection
   Dispatched when the media service has requested you to stop playback.MediaServiceConnection
   Dispatched when the media service has provided access or is asking you to revoke access to the media playback engine.MediaServiceConnection
   Dispatched when a connection to the media service is made.MediaServiceConnection
   Dispatched when a connection to the media service has failed.MediaServiceConnection
   Dispatched when the media service requests a change in the flow of play state and metadata.MediaServiceConnection
   Dispatched when a connection to the media service has disconnected.MediaServiceConnection

Constructor Detail

MediaServiceConnection()


public function MediaServiceConnection()

Create a MediaServiceConnection object.

Method Detail

canSendData()


public function canSendData():Boolean

Indicates whether the caller should send metadata and play state information to the media service or not.

Returns

Boolean — A Boolean indicating whether or not data should be supplied to the service. true if data changes should be forwarded, otherwise false.

connect()


public function connect():void

Connects to the media service.

disconnect()


public function disconnect():void

Disconnects from the media service.

hasAudioService()


public function hasAudioService():Boolean

Indicates whether you have been granted access to the media engine.

Returns

Boolean — A Boolean indicating whether or not access was granted. true if access is granted, otherwise false.

register()


public function register(name:String, overlayType:String):void

Registers your application with the now playing service.

This method must be called after connect() has been called.

Parameters

name:String — A descriptive name. For example, the name of your application.
overlayType:String — The type of overlay to use. Valid values can be found in the MediaServiceOverlayType class.

See also

MediaServiceOverlayType

requestAudioService()


public function requestAudioService():void

Requests access to the media engine.

sendMetadata()


public function sendMetadata(metadata:Object):void

Provides the media service with a set of metadata for the current playback. Metadata currently used by the MediaService is:

PropertyDescription
artistArtist name
albumAlbum name
trackTrack name
durationDuration of track (in milliseconds)
positionCurrent playback position (in milliseonds)
albumArtworkURL to album artwork
nextEnabledA Boolean specifying if the next button is enabled in the fancy overlay.
prevEnabledA Boolean specifying if the previous button is enabled in the fancy overlay.

Parameters

metadata:Object — The metadata object.

See also

MediaPlayerMetadata

setPlayState()


public function setPlayState(state:*):void

Provides the media service with the current state of playback.

Parameters

state:* — A String indicating the player's state.

Valid values are:

  • MediaPlayerState.STOPPED - indicates media playback is currently stopped
  • MediaPlayerState.PAUSED - indicates media playback is currently paused
  • MediaPlayerState.PLAYING - indicates media playback is currently playing

Event Detail

mediaRequestTrackNext


Event Object Type: qnx.events.MediaServiceRequestEvent
MediaServiceRequestEvent.type property = qnx.events.MediaServiceRequestEvent.TRACK_NEXT

Dispatched when the media service has requested you to change playback to the next track.

mediaRequestTrackPause


Event Object Type: qnx.events.MediaServiceRequestEvent
MediaServiceRequestEvent.type property = qnx.events.MediaServiceRequestEvent.TRACK_PAUSE

Dispatched when the media service has requested you to pause playback.

mediaRequestTrackPlay


Event Object Type: qnx.events.MediaServiceRequestEvent
MediaServiceRequestEvent.type property = qnx.events.MediaServiceRequestEvent.TRACK_PLAY

Dispatched when the media service has requested that you start playback.

mediaRequestTrackPrev


Event Object Type: qnx.events.MediaServiceRequestEvent
MediaServiceRequestEvent.type property = qnx.events.MediaServiceRequestEvent.TRACK_PREV

Dispatched when the media service has requested you to change playback to the previous track.

mediaRequestTrackStop


Event Object Type: qnx.events.MediaServiceRequestEvent
MediaServiceRequestEvent.type property = qnx.events.MediaServiceRequestEvent.TRACK_STOP

Dispatched when the media service has requested you to stop playback.

mediaServiceAccessChange


Event Object Type: qnx.events.MediaServiceConnectionEvent
MediaServiceConnectionEvent.type property = qnx.events.MediaServiceConnectionEvent.ACCESS_CHANGE

Dispatched when the media service has provided access or is asking you to revoke access to the media playback engine.

mediaServiceConnect


Event Object Type: qnx.events.MediaServiceConnectionEvent
MediaServiceConnectionEvent.type property = qnx.events.MediaServiceConnectionEvent.CONNECT

Dispatched when a connection to the media service is made.

mediaServiceConnectionFail


Event Object Type: qnx.events.MediaServiceConnectionEvent
MediaServiceConnectionEvent.type property = qnx.events.MediaServiceConnectionEvent.CONNECTION_FAIL

Dispatched when a connection to the media service has failed.

mediaServiceDataFlowChange


Event Object Type: qnx.events.MediaServiceConnectionEvent
MediaServiceConnectionEvent.type property = qnx.events.MediaServiceConnectionEvent.DATAFLOW_CHANGE

Dispatched when the media service requests a change in the flow of play state and metadata.

mediaServiceDisconnect


Event Object Type: qnx.events.MediaServiceConnectionEvent
MediaServiceConnectionEvent.type property = qnx.events.MediaServiceConnectionEvent.DISCONNECT

Dispatched when a connection to the media service has disconnected.




comments powered by Disqus