| Package | qnx.media |
| Class | public class MediaServiceConnection |
| Inheritance | MediaServiceConnection flash.events.EventDispatcher |
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
| Method | Defined 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 | ||
requestAudioService():void
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 | ||
| 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 | |||
| MediaServiceConnection | () | Constructor |
public function MediaServiceConnection()
Create a MediaServiceConnection object.
| canSendData | () | method |
public function canSendData():BooleanIndicates whether the caller should send metadata and play state information to the media service or not.
ReturnsBoolean — 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():voidConnects to the media service.
| disconnect | () | method |
public function disconnect():voidDisconnects from the media service.
| hasAudioService | () | method |
public function hasAudioService():BooleanIndicates whether you have been granted access to the media engine.
ReturnsBoolean — A Boolean indicating whether or not access was granted. true if access is granted, otherwise
false.
|
| requestAudioService | () | method |
public function requestAudioService():voidRequests access to the media engine.
| sendMetadata | () | method |
public function sendMetadata(metadata:Object):voidProvides the media service with a set of metadata for the current playback. Metadata currently used by the MediaService is:
| Property | Description |
|---|---|
| album | Album name |
| track | Track name |
| duration | Duration of track (in milliseconds) |
| position | Current playback position (in milliseonds) |
| albumArtwork | URL to album artwork |
Parameters
metadata:Object — The metadata object.
|
See also
| setPlayState | () | method |
public function setPlayState(state:*):voidProvides the media service with the current state of playback.
Parameters
state:* — A String indicating the player's state.
Valid values are:
|
| mediaRequestTrackNext | Event |
qnx.events.MediaServiceRequestEventqnx.events.MediaServiceRequestEvent.TRACK_NEXTDispatched when the media service has requested you to change playback to the next track.
| mediaRequestTrackPause | Event |
qnx.events.MediaServiceRequestEventqnx.events.MediaServiceRequestEvent.TRACK_PAUSEDispatched when the media service has requested you to pause playback.
| mediaRequestTrackPlay | Event |
qnx.events.MediaServiceRequestEventqnx.events.MediaServiceRequestEvent.TRACK_PLAYDispatched when the media service has requested that you start playback.
| mediaRequestTrackPrev | Event |
qnx.events.MediaServiceRequestEventqnx.events.MediaServiceRequestEvent.TRACK_PREVDispatched when the media service has requested you to change playback to the previous track.
| mediaServiceAccessChange | Event |
qnx.events.MediaServiceConnectionEventqnx.events.MediaServiceConnectionEvent.ACCESS_CHANGEDispatched when the media service has provided access or is asking you to revoke access to the media playback engine.
| mediaServiceConnect | Event |
qnx.events.MediaServiceConnectionEventqnx.events.MediaServiceConnectionEvent.CONNECTDispatched when a connection to the media service is made.
| mediaServiceConnectionFail | Event |
qnx.events.MediaServiceConnectionEventqnx.events.MediaServiceConnectionEvent.CONNECTION_FAILDispatched when a connection to the media service has failed.
| mediaServiceDataFlowChange | Event |
qnx.events.MediaServiceConnectionEventqnx.events.MediaServiceConnectionEvent.DATAFLOW_CHANGEDispatched when the media service requests a change in the flow of play state and metadata.
| mediaServiceDisconnect | Event |
qnx.events.MediaServiceConnectionEventqnx.events.MediaServiceConnectionEvent.DISCONNECTDispatched when a connection to the media service has disconnected.