MediaController API
It helps to transfer the information like playback info, shuffle/repeat mode and metadata from media controller server to client. Allows to control server state by sending commands from client.
For more information on the Media Controller features, see Media Controller Guide.
Since: 2.4
Table of Contents
- 1. Type Definitions
- 2. Interfaces
- 2.1. MediaControllerObject
- 2.2. MediaControllerManager
- 2.3. MediaControllerServer
- 2.4. MediaControllerClient
- 2.5. MediaControllerServerInfo
- 2.6. MediaControllerPlaybackInfo
- 2.7. MediaControllerMetadata
- 2.8. MediaControllerServerInfoArraySuccessCallback
- 2.9. MediaControllerSendCommandSuccessCallback
- 2.10. MediaControllerReceiveCommandCallback
- 2.11. MediaControllerServerStatusChangeCallback
- 2.12. MediaControllerPlaybackInfoChangeCallback
- 2.13. MediaControllerChangeRequestPlaybackInfoCallback
- 3. Full WebIDL
Summary of Interfaces and Methods
1. Type Definitions
1.1. MediaControllerServerState
enum MediaControllerServerState { "ACTIVE", "INACTIVE" };
Since: 2.4
- ACTIVE - Corresponds to active server state.
- INACTIVE - Corresponds to inactive server state.
1.2. MediaControllerPlaybackState
enum MediaControllerPlaybackState { "PLAY", "PAUSE", "STOP", "NEXT", "PREV", "FORWARD", "REWIND" };
Since: 2.4
- PLAY - Corresponds to the "playing" media controller playback state.
- PAUSE - Corresponds to the "paused" media controller playback state.
- STOP - Corresponds to the "stopped" media controller playback state.
- NEXT - Corresponds to the "moving to next" media controller playback state.
- PREV - Corresponds to the "moving to previous" media controller playback state.
- FORWARD - Corresponds to the "forwarding" media controller playback state.
- REWIND - Corresponds to the "rewinding" media controller playback state.
2. Interfaces
2.1. MediaControllerObject
[NoInterfaceObject] interface MediaControllerObject { readonly attribute MediaControllerManager mediacontroller; };
Tizen implements MediaControllerObject;
Since: 2.4
There is a tizen.mediacontroller object that allows access to the Media Controller API.
Attributes
-
readonly
MediaControllerManager mediacontrollerObject representing a media controller manager.
Since: 2.4
2.2. MediaControllerManager
[NoInterfaceObject] interface MediaControllerManager { MediaControllerClient getClient() raises(WebAPIException); MediaControllerServer createServer() raises(WebAPIException); };
Since: 2.4
Methods
-
getClient
-
Gets the client object. If not exist, client will be automatically created.
MediaControllerClient getClient();
Since: 2.4
Privilege level: public
Privilege: http://tizen.org/privilege/mediacontroller.client
Return value:
-
MediaControllerClient:
The MediaController Client object.
Exceptions:
- WebAPIException
with error type NotSupportedError, if this feature is not supported.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type UnknownError, if any other error occurs.
Code example:
try { var mcClient = tizen.mediacontroller.getClient(); } catch (err) { console.log(err.name + ": " + err.message); }
- WebAPIException
-
createServer
-
Creates the Server object which holds playback state, meta data and is controlled by Client.
MediaControllerServer createServer();
Since: 2.4
Privilege level: public
Privilege: http://tizen.org/privilege/mediacontroller.server
Return value:
-
MediaControllerServer:
The MediaController Server object.
Exceptions:
- WebAPIException
with error type NotSupportedError, if this feature is not supported.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type UnknownError, if any other error occurs.
Code example:
try { var mcServer = tizen.mediacontroller.createServer(); } catch (err) { console.log(err.name + ": " + err.message); }
- WebAPIException
2.3. MediaControllerServer
[NoInterfaceObject] interface MediaControllerServer { readonly attribute MediaControllerPlaybackInfo playbackInfo; void updatePlaybackState(MediaControllerPlaybackState state) raises(WebAPIException); void updatePlaybackPosition(unsigned long long position) raises(WebAPIException); void updateShuffleMode(boolean mode) raises(WebAPIException); void updateRepeatMode(boolean mode) raises(WebAPIException); void updateMetadata(MediaControllerMetadata metadata) raises(WebAPIException); long addChangeRequestPlaybackInfoListener(MediaControllerChangeRequestPlaybackInfoCallback listener) raises(WebAPIException); void removeChangeRequestPlaybackInfoListener(long watchId) raises(WebAPIException); long addCommandListener(MediaControllerReceiveCommandCallback listener) raises(WebAPIException); void removeCommandListener(long watchId) raises(WebAPIException); };
Since: 2.4
Allows the application to send the playback state and metadata to other application and be controlled by other application(client) remotely.
Attributes
-
readonly
MediaControllerPlaybackInfo playbackInfoCurrent playback info.
Since: 2.4
Remark: Object holds state which is automatically updated by update methods.
Methods
-
updatePlaybackState
-
Updates playback state and send notification to the listening clients. See MediaControllerServerInfo.addPlaybackInfoChangeListener to check how to receive playback info changes from server on client side.
void updatePlaybackState(MediaControllerPlaybackState state);
Since: 2.4
Parameters:
- state: Playback state.
Exceptions:
- WebAPIException
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type UnknownError, if any other error occurs.
Code example:
var mcServer = tizen.mediacontroller.createServer(); mcServer.updatePlaybackState("PLAY"); console.log("Current playback state is: " + mcServer.playbackInfo.state);
Output example:
Current playback state is: PLAY
-
updatePlaybackPosition
-
Updates playback position and send notification to the listening clients.
void updatePlaybackPosition(unsigned long long position);
Since: 2.4
Parameters:
- position: Playback position.
Exceptions:
- WebAPIException
with error type InvalidValuesError, if any of the input parameters contain an invalid value.
with error type UnknownError, if any other error occurs.
Code example:
var mcServer = tizen.mediacontroller.createServer(); mcServer.updatePlaybackPosition(164); console.log("Current playback position is: " + mcServer.playbackInfo.position);
Output example:
Current playback position is: 164
-
updateShuffleMode
-
Updates shuffle mode and send notification to the listening clients.
void updateShuffleMode(boolean mode);
Since: 2.4
Parameters:
- mode: Shuffle mode.
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
Code example:
var mcServer = tizen.mediacontroller.createServer(); mcServer.updateShuffleMode(true); console.log("Current shuffle mode is: " + mcServer.playbackInfo.shuffleMode);
Output example:
Current shuffle mode is: true
-
updateRepeatMode
-
Updates repeat mode and send notification to the listening clients.
void updateRepeatMode(boolean mode);
Since: 2.4
Parameters:
- mode: Repeat mode.
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
Code example:
var mcServer = tizen.mediacontroller.createServer(); mcServer.updateRepeatMode(true); console.log("Current repeat mode is: " + mcServer.playbackInfo.repeatMode);
-
updateMetadata
-
Updates metadata and send notification to the listening clients.
void updateMetadata(MediaControllerMetadata metadata);
Since: 2.4
Parameters:
- metadata: Metadata object.
Exceptions:
- WebAPIException
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type UnknownError, if any other error occurs.
Code example:
var mcServer = tizen.mediacontroller.createServer(); var metadata = mcServer.playbackInfo.metadata; metadata.artist = "Artist Name"; mcServer.updateMetadata(metadata); console.log("Current metadata is: " + JSON.stringify(mcServer.playbackInfo.metadata));
Output example:
Current metadata is: {"title":"","artist":"Artist Name","album":"","author":"","genre":"", "duration":"","date":"","copyright":"","description":"","trackNum":"","picture":""}
-
addChangeRequestPlaybackInfoListener
-
Adds the listener for a media playback info requests from client. See MediaControllerServerInfo to check how to send playback info change requests from client.
long addChangeRequestPlaybackInfoListener(MediaControllerChangeRequestPlaybackInfoCallback listener);
Since: 2.4
Parameters:
- listener: Change request listener to add.
Return value:
-
long:
The identifier used to clear the watch subscription.
Exceptions:
- WebAPIException
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type UnknownError, if any other error occurs.
Code example:
var watcherId = 0; /* Watcher identifier. */ var mcServer = tizen.mediacontroller.createServer(); var playbackRequestListener = { onplaybackstaterequest: function(state) { console.log("Playback state requested to: " + state); }, onplaybackpositionrequest: function(position) { console.log("Playback position requested to: " + position); }, onshufflemoderequest: function(mode) { console.log("Shuffle mode requested to: " + mode); }, onrepeatmoderequest: function(mode) { console.log("Repeat mode requested to: " + mode); } }; /* Registers to receive playback info change requests from client. */ watcherId = mcServer.addChangeRequestPlaybackInfoListener(playbackRequestListener);
-
removeChangeRequestPlaybackInfoListener
-
Removes the listener, so stop receiving playback state requests from clients.
void removeChangeRequestPlaybackInfoListener(long watchId);
Since: 2.4
Calling this function has no effect if there is no listener with given id.
Parameters:
- watchId: Subscription identifier.
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
Code example:
var watcherId = 0; /* Watcher identifier. */ var mcServer = tizen.mediacontroller.createServer(); var playbackRequestListener = { onplaybackstaterequest: function(state) { console.log("Playback state requested to: " + state); }, onplaybackpositionrequest: function(position) { console.log("Playback position requested to: " + position); }, onshufflemoderequest: function(mode) { console.log("Shuffle mode requested to: " + mode); }, onrepeatmoderequest: function(mode) { console.log("Repeat mode requested to: " + mode); } }; /* Registers to receive playback info change requests. */ watcherId = mcServer.addChangeRequestPlaybackInfoListener(playbackRequestListener); /* Cancels the watch operation. */ mcServer.removeChangeRequestPlaybackInfoListener(watcherId);
-
addCommandListener
-
Adds the listener for receiving custom commands from client. See MediaControllerServerInfo to check how to send custom commands from client.
long addCommandListener(MediaControllerReceiveCommandCallback listener);
Since: 2.4
Parameters:
- listener: Custom commands listener to add.
Return value:
-
long:
The identifier used to clear the watch subscription.
Exceptions:
- WebAPIException
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type UnknownError, if any other error occurs.
Code example:
var watcherId = 0; /* Watcher identifier. */ var mcServer = tizen.mediacontroller.createServer(); var commandReceiveListener = function(clientName, command, data) { console.log("Command " + command + " received from: " + clientName + " with data: " + JSON.stringify(data)); var reply = {myReply: "someValue"}; return reply; }; /* Registers to receive custom commands from client. */ watcherId = mcServer.addCommandListener(commandReceiveListener);
-
removeCommandListener
-
Removes the listener, so stop receiving custom commands from clients.
void removeCommandListener(long watchId);
Since: 2.4
Calling this function has no effect if there is no listener with given id.
Parameters:
- watchId: Subscription identifier.
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
Code example:
var watcherId = 0; /* Watcher identifier. */ var mcServer = tizen.mediacontroller.createServer(); var commandReceiveListener = function(clientName, command, data) { console.log("Command " + command + " received from: " + clientName + " with data: " + JSON.stringify(data)); var reply = {myReply: "someValue"}; return reply; }; /* Registers to receive custom commands from client. */ watcherId = mcServer.addCommandListener(commandReceiveListener); /* Cancels the watch operation. */ mcServer.removeCommandListener(watcherId);
2.4. MediaControllerClient
[NoInterfaceObject] interface MediaControllerClient { void findServers(MediaControllerServerInfoArraySuccessCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); MediaControllerServerInfo? getLatestServerInfo() raises(WebAPIException); };
Since: 2.4
Methods
-
findServers
-
Retrieves all activated media controller servers.
void findServers(MediaControllerServerInfoArraySuccessCallback successCallback, optional ErrorCallback? errorCallback);
Since: 2.4
Parameters:
- successCallback: The method to invoke when all of the registered media controller servers have been found.
- errorCallback [optional] [nullable]: The method to invoke on failure of retrieving servers list.
Exceptions:
- WebAPIException
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type UnknownError, if any other error occurs.
Code example:
var mcClient; try { mcClient = tizen.mediacontroller.getClient(); } catch (err) { console.log(err.name + " error: " + err.message); } function successCallback(list) { for (var s in list) { console.log("Found server: " + list[s].name + ", state: " + list[s].state); } } function errorCallback(err) { console.log(err.name + " error: " + err.message); } mcClient.findServers(successCallback, errorCallback);
Output example:
Found server: og8WN4XlLg.BasicUIStudio, state: ACTIVE
-
getLatestServerInfo
-
Gets the latest activated media controller server info.
MediaControllerServerInfo? getLatestServerInfo();
Since: 2.4
Remark: If there is no activated media controller server, null value is returned.
Return value:
-
MediaControllerServerInfo [nullable]:
Server info or null.
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
Code example:
/* Access latest server info. */ var mcClient = tizen.mediacontroller.getClient(); var mcServerInfo = mcClient.getLatestServerInfo(); console.log( "Latest server name is: " + mcServerInfo.name + ", server state: " + mcServerInfo.state);
Output example:
Latest server name is: 2cpQcelP8a.HelloTizen, server state: INACTIVE
- WebAPIException
2.5. MediaControllerServerInfo
[NoInterfaceObject] interface MediaControllerServerInfo { readonly attribute ApplicationId name; readonly attribute MediaControllerServerState state; readonly attribute MediaControllerPlaybackInfo playbackInfo raises(WebAPIException); void sendPlaybackState(MediaControllerPlaybackState state, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void sendPlaybackPosition(unsigned long long position, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void sendShuffleMode(boolean mode, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void sendRepeatMode(boolean mode, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void sendCommand(DOMString command, object data, MediaControllerSendCommandSuccessCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); long addServerStatusChangeListener(MediaControllerServerStatusChangeCallback listener) raises(WebAPIException); void removeServerStatusChangeListener(long watchId) raises(WebAPIException); long addPlaybackInfoChangeListener(MediaControllerPlaybackInfoChangeCallback listener) raises(WebAPIException); void removePlaybackInfoChangeListener(long watchId) raises(WebAPIException); };
Since: 2.4
Attributes
-
readonly
ApplicationId nameThe appId of the media controller server.
Since: 2.4
-
readonly
MediaControllerServerState stateState of the media controller server.
Since: 2.4
-
readonly
MediaControllerPlaybackInfo playbackInfoCurrent playback info.
Since: 2.4
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
- WebAPIException
Methods
-
sendPlaybackState
-
Allows to change playback state of media controller server.
void sendPlaybackState(MediaControllerPlaybackState state, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
Since: 2.4
Parameters:
- state: Playback state.
- successCallback [optional] [nullable]: The method to invoke when playback state was changed.
- errorCallback [optional] [nullable]: The method to invoke on operation failure.
Exceptions:
- WebAPIException
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type UnknownError, if any other error occurs.
Code example:
var mcClient = tizen.mediacontroller.getClient(); var mcServerInfo = mcClient.getLatestServerInfo(); mcServerInfo.sendPlaybackState("STOP", function() { console.log("Playback has stopped"); }, function(e) { console.log("Unable to change playback state: " + e.message); });
Output example:
Playback has stopped
-
sendPlaybackPosition
-
Allows to change playback position of media controller server.
void sendPlaybackPosition(unsigned long long position, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
Since: 2.4
Parameters:
- position: Playback position.
- successCallback [optional] [nullable]: The method to invoke when playback position was changed.
- errorCallback [optional] [nullable]: The method to invoke on operation failure.
Exceptions:
- WebAPIException
with error type InvalidValuesError, if any of the input parameters contain an invalid value.
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type UnknownError, if any other error occurs.
Code example:
var mcClient = tizen.mediacontroller.getClient(); var mcServerInfo = mcClient.getLatestServerInfo(); mcServerInfo.sendPlaybackPosition(164, function() { console.log("Playback position changed"); }, function(e) { console.log("Unable to change playback position: " + e.message); });
Output example:
Playback position changed
-
sendShuffleMode
-
Allows to change shuffle mode of media controller server.
void sendShuffleMode(boolean mode, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
Since: 2.4
Parameters:
- mode: Shuffle mode.
- successCallback [optional] [nullable]: The method to invoke when shuffle mode was changed.
- errorCallback [optional] [nullable]: The method to invoke on operation failure.
Exceptions:
- WebAPIException
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type UnknownError, if any other error occurs.
Code example:
var mcClient = tizen.mediacontroller.getClient(); var mcServerInfo = mcClient.getLatestServerInfo(); mcServerInfo.sendShuffleMode(true, function() { console.log("Shuffle mode changed"); }, function(e) { console.log("Unable to change shuffle mode: " + e.message); });
Output example:
Shuffle mode changed
-
sendRepeatMode
-
Allows to change repeat mode of media controller server.
void sendRepeatMode(boolean mode, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
Since: 2.4
Parameters:
- mode: Repeat mode.
- successCallback [optional] [nullable]: The method to invoke when repeat mode was changed.
- errorCallback [optional] [nullable]: The method to invoke on operation failure.
Exceptions:
- WebAPIException
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type UnknownError, if any other error occurs.
Code example:
var mcClient = tizen.mediacontroller.getClient(); var mcServerInfo = mcClient.getLatestServerInfo(); mcServerInfo.sendRepeatMode(false, function() { console.log("Repeat mode changed"); }, function(e) { console.log("Unable to change repeat mode: " + e.message); });
-
sendCommand
-
Allows to send custom command to media controller server.
void sendCommand(DOMString command, object data, MediaControllerSendCommandSuccessCallback successCallback, optional ErrorCallback? errorCallback);
Since: 2.4
Remark: See addCommandListener() method to check how to receive and respond to custom commands.
Parameters:
- command: Custom command name which is handled on server side.
- data: Additional data for custom command which is send to server.
- successCallback: The method to invoke when server responded to custom command.
- errorCallback [optional] [nullable]: The method to invoke on operation failure.
Exceptions:
- WebAPIException
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type UnknownError, if any other error occurs.
Code example:
var mcClient = tizen.mediacontroller.getClient(); var mcServerInfo = mcClient.getLatestServerInfo(); var exampleCustomCommandData = {myFilter: "rock"}; mcServerInfo.sendCommand("myPlaylistFilter", exampleCustomCommandData, function(response) { console.log("Command executed with result: " + JSON.stringify(response)); }, function(e) { console.log("Error executing command: " + e.message); });
-
addServerStatusChangeListener
-
Adds the listener for a media controller server status change.
long addServerStatusChangeListener(MediaControllerServerStatusChangeCallback listener);
Since: 2.4
Parameters:
- listener: Status change listener to add.
Return value:
-
long:
The identifier used to clear the watch subscription.
Exceptions:
- WebAPIException
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type UnknownError, if any other error occurs.
Code example:
var watcherId = 0; /* Watcher identifier. */ var mcClient = tizen.mediacontroller.getClient(); var mcServerInfo = mcClient.getLatestServerInfo(); /* Registers to be notified when server status changes. */ watcherId = mcServerInfo.addServerStatusChangeListener(function(status) { console.log(mcServerInfo.name + " server status changed to " + status); });
-
removeServerStatusChangeListener
-
Removes the listener, so stop receiving notifications about media controller server status.
void removeServerStatusChangeListener(long watchId);
Since: 2.4
Calling this function has no effect if there is no listener with given id.
Parameters:
- watchId: Subscription identifier.
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
Code example:
var watcherId = 0; /* Watcher identifier. */ var mcClient = tizen.mediacontroller.getClient(); var mcServerInfo = mcClient.getLatestServerInfo(); /* Registers to be notified when server status changes. */ watcherId = mcServerInfo.addServerStatusChangeListener(function(status) { console.log(mcServerInfo.name + " server status changed to " + status); }); /* Cancels the watch operation. */ mcServerInfo.removeServerStatusChangeListener(watcherId);
-
addPlaybackInfoChangeListener
-
Adds the listener for a media playback info changes.
long addPlaybackInfoChangeListener(MediaControllerPlaybackInfoChangeCallback listener);
Since: 2.4
Parameters:
- listener: Status change listener to add.
Return value:
-
long:
The identifier used to clear the watch subscription.
Exceptions:
- WebAPIException
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type UnknownError, if any other error occurs.
Code example:
var watcherId = 0; /* Watcher identifier. */ var mcClient = tizen.mediacontroller.getClient(); var mcServerInfo = mcClient.getLatestServerInfo(); var playbackListener = { onplaybackchanged: function(state, position) { console.log("Current playback state: " + state); console.log("Current playback position: " + position); }, onshufflemodechanged: function(mode) { console.log("Shuffle mode changed to: " + mode); }, onrepeatmodechanged: function(mode) { console.log("Repeat mode changed to: " + mode); }, onmetadatachanged: function(metadata) { console.log("Playback metadata changed: " + JSON.stringify(metadata)); } }; /* Registers to be notified when playback state changes. */ watcherId = mcServerInfo.addPlaybackInfoChangeListener(playbackListener);
-
removePlaybackInfoChangeListener
-
Removes the listener, so stop receiving notifications about media playback info changes.
void removePlaybackInfoChangeListener(long watchId);
Since: 2.4
Calling this function has no effect if there is no listener with given id.
Parameters:
- watchId: Subscription identifier.
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
Code example:
var watcherId = 0; /* Watcher identifier. */ var mcClient = tizen.mediacontroller.getClient(); var mcServerInfo = mcClient.getLatestServerInfo(); /* receives playback state changes. */ var playbackListener = { onplaybackchanged: function(state, position) { console.log("Current playback state: " + state); console.log("Current playback position: " + position); }, onshufflemodechanged: function(mode) { console.log("Shuffle mode changed to: " + mode); }, onrepeatmodechanged: function(mode) { console.log("Repeat mode changed to: " + mode); }, onmetadatachanged: function(metadata) { console.log("Playback metadata changed: " + JSON.stringify(metadata)); } }; /* Registers to be notified when playback state changes. */ watcherId = mcServerInfo.addPlaybackInfoChangeListener(playbackListener); /* Cancels the watch operation. */ mcServerInfo.removePlaybackInfoChangeListener(watcherId);
2.6. MediaControllerPlaybackInfo
[NoInterfaceObject] interface MediaControllerPlaybackInfo { readonly attribute MediaControllerPlaybackState state; readonly attribute unsigned long long position; readonly attribute boolean shuffleMode; readonly attribute boolean repeatMode; readonly attribute MediaControllerMetadata metadata; };
Since: 2.4
Attributes
-
readonly
MediaControllerPlaybackState stateCurrent playback state.
Since: 2.4
-
readonly
unsigned long long positionCurrent playback position.
Since: 2.4
-
readonly
boolean shuffleModeCurrent shuffle mode.
Since: 2.4
-
readonly
boolean repeatModeCurrent repeat mode.
Since: 2.4
-
readonly
MediaControllerMetadata metadataCurrent playback metadata.
Since: 2.4
2.7. MediaControllerMetadata
[NoInterfaceObject] interface MediaControllerMetadata { attribute DOMString title; attribute DOMString artist; attribute DOMString album; attribute DOMString author; attribute DOMString genre; attribute DOMString duration; attribute DOMString date; attribute DOMString copyright; attribute DOMString description; attribute DOMString trackNum; attribute DOMString picture; };
Since: 2.4
Attributes
-
DOMString titleMedia title.
Since: 2.4
-
DOMString artistMedia artist.
Since: 2.4
-
DOMString albumMedia album.
Since: 2.4
-
DOMString authorMedia author.
Since: 2.4
-
DOMString genreMedia genre.
Since: 2.4
-
DOMString durationMedia duration.
Since: 2.4
-
DOMString dateMedia date.
Since: 2.4
-
DOMString copyrightMedia copyright.
Since: 2.4
-
DOMString descriptionMedia description.
Since: 2.4
-
DOMString trackNumMedia track number.
Since: 2.4
-
DOMString pictureMedia picture.
Since: 2.4
2.8. MediaControllerServerInfoArraySuccessCallback
[Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerServerInfoArraySuccessCallback { void onsuccess(MediaControllerServerInfo[] servers); };
Since: 2.4
Methods
-
onsuccess
-
Called when all registered media controller servers found.
void onsuccess(MediaControllerServerInfo[] servers);
Since: 2.4
Parameters:
- servers: List of registered media controller servers.
2.9. MediaControllerSendCommandSuccessCallback
[Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerSendCommandSuccessCallback { void onsuccess(object? data); };
Since: 2.4
2.10. MediaControllerReceiveCommandCallback
[Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerReceiveCommandCallback { object? onsuccess(ApplicationId clientAppName, DOMString command, object data); };
Since: 2.4
Related functions:
Methods
-
onsuccess
-
Called when custom command is received by the server.
object? onsuccess(ApplicationId clientAppName, DOMString command, object data);
Since: 2.4
Parameters:
- clientAppName: Client application id.
- command: Custom command.
- data: Response object.
Return value:
-
object [nullable]:
Data object which will be included in the reply to the author of the request.
2.11. MediaControllerServerStatusChangeCallback
[Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerServerStatusChangeCallback { void onsuccess(MediaControllerServerState status); };
Since: 2.4
Methods
-
onsuccess
-
Called when server status changed.
void onsuccess(MediaControllerServerState status);
Since: 2.4
Parameters:
- status: Current server status.
2.12. MediaControllerPlaybackInfoChangeCallback
[Callback, NoInterfaceObject] interface MediaControllerPlaybackInfoChangeCallback { void onplaybackchanged(MediaControllerPlaybackState state, unsigned long long position); void onshufflemodechanged(boolean mode); void onrepeatmodechanged(boolean mode); void onmetadatachanged(MediaControllerMetadata metadata); };
Since: 2.4
Methods
-
onplaybackchanged
-
Called when playback state or position is changed.
void onplaybackchanged(MediaControllerPlaybackState state, unsigned long long position);
Since: 2.4
Parameters:
- state: Current playback state.
- position: Current playback position.
-
onshufflemodechanged
-
Called when shuffle mode is changed.
void onshufflemodechanged(boolean mode);
Since: 2.4
Parameters:
- mode: Current shuffle mode.
-
onrepeatmodechanged
-
Called when repeat mode is changed.
void onrepeatmodechanged(boolean mode);
Since: 2.4
Parameters:
- mode: Current repeat mode.
-
onmetadatachanged
-
Called when playback metadata is changed.
void onmetadatachanged(MediaControllerMetadata metadata);
Since: 2.4
Parameters:
- metadata: Current playback metadata.
2.13. MediaControllerChangeRequestPlaybackInfoCallback
[Callback, NoInterfaceObject] interface MediaControllerChangeRequestPlaybackInfoCallback { void onplaybackstaterequest(MediaControllerPlaybackState state); void onplaybackpositionrequest(unsigned long long position); void onshufflemoderequest(boolean mode); void onrepeatmoderequest(boolean mode); };
Since: 2.4
Methods
-
onplaybackstaterequest
-
Called when client requested playback state changes.
void onplaybackstaterequest(MediaControllerPlaybackState state);
Since: 2.4
Parameters:
- state: Requested playback state.
-
onplaybackpositionrequest
-
Called when client requested playback position changes.
void onplaybackpositionrequest(unsigned long long position);
Since: 2.4
Parameters:
- position: Requested playback position.
-
onshufflemoderequest
-
Called when client requested shuffle mode changes.
void onshufflemoderequest(boolean mode);
Since: 2.4
Parameters:
- mode: Requested shuffle mode.
-
onrepeatmoderequest
-
Called when client requested repeat mode changes.
void onrepeatmoderequest(boolean mode);
Since: 2.4
Parameters:
- mode: Requested repeat mode.
3. Full WebIDL
module MediaController { enum MediaControllerServerState { "ACTIVE", "INACTIVE" }; enum MediaControllerPlaybackState { "PLAY", "PAUSE", "STOP", "NEXT", "PREV", "FORWARD", "REWIND" }; Tizen implements MediaControllerObject; [NoInterfaceObject] interface MediaControllerObject { readonly attribute MediaControllerManager mediacontroller; }; [NoInterfaceObject] interface MediaControllerManager { MediaControllerClient getClient() raises(WebAPIException); MediaControllerServer createServer() raises(WebAPIException); }; [NoInterfaceObject] interface MediaControllerServer { readonly attribute MediaControllerPlaybackInfo playbackInfo; void updatePlaybackState(MediaControllerPlaybackState state) raises(WebAPIException); void updatePlaybackPosition(unsigned long long position) raises(WebAPIException); void updateShuffleMode(boolean mode) raises(WebAPIException); void updateRepeatMode(boolean mode) raises(WebAPIException); void updateMetadata(MediaControllerMetadata metadata) raises(WebAPIException); long addChangeRequestPlaybackInfoListener(MediaControllerChangeRequestPlaybackInfoCallback listener) raises(WebAPIException); void removeChangeRequestPlaybackInfoListener(long watchId) raises(WebAPIException); long addCommandListener(MediaControllerReceiveCommandCallback listener) raises(WebAPIException); void removeCommandListener(long watchId) raises(WebAPIException); }; [NoInterfaceObject] interface MediaControllerClient { void findServers(MediaControllerServerInfoArraySuccessCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); MediaControllerServerInfo? getLatestServerInfo() raises(WebAPIException); }; [NoInterfaceObject] interface MediaControllerServerInfo { readonly attribute ApplicationId name; readonly attribute MediaControllerServerState state; readonly attribute MediaControllerPlaybackInfo playbackInfo raises(WebAPIException); void sendPlaybackState(MediaControllerPlaybackState state, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void sendPlaybackPosition(unsigned long long position, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void sendShuffleMode(boolean mode, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void sendRepeatMode(boolean mode, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void sendCommand(DOMString command, object data, MediaControllerSendCommandSuccessCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); long addServerStatusChangeListener(MediaControllerServerStatusChangeCallback listener) raises(WebAPIException); void removeServerStatusChangeListener(long watchId) raises(WebAPIException); long addPlaybackInfoChangeListener(MediaControllerPlaybackInfoChangeCallback listener) raises(WebAPIException); void removePlaybackInfoChangeListener(long watchId) raises(WebAPIException); }; [NoInterfaceObject] interface MediaControllerPlaybackInfo { readonly attribute MediaControllerPlaybackState state; readonly attribute unsigned long long position; readonly attribute boolean shuffleMode; readonly attribute boolean repeatMode; readonly attribute MediaControllerMetadata metadata; }; [NoInterfaceObject] interface MediaControllerMetadata { attribute DOMString title; attribute DOMString artist; attribute DOMString album; attribute DOMString author; attribute DOMString genre; attribute DOMString duration; attribute DOMString date; attribute DOMString copyright; attribute DOMString description; attribute DOMString trackNum; attribute DOMString picture; }; [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerServerInfoArraySuccessCallback { void onsuccess(MediaControllerServerInfo[] servers); }; [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerSendCommandSuccessCallback { void onsuccess(object? data); }; [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerReceiveCommandCallback { object? onsuccess(ApplicationId clientAppName, DOMString command, object data); }; [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerServerStatusChangeCallback { void onsuccess(MediaControllerServerState status); }; [Callback, NoInterfaceObject] interface MediaControllerPlaybackInfoChangeCallback { void onplaybackchanged(MediaControllerPlaybackState state, unsigned long long position); void onshufflemodechanged(boolean mode); void onrepeatmodechanged(boolean mode); void onmetadatachanged(MediaControllerMetadata metadata); }; [Callback, NoInterfaceObject] interface MediaControllerChangeRequestPlaybackInfoCallback { void onplaybackstaterequest(MediaControllerPlaybackState state); void onplaybackpositionrequest(unsigned long long position); void onshufflemoderequest(boolean mode); void onrepeatmoderequest(boolean mode); }; };