MediaServiceConnection
Package | qnx.media |
Class | public class MediaServiceConnection |
Inheritance | MediaServiceConnection ![]() |
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: |
---|
PlayBook Tablet OS Version: 1.0.6 |
See also
Public Methods
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 |
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 .
|
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:
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
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:
|
Event Detail
mediaRequestTrackNext
Event Object Type:
MediaServiceRequestEvent.type property =
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:
MediaServiceRequestEvent.type property =
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:
MediaServiceRequestEvent.type property =
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:
MediaServiceRequestEvent.type property =
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:
MediaServiceRequestEvent.type property =
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:
MediaServiceConnectionEvent.type property =
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:
MediaServiceConnectionEvent.type property =
qnx.events.MediaServiceConnectionEvent
MediaServiceConnectionEvent.type property =
qnx.events.MediaServiceConnectionEvent.CONNECT
Dispatched when a connection to the media service is made.
mediaServiceConnectionFail
Event Object Type:
MediaServiceConnectionEvent.type property =
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:
MediaServiceConnectionEvent.type property =
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:
MediaServiceConnectionEvent.type property =
qnx.events.MediaServiceConnectionEvent
MediaServiceConnectionEvent.type property =
qnx.events.MediaServiceConnectionEvent.DISCONNECT
Dispatched when a connection to the media service has disconnected.