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.

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
  
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 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()Constructor
public function MediaServiceConnection()

Create a MediaServiceConnection object.

Method Detail
canSendData()method
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()method 
public function connect():void

Connects to the media service.

disconnect()method 
public function disconnect():void

Disconnects from the media service.

hasAudioService()method 
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.
requestAudioService()method 
public function requestAudioService():void

Requests access to the media engine.

sendMetadata()method 
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
albumAlbum name
trackTrack name
durationDuration of track (in milliseconds)
positionCurrent playback position (in milliseonds)
albumArtworkURL to album artwork

Parameters

metadata:Object — The metadata object.

See also

MediaPlayerMetaData
setPlayState()method 
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
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  
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  
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  
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.
mediaServiceAccessChange Event  
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  
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  
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  
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  
Event Object Type: qnx.events.MediaServiceConnectionEvent
MediaServiceConnectionEvent.type property = qnx.events.MediaServiceConnectionEvent.DISCONNECT

Dispatched when a connection to the media service has disconnected.