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
- 1.1. MediaControllerServerState
- 1.2. MediaControllerSearchCategory
- 1.3. MediaControllerPlaybackState
- 1.4. MediaControllerPlaybackAction
- 1.5. MediaControllerRepeatState
- 1.6. MediaControllerContentType
- 1.7. MediaControllerContentAgeRating
- 1.8. MediaControllerAbilitySupport
- 1.9. MediaControllerSimpleAbility
- 1.10. MediaControllerDisplayModeType
- 1.11. MediaControllerDisplayRotationType
- 2. Interfaces
- 2.1. MediaControllerObject
- 2.2. MediaControllerManager
- 2.3. MediaControllerServer
- 2.4. MediaControllerClient
- 2.5. MediaControllerServerInfo
- 2.6. MediaControllerPlaybackInfo
- 2.7. MediaControllerServerPlaybackInfo
- 2.8. MediaControllerServerInfoPlaybackInfo
- 2.9. MediaControllerPlaylists
- 2.10. MediaControllerPlaylistsInfo
- 2.11. MediaControllerAbilities
- 2.12. MediaControllerPlaybackAbilities
- 2.13. MediaControllerDisplayModeAbilities
- 2.14. MediaControllerDisplayRotationAbilities
- 2.15. MediaControllerAbilitiesInfo
- 2.16. MediaControllerPlaybackAbilitiesInfo
- 2.17. MediaControllerDisplayModeAbilitiesInfo
- 2.18. MediaControllerDisplayRotationAbilitiesInfo
- 2.19. MediaControllerSubtitles
- 2.20. MediaControllerSubtitlesInfo
- 2.21. MediaControllerMode360
- 2.22. MediaControllerMode360Info
- 2.23. MediaControllerDisplayMode
- 2.24. MediaControllerDisplayModeInfo
- 2.25. MediaControllerDisplayRotation
- 2.26. MediaControllerClientInfo
- 2.27. MediaControllerDisplayRotationInfo
- 2.28. MediaControllerMetadata
- 2.29. MediaControllerPlaylistItem
- 2.30. MediaControllerMetadataInit
- 2.31. MediaControllerPlaylist
- 2.32. SearchFilter
- 2.33. MediaControllerServerInfoArraySuccessCallback
- 2.34. MediaControllerSendCommandSuccessCallback
- 2.35. RequestReply
- 2.36. MediaControllerSearchRequestReplyCallback
- 2.37. MediaControllerSearchRequestCallback
- 2.38. MediaControllerReceiveCommandCallback
- 2.39. MediaControllerEnabledChangeRequestCallback
- 2.40. MediaControllerEnabledChangeCallback
- 2.41. MediaControllerDisplayModeChangeRequestCallback
- 2.42. MediaControllerDisplayModeChangeCallback
- 2.43. MediaControllerDisplayRotationChangeRequestCallback
- 2.44. MediaControllerDisplayRotationChangeCallback
- 2.45. MediaControllerServerStatusChangeCallback
- 2.46. MediaControllerPlaybackInfoChangeCallback
- 2.47. MediaControllerChangeRequestPlaybackInfoCallback
- 2.48. MediaControllerGetAllPlaylistsSuccessCallback
- 2.49. MediaControllerPlaylistUpdatedCallback
- 2.50. MediaControllerGetItemsSuccessCallback
- 2.51. MediaControllerAbilityChangeCallback
- 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. MediaControllerSearchCategory
enum MediaControllerSearchCategory { "NO_CATEGORY", "TITLE", "ARTIST", "ALBUM", "GENRE", "TPO" };
Since: 5.5
- NO_CATEGORY - No search category.
- TITLE - Search by title.
- ARTIST - Search by artist.
- ALBUM - Search by album.
- GENRE - Search by genre.
- TPO - Search by Time Place Occasion.
1.3. 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.
1.4. MediaControllerPlaybackAction
enum MediaControllerPlaybackAction { "PLAY", "PAUSE", "STOP", "NEXT", "PREV", "FORWARD", "REWIND", "TOGGLE_PLAY_PAUSE" };
Since: 6.0
- PLAY - Corresponds to the "play" media controller playback action.
- PAUSE - Corresponds to "pause" media controller playback action.
- STOP - Corresponds to the "stop" media controller playback action.
- NEXT - Corresponds to the "next" media controller playback action.
- PREV - Corresponds to the "previous" media controller playback action.
- FORWARD - Corresponds to the "forward" media controller playback action.
- REWIND - Corresponds to the "rewind" media controller playback action.
- TOGGLE_PLAY_PAUSE - Corresponds to the "toggle play/pause" media controller playback action.
1.5. MediaControllerRepeatState
enum MediaControllerRepeatState { "REPEAT_OFF", "REPEAT_ONE", "REPEAT_ALL" };
Since: 5.5
The possible states are:
- REPEAT_OFF - repeating is disabled.
- REPEAT_ONE - repeating one media.
- REPEAT_ALL - repeating all media.
1.6. MediaControllerContentType
enum MediaControllerContentType { "IMAGE", "MUSIC", "VIDEO", "OTHER", "UNDECIDED" };
Since: 5.5
- IMAGE - content type for images.
- MUSIC - content type for music.
- VIDEO - content type for videos.
- OTHER - content type for other media.
- UNDECIDED - content type for unspecified media types.
1.7. MediaControllerContentAgeRating
enum MediaControllerContentAgeRating { "ALL", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19" };
Since: 5.5
Each value represents the minimum age restriction for the media.
1.8. MediaControllerAbilitySupport
enum MediaControllerAbilitySupport { "YES", "NO", "UNDECIDED" };
Since: 5.5
- YES - Ability is supported.
- NO - Ability is not supported.
- UNDECIDED - The support of ability is not set.
1.9. MediaControllerSimpleAbility
enum MediaControllerSimpleAbility { "PLAYBACK_POSITION", "SHUFFLE", "REPEAT", "PLAYLIST", "CLIENT_CUSTOM", "SEARCH", "SUBTITLES", "MODE_360" };
Since: 5.5
- PLAYBACK_POSITION - Ability to change playback position.
- SHUFFLE - Ability to change shuffle mode.
- REPEAT - Ability to change repeat state.
- PLAYLIST - Ability to add/change/remove playlists.
- CLIENT_CUSTOM - Ability to receive custom commands from media controller clients.
- SEARCH - Ability to receive search requests from media controller clients.
- SUBTITLES - Ability to receive requests for subtitles mode change from media controller clients.
- MODE_360 - Ability to receive requests for spherical (360°) mode change from media controller clients.
1.10. MediaControllerDisplayModeType
enum MediaControllerDisplayModeType { "LETTER_BOX", "ORIGIN_SIZE", "FULL_SCREEN", "CROPPED_FULL" };
Since: 5.5
- LETTER_BOX - Letter box display mode type.
- ORIGIN_SIZE - Origin size display mode type.
- FULL_SCREEN - Full screen display mode type.
- CROPPED_FULL - Cropped full screen display mode type.
1.11. MediaControllerDisplayRotationType
enum MediaControllerDisplayRotationType { "ROTATION_NONE", "ROTATION_90", "ROTATION_180", "ROTATION_270" };
Since: 5.5
- ROTATION_NONE - Display is not rotated.
- ROTATION_90 - Display is rotated by 90°.
- ROTATION_180 - Display is rotated by 180°.
- ROTATION_270 - Display is rotated by 270°.
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; readonly attribute MediaControllerServerPlaybackInfo playback; readonly attribute MediaControllerPlaylists playlists; attribute DOMString? iconURI raises(WebAPIException); readonly attribute MediaControllerAbilities abilities; readonly attribute MediaControllerSubtitles subtitles; readonly attribute MediaControllerMode360 mode360; readonly attribute MediaControllerDisplayMode displayMode; readonly attribute MediaControllerDisplayRotation displayRotation; MediaControllerClientInfo[] getAllClientsInfo() raises(WebAPIException); void updatePlaybackState(MediaControllerPlaybackState state) raises(WebAPIException); void updateIconURI(DOMString? iconURI) raises(WebAPIException); void updatePlaybackPosition(unsigned long long position) raises(WebAPIException); void updatePlaybackAgeRating(MediaControllerContentAgeRating rating) raises(WebAPIException); void updatePlaybackContentType(MediaControllerContentType type) raises(WebAPIException); void updateShuffleMode(boolean mode) raises(WebAPIException); void updateRepeatMode(boolean mode) raises(WebAPIException); void updateRepeatState(MediaControllerRepeatState state) raises(WebAPIException); void updateMetadata(MediaControllerMetadata metadata) raises(WebAPIException); long addChangeRequestPlaybackInfoListener(MediaControllerChangeRequestPlaybackInfoCallback listener) raises(WebAPIException); void removeChangeRequestPlaybackInfoListener(long watchId) raises(WebAPIException); void setSearchRequestListener(MediaControllerSearchRequestCallback listener) raises(WebAPIException); void unsetSearchRequestListener() raises(WebAPIException); long addCommandListener(MediaControllerReceiveCommandCallback listener) raises(WebAPIException); void removeCommandListener(long watchId) raises(WebAPIException); MediaControllerPlaylist createPlaylist(DOMString name) raises(WebAPIException); void savePlaylist(MediaControllerPlaylist playlist, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void deletePlaylist(DOMString playlistName, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void updatePlaybackItem(DOMString playlistName, DOMString index) raises(WebAPIException); void getAllPlaylists(MediaControllerGetAllPlaylistsSuccessCallback successCallback, optional ErrorCallback? errorCallback) 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.
Deprecated. Since 6.0. Instead, use MediaControllerServerPlaybackInfo playback attribute.
Since: 2.4
Remark: Object holds state which is automatically updated by update methods.
-
readonly
MediaControllerServerPlaybackInfo playbackCurrent playback info.
Since: 6.0
-
readonly
MediaControllerPlaylists playlistsObject representing features related to playlists of a media controller server.
Since: 6.0
-
DOMString iconURI [nullable]Server icon URI.
Since: 5.5
Remark: The readonly modifier is removed since 6.0 version.
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
- WebAPIException
-
readonly
MediaControllerAbilities abilitiesAbilities of the media controller server.
Since: 5.5
-
readonly
MediaControllerSubtitles subtitlesObject representing features related to subtitles control of a media controller server.
Since: 5.5
-
readonly
MediaControllerMode360 mode360Object representing features related to spherical (360°) mode control of a media controller server.
Since: 5.5
-
readonly
MediaControllerDisplayMode displayModeObject representing features related to display mode control of a media controller server.
Since: 5.5
-
readonly
MediaControllerDisplayRotation displayRotationObject representing features related to display rotation control of a media controller server.
Since: 5.5
Methods
-
getAllClientsInfo
-
Returns all existing clients info.
MediaControllerClientInfo[] getAllClientsInfo();
Since: 5.5
Remark: Code example available at sendEvent() method documentation.
Return value:
-
MediaControllerClientInfo[]:
All existing clients info.
Exceptions:
- WebAPIException
with error type UnknownError, if any platform error occurs.
- WebAPIException
-
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.
Deprecated. Since 6.0. Instead, use setter of state attribute in MediaControllerServerPlaybackInfo.
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
-
updateIconURI
-
Updates server icon URI.
Deprecated. Since 6.0. Instead, use setter of iconURI attribute in MediaControllerServer.
void updateIconURI(DOMString? iconURI);
Since: 5.5
Parameters:
- iconURI [nullable]: URI of the icon to be set.
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
Code example:
var mcServer = tizen.mediacontroller.createServer(); mcServer.updatePlaybackState("PLAY"); var mcClient = tizen.mediacontroller.getClient(); var mcServerInfo = mcClient.getLatestServerInfo(); mcServer.updateIconURI("http://example.com/res/icon2.ico"); console.log(mcServerInfo.iconURI);
Output example:
http://example.com/res/icon2.ico
-
updatePlaybackPosition
-
Updates playback position and send notification to the listening clients.
Deprecated. Since 6.0. Instead, use setter of position attribute in MediaControllerServerPlaybackInfo.
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
-
updatePlaybackAgeRating
-
Sets content age rating for current playback item.
Deprecated. Since 6.0. Instead, use setter of ageRating attribute in MediaControllerServerPlaybackInfo.
void updatePlaybackAgeRating(MediaControllerContentAgeRating rating);
Since: 5.5
Parameters:
- rating: New age rating for current playback item.
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.updatePlaybackAgeRating("10"); var mcClient = tizen.mediacontroller.getClient(); var mcServerInfo = mcClient.getLatestServerInfo(); console.log("Only viewers older than " + mcServerInfo.playbackInfo.ageRating + " are allowed to access this content.");
Output example:
Only viewers older than 10 are allowed to access this content.
-
updatePlaybackContentType
-
Sets content type for the current playback item.
Deprecated. Since 6.0. Instead, use setter of contentType attribute in MediaControllerServerPlaybackInfo.
void updatePlaybackContentType(MediaControllerContentType type);
Since: 5.5
Parameters:
- type: New content type for the current playback item.
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.updatePlaybackContentType("MUSIC"); var mcClient = tizen.mediacontroller.getClient(); var mcServerInfo = mcClient.getLatestServerInfo(); console.log("Content type of current item is " + mcServerInfo.playbackInfo.contentType);
Output example:
Content type of current item is MUSIC
-
updateShuffleMode
-
Updates shuffle mode and send notification to the listening clients.
Deprecated. Since 6.0. Instead, use setter of shuffleMode attribute in MediaControllerServerPlaybackInfo.
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.
Deprecated. Deprecated since 5.5. Instead, use updateRepeatState.
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);
-
updateRepeatState
-
Updates repeat state and sends notification to the listening clients.
Deprecated. Since 6.0. Instead, use setter of repeatState attribute in MediaControllerServerPlaybackInfo.
void updateRepeatState(MediaControllerRepeatState state);
Since: 5.5
Parameters:
- state: Repeat state to be set.
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.updateRepeatState("REPEAT_ONE"); console.log("Current repeat state is: " + mcServer.playbackInfo.repeatState);
Output example:
Current repeat state is: REPEAT_ONE
-
updateMetadata
-
Updates metadata and send notification to the listening clients.
Deprecated. Since 6.0. Instead, use save() on metadata object.
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":"", "seasonNumber":0,"seasonTitle":"","episodeNumber":0,"episodeTitle":"","resolutionWidth":0,"resolutionHeight":0}
-
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.
Deprecated. Since 6.0. Instead, use addChangeRequestListener().
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, clientName) { console.log("Playback state requested to: " + state + " by " + clientName); }, onplaybackpositionrequest: function(position, clientName) { console.log("Playback position requested to: " + position + " by " + clientName); }, onshufflemoderequest: function(mode, clientName) { console.log("Shuffle mode requested to: " + mode + " by " + clientName); }, onrepeatstaterequest: function(state, clientName) { console.log("Repeat state requested to: " + state + " by " + clientName); }, onplaybackitemrequest: function(playlistName, index, state, position, clientName) { console.log("Playlist: " + playlistName + " index: " + index + " state: " + state + " position " + position + " requested by " + clientName); } }; /* 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.
Deprecated. Since 6.0. Instead, use removeChangeRequestListener().
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, clientName) { console.log("Playback state requested to: " + state + " by " + clientName); }, onplaybackpositionrequest: function(position, clientName) { console.log("Playback position requested to: " + position + " by " + clientName); }, onshufflemoderequest: function(mode, clientName) { console.log("Shuffle mode requested to: " + mode + " by " + clientName); }, onrepeatstaterequest: function(state, clientName) { console.log("Repeat state requested to: " + state + " by " + clientName); }, onplaybackitemrequest: function(playlistName, index, state, position, clientName) { console.log("Playlist: " + playlistName + " index: " + index + " state: " + state + " position " + position + " requested by " + clientName); } }; /* Registers to receive playback info change requests. */ watcherId = mcServer.addChangeRequestPlaybackInfoListener(playbackRequestListener); /* Cancels the watch operation. */ mcServer.removeChangeRequestPlaybackInfoListener(watcherId);
-
setSearchRequestListener
-
Sets the listener for receiving search requests from a client.
void setSearchRequestListener(MediaControllerSearchRequestCallback listener);
Since: 5.5
Parameters:
- listener: Function to be called for each search command received.
Exceptions:
- WebAPIException
with error type TypeMismatchError, if any of the arguments has invalid type.
with error type UnknownError, if any other error occurs.
Code example:
var mcServer = tizen.mediacontroller.createServer(); function searchRequestListener(clientName, request) { console.log("name of the client application which sent the request: " + clientName); console.log("search command received."); request.forEach(filter => { console.log("filter: " + JSON.stringify(filter)); }); } mcServer.setSearchRequestListener(searchRequestListener);
-
unsetSearchRequestListener
-
Unsets search request listener.
void unsetSearchRequestListener();
Since: 5.5
Calling this function has no effect if the listener was not set.
Exceptions:
- WebAPIException
with error type UnknownError, if unknown error occurs.
Code example:
var mcServer = tizen.mediacontroller.createServer(); function searchRequestListener(clientName, request) { console.log("search command received."); } mcServer.setSearchRequestListener(searchRequestListener); mcServer.unsetSearchRequestListener();
- WebAPIException
-
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)); return new tizen.mediacontroller.RequestReply(new tizen.Bundle({myReply: "someValue"}), 0); }; /* 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)); return new tizen.mediacontroller.RequestReply(new tizen.Bundle({myReply: "someValue"}), 0); }; /* Registers to receive custom commands from client. */ watcherId = mcServer.addCommandListener(commandReceiveListener); /* Cancels the watch operation. */ mcServer.removeCommandListener(watcherId);
-
createPlaylist
-
Creates MediaControllerPlaylist object.
Deprecated. Since 6.0. Instead, use createPlaylist().
MediaControllerPlaylist createPlaylist(DOMString name);
Since: 5.5
Remark: Please note that there is a need to use savePlaylist(), otherwise playlist creation will have no effect on a device. All playlists will be deleted after application is closed.
Parameters:
- name: Name of the new playlist.
Return value:
-
MediaControllerPlaylist:
New empty MediaControllerPlaylist object with given name.
Exceptions:
- WebAPIException
with error type InvalidValuesError, if playlist with given name already exists.
with error type UnknownError, if any other error occurs.
Code example:
var mcServer = tizen.mediacontroller.createServer(); var playlist = mcServer.createPlaylist("testPlaylistName");
-
savePlaylist
-
Saves the playlist in a local database.
Deprecated. Since 6.0. Instead, use savePlaylist().
void savePlaylist(MediaControllerPlaylist playlist, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
Since: 5.5
The errorCallback may be triggered for one of the following errors:
- InvalidValuesError: if playlist with given name does not exist.
- UnknownError: if any other error prevents the function from successful completion.
Remark: All playlists will be deleted after the application is closed.
Parameters:
- playlist: MediaControllerPlaylist object to save.
- successCallback [optional] [nullable]: Function to be called when savePlaylist is finished without error.
- errorCallback [optional] [nullable]: Function to be called when savePlaylist fails.
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 playlist = mcServer.createPlaylist("testPlaylistName"); function successCallback() { console.log("savePlaylist successful."); } function errorCallback(error) { console.log("savePlaylist failed with error: " + error); } mcServer.savePlaylist(playlist, successCallback, errorCallback);
Output example:
savePlaylist successful.
-
deletePlaylist
-
Deletes playlist from local database.
Deprecated. Since 6.0. Instead, use deletePlaylist().
void deletePlaylist(DOMString playlistName, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
Since: 5.5
The errorCallback may be triggered for one of the following errors:
- InvalidValuesError: if playlist with given name does not exist.
- UnknownError: if any other error prevents the function from successful completion.
Parameters:
- playlistName: Name of the playlist to remove.
- successCallback [optional] [nullable]: Function to be called when deletePlaylist is finished without error.
- errorCallback [optional] [nullable]: Function to be called when deletePlaylist fails.
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 playlist = mcServer.createPlaylist("testPlaylistName"); function deleteSuccess() { console.log("deletePlaylist successful."); } function deleteFailure(error) { console.log("deletePlaylist failed with error: " + error); } function saveSuccess() { mcServer.deletePlaylist(playlist.name, deleteSuccess, deleteFailure); } mcServer.savePlaylist(playlist, saveSuccess);
Output example:
deletePlaylist successful.
-
updatePlaybackItem
-
Sets index and playlist name properties of playback info object.
Deprecated. Since 6.0. Instead, use updatePlaybackItem().
void updatePlaybackItem(DOMString playlistName, DOMString index);
Since: 5.5
Parameters:
- playlistName: Name of playlist to be set.
- index: Index of item on playlist playlistName to be set.
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
Code example:
var mcServer = tizen.mediacontroller.createServer(); var playlist = mcServer.createPlaylist("testPlaylistName"); var metadata = { title: "testTitle", artist: "testArtist", album: "testAlbum", author: "testAuthor", genre: "testGenre", duration: "testDuration", date: "testDate", copyright: "testCopyright", description: "testDescription", trackNum: "testTrackNum", picture: "testPicture" }; playlist.addItem("index1", metadata); mcServer.savePlaylist(playlist, function() { mcServer.updatePlaybackItem("testPlaylistName", "index1"); console.log("Current playlist: " + mcServer.playbackInfo.playlistName); console.log("Current index: " + mcServer.playbackInfo.index); });
Output example:
Current playlist: testPlaylistName Current index: index1
-
getAllPlaylists
-
Retrieves all playlists from a local database.
Deprecated. Since 6.0. Instead, use getAllPlaylists().
void getAllPlaylists(MediaControllerGetAllPlaylistsSuccessCallback successCallback, optional ErrorCallback? errorCallback);
Since: 5.5
The errorCallback may be triggered for one of the following errors:
- UnknownError: if any error prevents function from successful completion.
Parameters:
- successCallback: Function to be called on getAllPlaylists success.
- errorCallback [optional] [nullable]: Function to be called when getAllPlaylists fails.
Exceptions:
- WebAPIException
with error type TypeMismatchError, if any parameter has invalid type.
with error type UnknownError, if any other error occurs.
Code example:
var mcServer = tizen.mediacontroller.createServer(); var playlist = mcServer.createPlaylist("testPlaylist"); function saveSuccess() { console.log("savePlaylist successful"); function successCallback(playlists) { playlists.forEach(function(playlist) { console.log("Playlist name: " + playlist.name); }); } function errorCallback(error) { console.log("getAllPlaylists failed with error: " + error); } mcServer.getAllPlaylists(successCallback, errorCallback); } function saveError(error) { console.log("savePlaylist failed with error: " + error); } mcServer.savePlaylist(playlist, saveSuccess, saveError);
Output example:
savePlaylist successful Playlist name: testPlaylistName
2.4. MediaControllerClient
[NoInterfaceObject] interface MediaControllerClient { void findServers(MediaControllerServerInfoArraySuccessCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); MediaControllerServerInfo? getLatestServerInfo() raises(WebAPIException); long addAbilityChangeListener(MediaControllerAbilityChangeCallback listener) raises(WebAPIException); void removeAbilityChangeListener(long watchId) raises(WebAPIException); void findSubscribedServers(MediaControllerServerInfoArraySuccessCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void setCustomEventListener(MediaControllerReceiveCommandCallback listener) raises(WebAPIException); void unsetCustomEventListener() 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
-
addAbilityChangeListener
-
Adds a listener to be invoked when ability of the media controller server is changed.
long addAbilityChangeListener(MediaControllerAbilityChangeCallback listener);
Since: 5.5
Remark: Implicitly the media controller client will receive information about ability changes of every active media controller server. To receive information only from selected servers, calling function subscribe() is required.
Parameters:
- listener: Function to call on mediacontroller server's ability change.
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:
/* Client-side code */ var mcClient = tizen.mediacontroller.getClient(); var listener = { onplaybackabilitychanged: function(server, ability) { console.log("Playback ability changed, server name: " + server.name + ", abilities: "); console.log(JSON.stringify(ability)); }, ondisplaymodeabilitychanged: function(server, ability) { console.log("Display mode ability changed, server name: " + server.name + ", abilities: "); console.log(JSON.stringify(ability)); }, ondisplayrotationabilitychanged: function(server, ability) { console.log("Display rotation ability changed, server name: " + server.name + ", abilities: "); console.log(JSON.stringify(ability)); }, onsimpleabilitychanged: function(server, type, ability) { console.log(type + " ability changed, server name: " + server.name + ", ability: " + ability); } }; var watchId = mcClient.addAbilityChangeListener(listener); /* Server-side code */ var mcServer = tizen.mediacontroller.createServer(); mcServer.abilities.playback.play = "YES"; mcServer.abilities.playback.saveAbilities(); mcServer.abilities.shuffle = "NO"; mcServer.abilities.repeat = "YES"; mcServer.abilities.displayMode.fullScreen = "YES"; mcServer.abilities.displayRotation.rotation180 = "YES";
Output example:
Playback ability changed, server name: GC8qUW5iQj.MediaControllerServer, abilities: {"play":"YES","pause":"UNDECIDED","stop":"UNDECIDED","next":"UNDECIDED","prev":"UNDECIDED","forward":"UNDECIDED","rewind":"UNDECIDED","togglePlayPause":"UNDECIDED"} SHUFFLE ability changed, server name: GC8qUW5iQj.MediaControllerServer, ability: "NO" REPEAT ability changed, server name: GC8qUW5iQj.MediaControllerServer, ability: "YES" Display mode ability changed, server name: GC8qUW5iQj.MediaControllerServer, abilities: " {"letterBox":"NO","originSize":"NO","fullScreen":"YES","croppedFull":"NO"} Display rotation ability changed, server name: GC8qUW5iQj.MediaControllerServer, abilities: " {"rotationNone":"NO","rotation90":"NO","rotation180":"YES","rotation270":"NO"}
-
removeAbilityChangeListener
-
Removes selected MediaControllerAbilityChangeListener.
void removeAbilityChangeListener(long watchId);
Since: 5.5
Remark: All subscriptions added by function subscribe() will be lost after removing last MediaControllerAbilityChangeListener.
Parameters:
- watchId: Subscription identifier returned by addAbilityChangeListener().
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
Code example:
/* Client-side code */ var mcClient = tizen.mediacontroller.getClient(); var listener = { onplaybackabilitychanged: function(server, ability) { console.log("Playback ability changed, server name: " + mcServer.name + ", abilities: "); console.log(JSON.stringify(ability)); } }; var watchId = mcClient.addAbilityChangeListener(listener); /* Server-side code */ var mcServer = tizen.mediacontroller.createServer(); mcServer.abilities.playback.play = "YES"; mcServer.abilities.playback.saveAbilities(); /* Client-side code */ mcClient.removeAbilityChangeListener(watchId); /* Server-side code */ mcServer.abilities.playback.forward = "YES"; mcServer.abilities.playback.saveAbilities();
Output example:
Playback ability changed, server name: GC8qUW5iQj.MediaControllerServer, abilities: {"play":"YES","pause":"UNDECIDED","stop":"UNDECIDED","next":"UNDECIDED","prev":"UNDECIDED","forward":"UNDECIDED","rewind":"UNDECIDED","togglePlayPause":"UNDECIDED"}
-
findSubscribedServers
-
Retrieves all subscribed media controller servers.
void findSubscribedServers(MediaControllerServerInfoArraySuccessCallback successCallback, optional ErrorCallback? errorCallback);
Since: 5.5
The ErrorCallback may be triggered for one of the following errors:
- UnknownError: if any error prevents function from successful completion.
Parameters:
- successCallback: The method to invoke when all of subscribed 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 = tizen.mediacontroller.getClient(); var listener = { onsimpleabilitychanged: function(server, type, ability) { console.log(type + " ability changed, server name: " + server.name + ", ability: " + ability); } }; var watchId = mcClient.addAbilityChangeListener(listener); function errorCB(err) { console.log(err.name + " error: " + err.message); } function subscribedSuccessCB(list) { console.log("Subscribed servers:"); for (var s in list) { console.log(" server name: " + list[s].name + ", state: " + list[s].state); } } function findSuccessCB(list) { console.log("Found servers:"); for (var s in list) { console.log(" server name: " + list[s].name + ", state: " + list[s].state); } if (list.length > 0) { list[0].abilities.subscribe(); mcClient.findSubscribedServers(subscribedSuccessCB, errorCB); } } mcClient.findServers(findSuccessCB, errorCB);
Output example:
Found servers: server name: XX8qUW5iFF.MediaControllerServerOne, state: ACTIVE server name: 2cpQcelP8a.MediaControllerServerTwo, state: ACTIVE server name: To0BJCUxbR.MediaControllerServerThree, state: ACTIVE Subscribed servers: server name: XX8qUW5iFF.MediaControllerServerOne, state: ACTIVE
-
setCustomEventListener
-
Sets the media controller client's listener for custom events from the server.
void setCustomEventListener(MediaControllerReceiveCommandCallback listener);
Since: 5.5
If the listener has already been set, calling this method will override it.
Parameters:
- listener: Event handling function.
Exceptions:
- WebAPIException
with error type TypeMismatchError, if any of the arguments has invalid types.
with error type UnknownError, if any other error occurs.
Code example:
/* this example assumes that the server and client objects already exist. */ mcClient.setCustomEventListener(function(serverName, eventName, data) { return new tizen.mediacontroller.RequestReply({"reply": "data"}, 123); }); mcClient.unsetCustomEventListener();
-
unsetCustomEventListener
-
Removes the server's events listener.
void unsetCustomEventListener();
Since: 5.5
Calling this function has no effect, if the listener is not set.
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
Code example:
/* this example assumes that the server and client already exist. */ mcClient.setCustomEventListener(function(serverName, eventName, data) { return new tizen.mediacontroller.RequestReply({"reply": "data"}, 123); }); mcClient.unsetCustomEventListener();
- WebAPIException
2.5. MediaControllerServerInfo
[NoInterfaceObject] interface MediaControllerServerInfo { readonly attribute ApplicationId name; readonly attribute MediaControllerServerState state; readonly attribute MediaControllerPlaybackInfo playbackInfo raises(WebAPIException); readonly attribute MediaControllerServerInfoPlaybackInfo playback raises(WebAPIException); readonly attribute MediaControllerPlaylistsInfo playlists; readonly attribute DOMString? iconURI raises(WebAPIException); readonly attribute MediaControllerAbilitiesInfo abilities; readonly attribute MediaControllerSubtitlesInfo subtitles; readonly attribute MediaControllerMode360Info mode360; readonly attribute MediaControllerDisplayModeInfo displayMode; readonly attribute MediaControllerDisplayRotationInfo displayRotation; 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 sendRepeatState(MediaControllerRepeatState state, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void sendSearchRequest(SearchFilter[] request, MediaControllerSearchRequestReplyCallback replyCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void sendCommand(DOMString command, Bundle? 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); void getAllPlaylists(MediaControllerGetAllPlaylistsSuccessCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void sendPlaybackItem(DOMString playlistName, DOMString index, MediaControllerPlaybackState state, unsigned long long position) raises(WebAPIException); long addPlaylistUpdatedListener(MediaControllerPlaylistUpdatedCallback listener) raises(WebAPIException); void removePlaylistUpdatedListener(long listenerId) 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.
Deprecated. Since 6.0. Instead, use MediaControllerServerInfoPlaybackInfo playback attribute.
Since: 2.4
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
- WebAPIException
-
readonly
MediaControllerServerInfoPlaybackInfo playbackPlayback info of current server info.
Since: 6.0
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
- WebAPIException
-
readonly
MediaControllerPlaylistsInfo playlistsAn attribute providing access to the playlist information from the server.
Since: 6.0
-
readonly
DOMString iconURI [nullable]Server icon URI.
Since: 5.5
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
- WebAPIException
-
readonly
MediaControllerAbilitiesInfo abilitiesAbilities of the media controller server.
Since: 5.5
-
readonly
MediaControllerSubtitlesInfo subtitlesObject representing features related to subtitles control of a media controller server.
Since: 5.5
-
readonly
MediaControllerMode360Info mode360Object representing features related to spherical (360°) mode control of a media controller server.
Since: 5.5
-
readonly
MediaControllerDisplayModeInfo displayModeObject representing features related to display mode control of a media controller server.
Since: 5.5
-
readonly
MediaControllerDisplayRotationInfo displayRotationObject representing features related to display rotation control of a media controller server.
Since: 5.5
Methods
-
sendPlaybackState
-
Allows to change playback state of media controller server.
Deprecated. Since 6.0. Instead, use sendPlaybackAction().
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.
Deprecated. Since 6.0. Instead, use sendPlaybackPosition().
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.
Deprecated. Since 6.0. Instead, use sendShuffleMode().
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.
Deprecated. Deprecated since 5.5. Instead, use sendRepeatState.
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); });
-
sendRepeatState
-
Allows to change repeat state of media controller server.
Deprecated. Since 6.0. Instead, use sendRepeatState().
void sendRepeatState(MediaControllerRepeatState state, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
Since: 5.5
Parameters:
- state: Repeat state to be set.
- successCallback [optional] [nullable]: The method to invoke when repeat 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.sendRepeatState("REPEAT_ALL", function() { console.log("Repeat state changed"); }, function(e) { console.log("Unable to change repeat state: " + e.message); });
Output example:
Repeat state changed
-
sendSearchRequest
-
Sends a search request to the media controller server.
void sendSearchRequest(SearchFilter[] request, MediaControllerSearchRequestReplyCallback replyCallback, optional ErrorCallback? errorCallback);
Since: 5.5
The errorCallback may be triggered for one of the following errors:
- UnknownError: if any error prevents function from successful completion.
Remark: Search request handler should be specified on the server using setSearchRequestListener() method.
Parameters:
- request: A collection of between 1 and 20 SearchFilter objects.
- replyCallback: Function to be invoked when server reply is received.
- errorCallback [optional] [nullable]: Function to be invoked if server reports failure.
Exceptions:
- WebAPIException
with error type InvalidValuesError, if request has invalid number of filters.
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:
/* Server-side code */ var mcServer = tizen.mediacontroller.createServer(); function searchRequestListener(clientName, request) { console.log("search command received"); return new tizen.mediacontroller.RequestReply(new tizen.Bundle({"key": "value"}), 5); } mcServer.setSearchRequestListener(searchRequestListener); mcServer.updatePlaybackState("PLAY"); /* Client-side code */ var mcClient = tizen.mediacontroller.getClient(); var mcServerInfo = mcClient.getLatestServerInfo(); var query = [ new tizen.mediacontroller.SearchFilter("MUSIC", "GENRE", "rock"), new tizen.mediacontroller.SearchFilter( "MUSIC", "GENRE", "pop", new tizen.Bundle({"releasedAfter": "1993"})) ]; mcServerInfo.sendSearchRequest(query, function(reply) { console.log("reply status: " + reply.code); console.log("reply data: " + reply.data); });
Output example:
search command received reply status: 5 reply data: {"key": "value"}
-
sendCommand
-
Allows to send custom command to media controller server.
void sendCommand(DOMString command, Bundle? 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 [nullable]: 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 = new tizen.Bundle({myFilter: "rock"}); mcServerInfo.sendCommand("myPlaylistFilter", exampleCustomCommandData, function(data, code) { console.log( "Server replied with return data: " + JSON.stringify(data) + " and code: " + code); }, 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.
Deprecated. Since 6.0. Instead, use addPlaybackInfoChangeListener().
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); }, onrepeatstatechanged: function(state) { console.log("Repeat state changed to: " + state); }, 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.
Deprecated. Since 6.0. Instead, use removePlaybackInfoChangeListener().
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); }, onrepeatstatechanged: function(state) { console.log("Repeat state changed to: " + state); }, 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);
-
getAllPlaylists
-
Retrieves all playlists saved in local database.
Deprecated. Since 6.0. Instead, use getAllPlaylists().
void getAllPlaylists(MediaControllerGetAllPlaylistsSuccessCallback successCallback, optional ErrorCallback? errorCallback);
Since: 5.5
The errorCallback may be triggered for one of the following errors:
- UnknownError: if any other error prevents function from successful completion.
Parameters:
- successCallback: Function to be called upon success.
- errorCallback [optional] [nullable]: Function to be called upon failure.
Exceptions:
- WebAPIException
with error type TypeMismatchError, if any parameter has invalid type.
with error type UnknownError, if any other error occurs.
Code example:
var mcServer = tizen.mediacontroller.createServer(); var mcClient = tizen.mediacontroller.getClient(); var mcServerInfo = mcClient.getLatestServerInfo(); var playlist = mcServer.createPlaylist("testPlaylist"); function saveSuccess() { console.log("savePlaylist successful"); function successCallback(playlists) { playlists.forEach(function(playlist) { console.log("Playlist name: " + playlist.name); }); } function errorCallback(error) { console.log("getAllPlaylists failed with error: " + error); } mcServerInfo.getAllPlaylists(successCallback, errorCallback); } function saveError(error) { console.log("savePlaylist failed with error: " + error); } mcServer.savePlaylist(playlist, saveSuccess, saveError);
Output example:
savePlaylist successful Playlist name: testPlaylist
-
sendPlaybackItem
-
Requests setting new playback item to server.
Deprecated. Since 6.0. Instead, use sendPlaybackItem().
void sendPlaybackItem(DOMString playlistName, DOMString index, MediaControllerPlaybackState state, unsigned long long position);
Since: 5.5
Remark: PlaybackInfoChangeListener should be invoked, if registered.
Parameters:
- playlistName: Name of playlist to be set.
- index: Index of item on playlist to be set.
- state: Playback state.
- position: Playback position.
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
Code example:
var mcClient = tizen.mediacontroller.getClient(); var mcServerInfo = mcClient.getLatestServerInfo(); mcServerInfo.sendPlaybackItem("testPlaylist", "1", "PLAY", 0);
-
addPlaylistUpdatedListener
-
Adds listener to be invoked when playlist is updated by server.
Deprecated. Since 6.0. Instead, use addPlaylistUpdatedListener().
long addPlaylistUpdatedListener(MediaControllerPlaylistUpdatedCallback listener);
Since: 5.5
Parameters:
- listener: Listener for adding, updating or deleting of any playlist.
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 mcClient = tizen.mediacontroller.getClient(); var mcServerInfo = mcClient.getLatestServerInfo(); var listener = { onplaylistupdated: function(serverName, playlist) { console.log("updated playlist " + playlist); }, onplaylistdeleted: function(serverName, playlistName) { console.log("deleted playlist " + playlistName); } }; var listenerId = mcServerInfo.addPlaylistUpdatedListener(listener);
-
removePlaylistUpdatedListener
-
Stops listening for playlist updates and removals.
Deprecated. Since 6.0. Instead, use removePlaylistUpdatedListener().
void removePlaylistUpdatedListener(long listenerId);
Since: 5.5
Remark: This function has no effect, if there is no listener for given id.
Parameters:
- listenerId: Listener ID returned by addPlaylistUpdatedListener.
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
Code example:
var mcClient = tizen.mediacontroller.getClient(); var mcServerInfo = mcClient.getLatestServerInfo(); var listener = { onplaylistupdated: function(serverName, playlist) {}, onplaylistdeleted: function(serverName, playlistName) {} }; var listenerId = mcServerInfo.addPlaylistUpdatedListener(listener); mcServerInfo.removePlaylistUpdatedListener(listenerId);
2.6. MediaControllerPlaybackInfo
Deprecated. Since 6.0. Instead, use MediaControllerServerPlaybackInfo for server-side object of playback info and MediaControllerServerInfoPlaybackInfo for client-side object of playback info.
[NoInterfaceObject] interface MediaControllerPlaybackInfo {
readonly attribute MediaControllerPlaybackState state;
readonly attribute unsigned long long position;
readonly attribute MediaControllerContentAgeRating ageRating;
readonly attribute MediaControllerContentType contentType;
readonly attribute boolean shuffleMode;
readonly attribute boolean repeatMode;
readonly attribute MediaControllerRepeatState repeatState;
readonly attribute MediaControllerMetadata metadata;
readonly attribute DOMString? index;
readonly attribute DOMString? playlistName;
};
Since: 2.4
Attributes
-
readonly
MediaControllerPlaybackState stateCurrent playback state.
Since: 2.4
-
readonly
unsigned long long positionCurrent playback position.
Since: 2.4
-
readonly
MediaControllerContentAgeRating ageRatingCurrent playback age rating.
Since: 5.5
-
readonly
MediaControllerContentType contentTypeCurrent playback content type.
Default value is UNDECIDED.
Since: 5.5
-
readonly
boolean shuffleModeCurrent shuffle mode.
Since: 2.4
-
readonly
boolean repeatModeCurrent repeat mode.
Deprecated. Deprecated since 5.5. Instead, use repeatState.
Any change in value of repeatMode will also change the value of repeatState.
The repeatMode equal to true is equivalent to repeatState equal to REPEAT_ALL and repeatMode equal to false is equivalent to repeatState equal to REPEAT_OFF.
Since: 2.4
-
readonly
MediaControllerRepeatState repeatStateCurrent repeat state.
Any change in value of repeatState will also change the value of repeatMode, except the REPEAT_ONE value. In this case the repeatMode value will not change.
The repeatState equals to REPEAT_ALL is equivalent to repeatMode equals to true and repeatState equals to REPEAT_OFF is equivalent to repeatMode equals to false.
Default value is REPEAT_ALL.
Since: 5.5
-
readonly
MediaControllerMetadata metadataCurrent playback metadata.
Since: 2.4
-
readonly
DOMString index [nullable]Current item index.
Since: 5.5
Remark: Null if no item currently in playback.
-
readonly
DOMString playlistName [nullable]Current playlist name.
Since: 5.5
Remark: Null if no item currently in playback.
2.7. MediaControllerServerPlaybackInfo
[NoInterfaceObject] interface MediaControllerServerPlaybackInfo { attribute MediaControllerPlaybackState state raises(WebAPIException); attribute unsigned long long position raises(WebAPIException); attribute MediaControllerContentAgeRating ageRating raises(WebAPIException); attribute MediaControllerContentType contentType raises(WebAPIException); attribute boolean shuffleMode raises(WebAPIException); attribute MediaControllerRepeatState repeatState raises(WebAPIException); readonly attribute MediaControllerMetadata metadata; readonly attribute DOMString? index; readonly attribute DOMString? playlistName; void updatePlaybackItem(DOMString playlistName, DOMString index) raises(WebAPIException); long addChangeRequestListener(MediaControllerChangeRequestPlaybackInfoCallback listener) raises(WebAPIException); void removeChangeRequestListener(long watchId) raises(WebAPIException); };
Since: 6.0
Attributes
-
MediaControllerPlaybackState stateCurrent playback state.
Since: 6.0
Exceptions:
- WebAPIException
with error type TypeMismatchError, if the set value will not be compatible with MediaControllerPlaybackState enum.
with error type UnknownError, if any other error occurs.
- WebAPIException
-
unsigned long long positionCurrent playback position.
Since: 6.0
Exceptions:
- WebAPIException
with error type InvalidValuesError, if the set value is less than 0.
with error type UnknownError, if any other error occurs.
- WebAPIException
-
MediaControllerContentAgeRating ageRatingCurrent playback age rating.
Since: 6.0
Exceptions:
- WebAPIException
with error type TypeMismatchError, if the set value will not be compatible with MediaControllerContentAgeRating enum.
with error type UnknownError, if any other error occurs.
- WebAPIException
-
MediaControllerContentType contentTypeCurrent playback content type.
Since: 6.0
Exceptions:
- WebAPIException
with error type TypeMismatchError, if the set value will not be compatible with MediaControllerContentType enum.
with error type UnknownError, if any other error occurs.
- WebAPIException
-
boolean shuffleModeCurrent shuffle mode.
Since: 6.0
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
- WebAPIException
-
MediaControllerRepeatState repeatStateCurrent repeat state.
Since: 6.0
Exceptions:
- WebAPIException
with error type TypeMismatchError, if the set value will not be compatible with MediaControllerRepeatState enum.
with error type UnknownError, if any other error occurs.
- WebAPIException
-
readonly
MediaControllerMetadata metadataCurrent playback metadata.
Since: 6.0
-
readonly
DOMString index [nullable]Current item index.
Since: 6.0
-
readonly
DOMString playlistName [nullable]Current playlist name.
Since: 6.0
Methods
-
updatePlaybackItem
-
Sets index and playlist name properties of playback info object.
void updatePlaybackItem(DOMString playlistName, DOMString index);
Since: 6.0
Parameters:
- playlistName: Name of playlist to be set.
- index: Index of item on playlist playlistName to be set.
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
Code example:
var mcServer = tizen.mediacontroller.createServer(); mcServer.playback.updatePlaybackItem("testPlaylistName", "index1"); console.log("Current playlist: " + mcServer.playback.playlistName); console.log("Current index: " + mcServer.playback.index);
Output example:
Current playlist: testPlaylistName Current index: index1
-
addChangeRequestListener
-
Adds the listener for change requests of a media controller playback info.
long addChangeRequestListener(MediaControllerChangeRequestPlaybackInfoCallback listener);
Since: 6.0
Parameters:
- listener: Change request listener to add.
Return value:
-
long:
The identifier used to remove the listener.
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 = { onplaybackactionrequest: function(action, clientName) { console.log("Playback action requested to: " + action + " by " + clientName); }, onplaybackpositionrequest: function(position, clientName) { console.log("Playback position requested to: " + position + " by " + clientName); }, onshufflemoderequest: function(mode, clientName) { console.log("Shuffle mode requested to: " + mode + " by " + clientName); }, onrepeatstaterequest: function(state, clientName) { console.log("Repeat state requested to: " + state + " by " + clientName); }, onplaybackitemrequest: function(playlistName, index, state, position, clientName) { console.log("Playlist: " + playlistName + " index: " + index + " state: " + state + " position " + position + " requested by " + clientName); } }; /* Registers to receive playback info change requests from client. */ watcherId = mcServer.playback.addChangeRequestListener(playbackRequestListener);
-
removeChangeRequestListener
-
Removes the listener and stops receiving change requests of media controller playback info.
void removeChangeRequestListener(long watchId);
Since: 6.0
Calling this function has no effect if there is no listener with given id.
Parameters:
- watchId: Watcher 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 = { onplaybackactionrequest: function(action, clientName) {}, onplaybackpositionrequest: function(position, clientName) {}, onshufflemoderequest: function(mode, clientName) {}, onrepeatstaterequest: function(state, clientName) {}, onplaybackitemrequest: function(playlistName, index, state, position, clientName) {} }; /* Registers to receive playback info change requests from client. */ watcherId = mcServer.playback.addChangeRequestListener(playbackRequestListener); /* Cancels the watch operation. */ mcServer.playback.removeChangeRequestListener(watcherId);
2.8. MediaControllerServerInfoPlaybackInfo
[NoInterfaceObject] interface MediaControllerServerInfoPlaybackInfo { readonly attribute MediaControllerPlaybackState state; readonly attribute unsigned long long position; readonly attribute MediaControllerContentAgeRating ageRating; readonly attribute MediaControllerContentType contentType; readonly attribute boolean shuffleMode; readonly attribute MediaControllerRepeatState repeatState; readonly attribute MediaControllerMetadata metadata; readonly attribute DOMString? index; readonly attribute DOMString? playlistName; void sendPlaybackAction(MediaControllerPlaybackAction action, optional MediaControllerSendCommandSuccessCallback? replyCallback) raises(WebAPIException); void sendPlaybackPosition(unsigned long long position, optional MediaControllerSendCommandSuccessCallback? replyCallback) raises(WebAPIException); void sendShuffleMode(boolean mode, optional MediaControllerSendCommandSuccessCallback? replyCallback) raises(WebAPIException); void sendRepeatState(MediaControllerRepeatState state, optional MediaControllerSendCommandSuccessCallback? replyCallback) raises(WebAPIException); long addPlaybackInfoChangeListener(MediaControllerPlaybackInfoChangeCallback listener) raises(WebAPIException); void removePlaybackInfoChangeListener(long watchId) raises(WebAPIException); };
Since: 6.0
Attributes
-
readonly
MediaControllerPlaybackState stateCurrent playback state.
Since: 6.0
-
readonly
unsigned long long positionCurrent playback position.
Since: 6.0
-
readonly
MediaControllerContentAgeRating ageRatingCurrent playback age rating.
Since: 6.0
-
readonly
MediaControllerContentType contentTypeCurrent playback content type.
Since: 6.0
-
readonly
boolean shuffleModeCurrent shuffle mode.
Since: 6.0
-
readonly
MediaControllerRepeatState repeatStateCurrent repeat state.
Since: 6.0
-
readonly
MediaControllerMetadata metadataCurrent playback metadata.
Since: 6.0
-
readonly
DOMString index [nullable]Current item index. Value set to null means no playlist set in playback
Since: 6.0
-
readonly
DOMString playlistName [nullable]Current playlist name. Value set to null means no playlist set in playback
Since: 6.0
Methods
-
sendPlaybackAction
-
Sends request to change the playback state of a media controller server.
void sendPlaybackAction(MediaControllerPlaybackAction action, optional MediaControllerSendCommandSuccessCallback? replyCallback);
Since: 6.0
Parameters:
- action: Playback action.
- replyCallback [optional] [nullable]: The method to invoke when server responded to change request.
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.playback.sendPlaybackAction("STOP", function(data, code) { console.log("Server replied with return data: " + JSON.stringify(data) + " and code: " + code); });
-
sendPlaybackPosition
-
Sends request to change the playback position of a media controller server.
void sendPlaybackPosition(unsigned long long position, optional MediaControllerSendCommandSuccessCallback? replyCallback);
Since: 6.0
Parameters:
- position: Playback position.
- replyCallback [optional] [nullable]: The method to invoke when server responded to change request.
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.playback.sendPlaybackPosition(164, function(data, code) { console.log("Server replied with return data: " + JSON.stringify(data) + " and code: " + code); });
-
sendShuffleMode
-
Sends request to change the shuffle mode of a media controller server.
void sendShuffleMode(boolean mode, optional MediaControllerSendCommandSuccessCallback? replyCallback);
Since: 6.0
Parameters:
- mode: Shuffle mode.
- replyCallback [optional] [nullable]: The method to invoke when server responded to change request.
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.playback.sendShuffleMode(true, function(data, code) { console.log("Server replied with return data: " + JSON.stringify(data) + " and code: " + code); });
-
sendRepeatState
-
Sends request to change the repeat state of a media controller server.
void sendRepeatState(MediaControllerRepeatState state, optional MediaControllerSendCommandSuccessCallback? replyCallback);
Since: 6.0
Parameters:
- state: Repeat state to be set.
- replyCallback [optional] [nullable]: The method to invoke when server responded to change request.
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.playback.sendRepeatState("REPEAT_ALL", function(data, code) { console.log("Server replied with return data: " + JSON.stringify(data) + " and code: " + code); });
-
addPlaybackInfoChangeListener
-
Adds the listener for a media playback info changes.
long addPlaybackInfoChangeListener(MediaControllerPlaybackInfoChangeCallback listener);
Since: 6.0
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(); /* 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); }, onrepeatstatechanged: function(state) { console.log("Repeat state changed to: " + state); }, onmetadatachanged: function(metadata) { console.log("Playback metadata changed: " + JSON.stringify(metadata)); } }; /* Registers to be notified when playback state changes. */ watcherId = mcServerInfo.playback.addPlaybackInfoChangeListener(playbackListener);
-
removePlaybackInfoChangeListener
-
Removes the listener, so stop receiving notifications about media playback info changes.
void removePlaybackInfoChangeListener(long watchId);
Since: 6.0
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) {}, onshufflemodechanged: function(mode) {}, onrepeatstatechanged: function(state) {}, onmetadatachanged: function(metadata) {} }; /* Registers to be notified when playback state changes. */ watcherId = mcServerInfo.playback.addPlaybackInfoChangeListener(playbackListener); /* Cancels the watch operation. */ mcServerInfo.playback.removePlaybackInfoChangeListener(watcherId);
2.9. MediaControllerPlaylists
[NoInterfaceObject] interface MediaControllerPlaylists { MediaControllerPlaylist createPlaylist(DOMString name) raises(WebAPIException); void savePlaylist(MediaControllerPlaylist playlist, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void deletePlaylist(DOMString playlistName, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void getAllPlaylists(MediaControllerGetAllPlaylistsSuccessCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); MediaControllerPlaylist getPlaylist(DOMString playlistName) raises(WebAPIException); };
Since: 6.0
Methods
-
createPlaylist
-
Creates MediaControllerPlaylist object.
MediaControllerPlaylist createPlaylist(DOMString name);
Since: 6.0
Remark: Please note that there is a need to use savePlaylist(), otherwise playlist creation will have no effect on a device. All playlists will be deleted after application is closed.
Parameters:
- name: Name of the new playlist.
Return value:
-
MediaControllerPlaylist:
New empty MediaControllerPlaylist object with given name.
Exceptions:
- WebAPIException
with error type InvalidValuesError, if playlist with given name already exists.
with error type UnknownError, if any other error occurs.
Code example:
var mcServer = tizen.mediacontroller.createServer(); var playlist = mcServer.playlists.createPlaylist("testPlaylistName");
-
savePlaylist
-
Saves the playlist in a local database.
void savePlaylist(MediaControllerPlaylist playlist, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
Since: 6.0
The errorCallback may be triggered for one of the following errors:
- InvalidValuesError: if playlist with given name does not exist.
- UnknownError: if any other error prevents the function from successful completion.
Remark: All playlists will be deleted after the application is closed.
Parameters:
- playlist: MediaControllerPlaylist object to save.
- successCallback [optional] [nullable]: Function to be called when savePlaylist is finished without error.
- errorCallback [optional] [nullable]: Function to be called when savePlaylist fails.
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 playlist = mcServer.playlists.createPlaylist("testPlaylistName"); function successCallback() { console.log("savePlaylist successful."); } function errorCallback(error) { console.log("savePlaylist failed with error: " + error); } mcServer.playlists.savePlaylist(playlist, successCallback, errorCallback);
Output example:
savePlaylist successful.
-
deletePlaylist
-
Deletes the playlist from a local database.
void deletePlaylist(DOMString playlistName, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
Since: 6.0
The errorCallback may be triggered for one of the following errors:
- InvalidValuesError: if playlist with given name does not exist.
- UnknownError: if any other error prevents the function from successful completion.
Parameters:
- playlistName: Name of the playlist to remove.
- successCallback [optional] [nullable]: Function to be called when deletePlaylist is finished without error.
- errorCallback [optional] [nullable]: Function to be called when deletePlaylist fails.
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 playlist = mcServer.playlists.createPlaylist("testPlaylistName"); function deleteSuccess() { console.log("deletePlaylist successful."); } function deleteFailure(error) { console.log("deletePlaylist failed with error: " + error); } function saveSuccess() { mcServer.playlists.deletePlaylist(playlist.name, deleteSuccess, deleteFailure); } mcServer.playlists.savePlaylist(playlist, saveSuccess);
Output example:
deletePlaylist successful.
-
getAllPlaylists
-
Retrieves all playlists from a local database.
void getAllPlaylists(MediaControllerGetAllPlaylistsSuccessCallback successCallback, optional ErrorCallback? errorCallback);
Since: 6.0
The errorCallback may be triggered for one of the following errors:
- UnknownError: if any error prevents function from successful completion.
Parameters:
- successCallback: Function to be called on getAllPlaylists success.
- errorCallback [optional] [nullable]: Function to be called when getAllPlaylists fails.
Exceptions:
- WebAPIException
with error type TypeMismatchError, if any parameter has invalid type.
with error type UnknownError, if any other error occurs.
Code example:
var mcServer = tizen.mediacontroller.createServer(); var playlist = mcServer.playlists.createPlaylist("testPlaylist"); function saveSuccess() { console.log("savePlaylist successful"); function successCallback(playlists) { playlists.forEach(function(playlist) { console.log("Playlist name: " + playlist.name); }); } function errorCallback(error) { console.log("getAllPlaylists failed with error: " + error); } mcServer.playlists.getAllPlaylists(successCallback, errorCallback); } function saveError(error) { console.log("savePlaylist failed with error: " + error); } mcServer.playlists.savePlaylist(playlist, saveSuccess, saveError);
Output example:
savePlaylist successful Playlist name: testPlaylistName
-
getPlaylist
-
Returns the playlist with the given name.
MediaControllerPlaylist getPlaylist(DOMString playlistName);
Since: 6.0
Parameters:
- playlistName: The name of playlist to get.
Exceptions:
- WebAPIException
with error type NotFoundError, if the playlist with the given name does not exist.
with error type UnknownError, if any other error occurs.
Code example:
/* assuming that the playlist was previously created */ var mcServer = tizen.mediacontroller.createServer(); var playlist = null; try { playlist = mcServer.playlists.getPlaylist("testPlaylist"); } catch (err) { console.log(err.name + ": " + err.message); }
2.10. MediaControllerPlaylistsInfo
[NoInterfaceObject] interface MediaControllerPlaylistsInfo { void getAllPlaylists(MediaControllerGetAllPlaylistsSuccessCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void sendPlaybackItem(DOMString playlistName, DOMString index, MediaControllerPlaybackAction action, unsigned long long position, optional MediaControllerSendCommandSuccessCallback? replyCallback) raises(WebAPIException); long addPlaylistUpdatedListener(MediaControllerPlaylistUpdatedCallback listener) raises(WebAPIException); void removePlaylistUpdatedListener(long listenerId) raises(WebAPIException); MediaControllerPlaylist getPlaylist(DOMString playlistName) raises(WebAPIException); };
Since: 6.0
Methods
-
getAllPlaylists
-
Retrieves all playlists saved in local database.
void getAllPlaylists(MediaControllerGetAllPlaylistsSuccessCallback successCallback, optional ErrorCallback? errorCallback);
Since: 6.0
The errorCallback may be triggered for one of the following errors:
- UnknownError: if any error prevents function from successful completion.
Parameters:
- successCallback: Function to be called upon success.
- errorCallback [optional] [nullable]: Function to be called upon failure.
Exceptions:
- WebAPIException
with error type TypeMismatchError, if any parameter has invalid type.
with error type UnknownError, if any other error occurs.
Code example:
var mcServer = tizen.mediacontroller.createServer(); var mcClient = tizen.mediacontroller.getClient(); var mcServerInfo = mcClient.getLatestServerInfo(); var playlist = mcServer.playlists.createPlaylist("testPlaylist"); function saveSuccess() { console.log("savePlaylist successful"); function successCallback(playlists) { playlists.forEach(function(playlist) { console.log("Playlist name: " + playlist.name); }); } function errorCallback(error) { console.log("getAllPlaylists failed with error: " + error); } mcServerInfo.playlists.getAllPlaylists(successCallback, errorCallback); } function saveError(error) { console.log("savePlaylist failed with error: " + error); } mcServer.playlists.savePlaylist(playlist, saveSuccess, saveError);
Output example:
savePlaylist successful Playlist name: testPlaylist
-
sendPlaybackItem
-
Asks the server to set a new playback item.
void sendPlaybackItem(DOMString playlistName, DOMString index, MediaControllerPlaybackAction action, unsigned long long position, optional MediaControllerSendCommandSuccessCallback? replyCallback);
Since: 6.0
Remark: PlaybackInfoChangeListener should be invoked, if registered.
Parameters:
- playlistName: Name of playlist to be set.
- index: Index of item on playlist to be set.
- action: Playback action.
- position: Playback position.
- replyCallback [optional] [nullable]: The method to invoke when server responded to change request.
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
Code example:
var mcClient = tizen.mediacontroller.getClient(); var serverInfo = mcClient.getLatestServerInfo(); serverInfo.playlists.sendPlaybackItem("testPlaylist", "1", "PLAY", 0);
-
addPlaylistUpdatedListener
-
Adds listener to be invoked when playlist is updated by server.
long addPlaylistUpdatedListener(MediaControllerPlaylistUpdatedCallback listener);
Since: 6.0
Parameters:
- listener: Listener for adding, updating or deleting of any playlist.
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 mcClient = tizen.mediacontroller.getClient(); var mcServerInfo = mcClient.getLatestServerInfo(); var listener = { onplaylistupdated: function(serverName, playlist) { console.log("updated playlist " + playlist); }, onplaylistdeleted: function(serverName, playlistName) { console.log("deleted playlist " + playlistName); } }; var listenerId = mcServerInfo.playlists.addPlaylistUpdatedListener(listener);
-
removePlaylistUpdatedListener
-
Stops listening for playlist updates.
void removePlaylistUpdatedListener(long listenerId);
Since: 6.0
Remark: This function has no effect, if there is no listener for given id.
Parameters:
- listenerId: Listener ID returned by addPlaylistUpdatedListener.
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
Code example:
var mcClient = tizen.mediacontroller.getClient(); var mcServerInfo = mcClient.getLatestServerInfo(); var listener = { onplaylistupdated: function(serverName, playlist) {}, onplaylistdeleted: function(serverName, playlistName) {} }; var listenerId = mcServerInfo.playlists.addPlaylistUpdatedListener(listener); mcServerInfo.playlists.removePlaylistUpdatedListener(listenerId);
-
getPlaylist
-
Returns the playlist with the given name.
MediaControllerPlaylist getPlaylist(DOMString playlistName);
Since: 6.0
Parameters:
- playlistName: The name of the playlist to get.
Exceptions:
- WebAPIException
with error type NotFoundError, if the playlist with the given name does not exist.
with error type UnknownError, if any other error occurs.
Code example:
/* assuming that the playlist was previously created */ var mcClient = tizen.mediacontroller.getClient(); var mcServerInfo = mcClient.getLatestServerInfo(); var playlist = null; try { playlist = mcServerInfo.playlists.getPlaylist("testPlaylist"); } catch (err) { console.log(err.name + ": " + err.message); }
2.11. MediaControllerAbilities
[NoInterfaceObject] interface MediaControllerAbilities { readonly attribute MediaControllerPlaybackAbilities playback; readonly attribute MediaControllerDisplayModeAbilities displayMode; readonly attribute MediaControllerDisplayRotationAbilities displayRotation; attribute MediaControllerAbilitySupport playbackPosition raises(WebAPIException); attribute MediaControllerAbilitySupport shuffle raises(WebAPIException); attribute MediaControllerAbilitySupport repeat raises(WebAPIException); attribute MediaControllerAbilitySupport playlist raises(WebAPIException); attribute MediaControllerAbilitySupport clientCustom raises(WebAPIException); attribute MediaControllerAbilitySupport search raises(WebAPIException); attribute MediaControllerAbilitySupport subtitles raises(WebAPIException); attribute MediaControllerAbilitySupport mode360 raises(WebAPIException); };
Since: 5.5
Attributes
-
readonly
MediaControllerPlaybackAbilities playbackRepresents abilities of server's playback actions.
Since: 5.5
-
readonly
MediaControllerDisplayModeAbilities displayModeRepresents abilities of server's display modes.
Since: 5.5
-
readonly
MediaControllerDisplayRotationAbilities displayRotationRepresents display orientations supported by the media controller server.
Since: 5.5
-
MediaControllerAbilitySupport playbackPositionRepresents server's ability to change playback position.
Default value is UNDECIDED.
Since: 5.5
Exceptions:
- WebAPIException
with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.
with error type InvalidValuesError, if set value will be "UNDECIDED".
with error type UnknownError, if any other error occurs.
- WebAPIException
-
MediaControllerAbilitySupport shuffleRepresents server's ability to change shuffle mode.
Default value is UNDECIDED.
Since: 5.5
Exceptions:
- WebAPIException
with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.
with error type InvalidValuesError, if set value will be "UNDECIDED".
with error type UnknownError, if any other error occurs.
- WebAPIException
-
MediaControllerAbilitySupport repeatRepresents server's ability to change repeat state.
Default value is UNDECIDED.
Since: 5.5
Exceptions:
- WebAPIException
with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.
with error type InvalidValuesError, if set value will be "UNDECIDED".
with error type UnknownError, if any other error occurs.
- WebAPIException
-
MediaControllerAbilitySupport playlistRepresents server's ability to add/change/remove playlists.
Default value is UNDECIDED.
Since: 5.5
Exceptions:
- WebAPIException
with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.
with error type InvalidValuesError, if set value will be "UNDECIDED".
with error type UnknownError, if any other error occurs.
- WebAPIException
-
MediaControllerAbilitySupport clientCustomRepresents server's ability to receive custom commands from the media controller client.
Default value is UNDECIDED.
Since: 5.5
Exceptions:
- WebAPIException
with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.
with error type InvalidValuesError, if set value will be "UNDECIDED".
with error type UnknownError, if any other error occurs.
- WebAPIException
-
MediaControllerAbilitySupport searchRepresents server's ability to receive search requests from the media controller client.
Default value is UNDECIDED.
Since: 5.5
Exceptions:
- WebAPIException
with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.
with error type InvalidValuesError, if set value will be "UNDECIDED".
with error type UnknownError, if any other error occurs.
- WebAPIException
-
MediaControllerAbilitySupport subtitlesRepresents server's ability to receive requests for subtitles mode change from the media controller client.
Default value is NO.
Since: 5.5
Exceptions:
- WebAPIException
with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.
with error type InvalidValuesError, if set value will be "UNDECIDED".
with error type UnknownError, if any other error occurs.
- WebAPIException
-
MediaControllerAbilitySupport mode360Represents server's ability to receive requests for spherical (360°) mode change from the media controller client.
Default value is NO.
Since: 5.5
Exceptions:
- WebAPIException
with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.
with error type InvalidValuesError, if set value will be "UNDECIDED".
with error type UnknownError, if any other error occurs.
- WebAPIException
2.12. MediaControllerPlaybackAbilities
[NoInterfaceObject] interface MediaControllerPlaybackAbilities { attribute MediaControllerAbilitySupport play raises(WebAPIException); attribute MediaControllerAbilitySupport pause raises(WebAPIException); attribute MediaControllerAbilitySupport stop raises(WebAPIException); attribute MediaControllerAbilitySupport next raises(WebAPIException); attribute MediaControllerAbilitySupport prev raises(WebAPIException); attribute MediaControllerAbilitySupport forward raises(WebAPIException); attribute MediaControllerAbilitySupport rewind raises(WebAPIException); attribute MediaControllerAbilitySupport togglePlayPause raises(WebAPIException); void saveAbilities() raises(WebAPIException); };
Since: 5.5
Remark: Calling saveAbilities() is required to update playback abilities on the media controller server.
Attributes
-
MediaControllerAbilitySupport playRepresents server's ability to perform PLAY action.
Default value is UNDECIDED.
Since: 5.5
Exceptions:
- WebAPIException
with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.
with error type InvalidValuesError, if set value will be "UNDECIDED".
with error type UnknownError, if any other error occurs.
- WebAPIException
-
MediaControllerAbilitySupport pauseRepresents server's ability to perform PAUSE action.
Default value is UNDECIDED.
Since: 5.5
Exceptions:
- WebAPIException
with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.
with error type InvalidValuesError, if set value will be "UNDECIDED".
with error type UnknownError, if any other error occurs.
- WebAPIException
-
MediaControllerAbilitySupport stopRepresents server's ability to perform STOP action.
Default value is UNDECIDED.
Since: 5.5
Exceptions:
- WebAPIException
with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.
with error type InvalidValuesError, if set value will be "UNDECIDED".
with error type UnknownError, if any other error occurs.
- WebAPIException
-
MediaControllerAbilitySupport nextRepresents server's ability to perform NEXT action.
Default value is UNDECIDED.
Since: 5.5
Exceptions:
- WebAPIException
with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.
with error type InvalidValuesError, if set value will be "UNDECIDED".
with error type UnknownError, if any other error occurs.
- WebAPIException
-
MediaControllerAbilitySupport prevRepresents server's ability to perform PREV action.
Default value is UNDECIDED.
Since: 5.5
Exceptions:
- WebAPIException
with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.
with error type InvalidValuesError, if set value will be "UNDECIDED".
with error type UnknownError, if any other error occurs.
- WebAPIException
-
MediaControllerAbilitySupport forwardRepresents server's ability to perform FORWARD action.
Default value is UNDECIDED.
Since: 5.5
Exceptions:
- WebAPIException
with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.
with error type InvalidValuesError, if set value will be "UNDECIDED".
with error type UnknownError, if any other error occurs.
- WebAPIException
-
MediaControllerAbilitySupport rewindRepresents server's ability to perform REWIND action.
Default value is UNDECIDED.
Since: 5.5
Exceptions:
- WebAPIException
with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.
with error type InvalidValuesError, if set value will be "UNDECIDED".
with error type UnknownError, if any other error occurs.
- WebAPIException
-
MediaControllerAbilitySupport togglePlayPauseRepresents server's ability to perform TOGGLE_PLAY_PAUSE action.
Default value is UNDECIDED.
Since: 5.5
Exceptions:
- WebAPIException
with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.
with error type InvalidValuesError, if set value will be "UNDECIDED".
with error type UnknownError, if any other error occurs.
- WebAPIException
Methods
-
saveAbilities
-
Saves the current state of playback abilities to the database.
void saveAbilities();
Since: 5.5
Remark: Using this function is required to save changes of playback abilities into database, otherwise changes will have no effect on the device and clients will not be notified about an update.
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
Code example:
/* Server-side code */ var mcServer = tizen.mediacontroller.createServer(); mcServer.updatePlaybackState("PLAY"); mcServer.abilities.playback.next = "YES"; mcServer.abilities.playback.prev = "YES"; mcServer.abilities.playback.rewind = "NO"; mcServer.abilities.playback.forward = "NO"; /* Client-side code */ var mcClient = tizen.mediacontroller.getClient(); var mcServerInfo = mcClient.getLatestServerInfo(); console.log("Before save:"); console.log("ability NEXT: " + mcServerInfo.abilities.playback.next); console.log("ability PREV: " + mcServerInfo.abilities.playback.prev); console.log("ability REWIND: " + mcServerInfo.abilities.playback.rewind); console.log("ability FORWARD: " + mcServerInfo.abilities.playback.forward); /* Server-side code */ mcServer.abilities.playback.saveAbilities(); /* Client-side code */ mcServerInfo = mcClient.getLatestServerInfo(); console.log("After save:"); console.log("ability NEXT: " + mcServerInfo.abilities.playback.next); console.log("ability PREV: " + mcServerInfo.abilities.playback.prev); console.log("ability REWIND: " + mcServerInfo.abilities.playback.rewind); console.log("ability FORWARD: " + mcServerInfo.abilities.playback.forward);
Output example:
Before save: ability NEXT: UNDECIDED ability PREV: UNDECIDED ability REWIND: UNDECIDED ability FORWARD: UNDECIDED After save: ability NEXT: YES ability PREV: YES ability REWIND: NO ability FORWARD: NO
- WebAPIException
2.13. MediaControllerDisplayModeAbilities
[NoInterfaceObject] interface MediaControllerDisplayModeAbilities { attribute MediaControllerAbilitySupport letterBox raises(WebAPIException); attribute MediaControllerAbilitySupport originSize raises(WebAPIException); attribute MediaControllerAbilitySupport fullScreen raises(WebAPIException); attribute MediaControllerAbilitySupport croppedFull raises(WebAPIException); };
Since: 5.5
Attributes
-
MediaControllerAbilitySupport letterBoxRepresents server's ability to set letterBox mode.
Default value is NO.
Since: 5.5
Exceptions:
- WebAPIException
with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.
with error type InvalidValuesError, if set value will be "UNDECIDED".
with error type UnknownError, if any other error occurs.
- WebAPIException
-
MediaControllerAbilitySupport originSizeRepresents server's ability to set originSize mode.
Default value is NO.
Since: 5.5
Exceptions:
- WebAPIException
with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.
with error type InvalidValuesError, if set value will be "UNDECIDED".
with error type UnknownError, if any other error occurs.
- WebAPIException
-
MediaControllerAbilitySupport fullScreenRepresents server's ability to set fullScreen mode.
Default value is NO.
Since: 5.5
Exceptions:
- WebAPIException
with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.
with error type InvalidValuesError, if set value will be "UNDECIDED".
with error type UnknownError, if any other error occurs.
- WebAPIException
-
MediaControllerAbilitySupport croppedFullRepresents server's ability to set croppedFull mode.
Default value is NO.
Since: 5.5
Exceptions:
- WebAPIException
with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.
with error type InvalidValuesError, if set value will be "UNDECIDED".
with error type UnknownError, if any other error occurs.
- WebAPIException
2.14. MediaControllerDisplayRotationAbilities
[NoInterfaceObject] interface MediaControllerDisplayRotationAbilities { attribute MediaControllerAbilitySupport rotationNone raises(WebAPIException); attribute MediaControllerAbilitySupport rotation90 raises(WebAPIException); attribute MediaControllerAbilitySupport rotation180 raises(WebAPIException); attribute MediaControllerAbilitySupport rotation270 raises(WebAPIException); };
Since: 5.5
Attributes
-
MediaControllerAbilitySupport rotationNoneRepresents the server's ability to set 0° display orientation.
Default value is NO.
Since: 5.5
Exceptions:
- WebAPIException
with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.
with error type InvalidValuesError, if set value will be "UNDECIDED".
with error type UnknownError, if any other error occurs.
- WebAPIException
-
MediaControllerAbilitySupport rotation90Represents the server's ability to set 90° display orientation.
Default value is NO.
Since: 5.5
Exceptions:
- WebAPIException
with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.
with error type InvalidValuesError, if set value will be "UNDECIDED".
with error type UnknownError, if any other error occurs.
- WebAPIException
-
MediaControllerAbilitySupport rotation180Represents the server's ability to set 180° display orientation.
Default value is NO.
Since: 5.5
Exceptions:
- WebAPIException
with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.
with error type InvalidValuesError, if set value will be "UNDECIDED".
with error type UnknownError, if any other error occurs.
- WebAPIException
-
MediaControllerAbilitySupport rotation270Represents the server's ability to set 270° display orientation.
Default value is NO.
Since: 5.5
Exceptions:
- WebAPIException
with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.
with error type InvalidValuesError, if set value will be "UNDECIDED".
with error type UnknownError, if any other error occurs.
- WebAPIException
2.15. MediaControllerAbilitiesInfo
[NoInterfaceObject] interface MediaControllerAbilitiesInfo { readonly attribute MediaControllerPlaybackAbilitiesInfo playback; readonly attribute MediaControllerDisplayModeAbilitiesInfo displayMode; readonly attribute MediaControllerDisplayRotationAbilitiesInfo displayRotation; readonly attribute MediaControllerAbilitySupport playbackPosition raises(WebAPIException); readonly attribute MediaControllerAbilitySupport shuffle raises(WebAPIException); readonly attribute MediaControllerAbilitySupport repeat raises(WebAPIException); readonly attribute MediaControllerAbilitySupport playlist raises(WebAPIException); readonly attribute MediaControllerAbilitySupport clientCustom raises(WebAPIException); readonly attribute MediaControllerAbilitySupport search raises(WebAPIException); readonly attribute MediaControllerAbilitySupport subtitles raises(WebAPIException); readonly attribute MediaControllerAbilitySupport mode360 raises(WebAPIException); void subscribe() raises(WebAPIException); void unsubscribe() raises(WebAPIException); };
Since: 5.5
Attributes
-
readonly
MediaControllerPlaybackAbilitiesInfo playbackRepresents abilities of server's playback actions.
Since: 5.5
-
readonly
MediaControllerDisplayModeAbilitiesInfo displayModeRepresents abilities of server's display modes.
Since: 5.5
-
readonly
MediaControllerDisplayRotationAbilitiesInfo displayRotationRepresents server abilities of setting display orientations.
Since: 5.5
-
readonly
MediaControllerAbilitySupport playbackPositionRepresents server's ability to change playback position.
Since: 5.5
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
- WebAPIException
-
readonly
MediaControllerAbilitySupport shuffleRepresents server's ability to change shuffle mode.
Since: 5.5
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
- WebAPIException
-
readonly
MediaControllerAbilitySupport repeatRepresents server's ability to change repeat state.
Since: 5.5
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
- WebAPIException
-
readonly
MediaControllerAbilitySupport playlistRepresents server's ability to add/change/remove playlists.
Since: 5.5
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
- WebAPIException
-
readonly
MediaControllerAbilitySupport clientCustomRepresents server's ability to receive custom commands from media controller client.
Since: 5.5
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
- WebAPIException
-
readonly
MediaControllerAbilitySupport searchRepresents server's ability to receive search requests from media controller client.
Since: 5.5
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
- WebAPIException
-
readonly
MediaControllerAbilitySupport subtitlesRepresents server's ability to receive requests for subtitles mode change from media controller client.
Since: 5.5
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
- WebAPIException
-
readonly
MediaControllerAbilitySupport mode360Represents server's ability to receive requests for spherical (360°) mode change from media controller client.
Since: 5.5
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
- WebAPIException
Methods
-
subscribe
-
Adds a subscription for monitoring status of all abilities of server represented by this object.
void subscribe();
Since: 5.5
Remark: Function addAbilityChangeListener() must be called before current method. For code example see unsubscribe().
Exceptions:
- WebAPIException
with error type InvalidStateError, if addAbilityChangeListener() is not set.
with error type UnknownError, if any other error occurs.
- WebAPIException
-
unsubscribe
-
Removes a subscription for monitoring status of all abilities of server represented by this object.
void unsubscribe();
Since: 5.5
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
Code example:
/* Code example uses two applications: */ /* XX8qUW5iDD.FirstMCServer - both server and client app */ /* GC8qUW5iQf.SecondMCServer - only server app */ /* APP XX8qUW5iDD.FirstMCServer */ var mcServer = tizen.mediacontroller.createServer(); mcServer.updatePlaybackState("PLAY"); var mcClient = tizen.mediacontroller.getClient(); var mcServerInfo = mcClient.getLatestServerInfo(); var listener = { onsimpleabilitychanged: function(server, type, ability) { console.log(type + " ability changed, server name: " + server.name + ", ability: " + ability); } }; var watchId = mcClient.addAbilityChangeListener(listener); console.log("#### All events would be handled by listener ####"); mcServer.abilities.shuffle = "YES"; /* triggers listener */ /* APP GC8qUW5iQf.SecondMCServer */ var server2 = tizen.mediacontroller.createServer(); server2.abilities.repeat = "NO"; /* triggers listener */ /* APP XX8qUW5iDD.FirstMCServer */ console.log("#### Subscribe only changes from XX8qUW5iDD.FirstMCServer ####"); mcServerInfo.abilities.subscribe(); mcServer.abilities.shuffle = "NO"; /* triggers listener */ /* APP GC8qUW5iQf.SecondMCServer */ server2.abilities.repeat = "YES"; /* does NOT trigger listener */ /* APP XX8qUW5iDD.FirstMCServer */ console.log("#### Handle all events again ####"); mcServerInfo.abilities.unsubscribe(); mcServer.abilities.shuffle = "YES"; /* triggers listener */ /* APP GC8qUW5iQf.SecondMCServer */ server2.abilities.repeat = "NO"; /* triggers listener */
Output example:
#### All events would be handled by listener #### SHUFFLE ability changed, server name: XX8qUW5iDD.FirstMCServer, ability: "YES" REPEAT ability changed, server name: GC8qUW5iQf.SecondMCServer, ability: "NO" #### Subscribe only changes from XX8qUW5iDD.FirstMCServer #### SHUFFLE ability changed, server name: XX8qUW5iDD.FirstMCServer, ability: "NO" #### Handle all events again #### SHUFFLE ability changed, server name: XX8qUW5iDD.FirstMCServer, ability: "YES" REPEAT ability changed, server name: GC8qUW5iQf.SecondMCServer, ability: "NO"
- WebAPIException
2.16. MediaControllerPlaybackAbilitiesInfo
[NoInterfaceObject] interface MediaControllerPlaybackAbilitiesInfo { readonly attribute MediaControllerAbilitySupport play raises(WebAPIException); readonly attribute MediaControllerAbilitySupport pause raises(WebAPIException); readonly attribute MediaControllerAbilitySupport stop raises(WebAPIException); readonly attribute MediaControllerAbilitySupport next raises(WebAPIException); readonly attribute MediaControllerAbilitySupport prev raises(WebAPIException); readonly attribute MediaControllerAbilitySupport forward raises(WebAPIException); readonly attribute MediaControllerAbilitySupport rewind raises(WebAPIException); readonly attribute MediaControllerAbilitySupport togglePlayPause raises(WebAPIException); };
Since: 5.5
Attributes
-
readonly
MediaControllerAbilitySupport playRepresents server's ability to perform PLAY action.
Since: 5.5
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
- WebAPIException
-
readonly
MediaControllerAbilitySupport pauseRepresents server's ability to perform PAUSE action.
Since: 5.5
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
- WebAPIException
-
readonly
MediaControllerAbilitySupport stopRepresents server's ability to perform STOP action.
Since: 5.5
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
- WebAPIException
-
readonly
MediaControllerAbilitySupport nextRepresents server's ability to perform NEXT action.
Since: 5.5
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
- WebAPIException
-
readonly
MediaControllerAbilitySupport prevRepresents server's ability to perform PREV action.
Since: 5.5
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
- WebAPIException
-
readonly
MediaControllerAbilitySupport forwardRepresents server's ability to perform FORWARD action.
Since: 5.5
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
- WebAPIException
-
readonly
MediaControllerAbilitySupport rewindRepresents server's ability to perform REWIND action.
Since: 5.5
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
- WebAPIException
-
readonly
MediaControllerAbilitySupport togglePlayPauseRepresents server's ability to perform TOGGLE_PLAY_PAUSE action.
Since: 5.5
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
- WebAPIException
2.17. MediaControllerDisplayModeAbilitiesInfo
[NoInterfaceObject] interface MediaControllerDisplayModeAbilitiesInfo { readonly attribute MediaControllerAbilitySupport letterBox raises(WebAPIException); readonly attribute MediaControllerAbilitySupport originSize raises(WebAPIException); readonly attribute MediaControllerAbilitySupport fullScreen raises(WebAPIException); readonly attribute MediaControllerAbilitySupport croppedFull raises(WebAPIException); };
Since: 5.5
Attributes
-
readonly
MediaControllerAbilitySupport letterBoxRepresents server's ability to set letterBox mode.
Default value is NO.
Since: 5.5
Exceptions:
- WebAPIException
with error type UnknownError, if any other error occurs.
- WebAPIException
-
readonly
MediaControllerAbilitySupport originSizeRepresents server's ability to set originSize mode.
Default value is NO.
Since: 5.5
Exceptions:
- WebAPIException
with error type UnknownError, if any other error occurs.
- WebAPIException
-
readonly
MediaControllerAbilitySupport fullScreenRepresents server's ability to set fullScreen mode.
Default value is NO.
Since: 5.5
Exceptions:
- WebAPIException
with error type UnknownError, if any other error occurs.
- WebAPIException
-
readonly
MediaControllerAbilitySupport croppedFullRepresents server's ability to set croppedFull mode.
Default value is NO.
Since: 5.5
Exceptions:
- WebAPIException
with error type UnknownError, if any other error occurs.
- WebAPIException
2.18. MediaControllerDisplayRotationAbilitiesInfo
[NoInterfaceObject] interface MediaControllerDisplayRotationAbilitiesInfo { readonly attribute MediaControllerAbilitySupport rotationNone raises(WebAPIException); readonly attribute MediaControllerAbilitySupport rotation90 raises(WebAPIException); readonly attribute MediaControllerAbilitySupport rotation180 raises(WebAPIException); readonly attribute MediaControllerAbilitySupport rotation270 raises(WebAPIException); };
Since: 5.5
Attributes
-
readonly
MediaControllerAbilitySupport rotationNoneRepresents the server's ability to set 0° display orientation.
Since: 5.5
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
- WebAPIException
-
readonly
MediaControllerAbilitySupport rotation90Represents the server's ability to set 90° display orientation.
Since: 5.5
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
- WebAPIException
-
readonly
MediaControllerAbilitySupport rotation180Represents the server's ability to set 180° display orientation.
Since: 5.5
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
- WebAPIException
-
readonly
MediaControllerAbilitySupport rotation270Represents the server's ability to set 270° display orientation.
Since: 5.5
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
- WebAPIException
2.19. MediaControllerSubtitles
[NoInterfaceObject] interface MediaControllerSubtitles { attribute boolean enabled raises(WebAPIException); long addChangeRequestListener(MediaControllerEnabledChangeRequestCallback listener) raises(WebAPIException); void removeChangeRequestListener(long watchId) raises(WebAPIException); };
Since: 5.5
Attributes
-
boolean enabledState of subtitles mode on the server. Default value for a newly created server is false.
Since: 5.5
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
- WebAPIException
Methods
-
addChangeRequestListener
-
Adds the listener for change requests of a media controller subtitles mode.
long addChangeRequestListener(MediaControllerEnabledChangeRequestCallback listener);
Since: 5.5
Remark: Remember to set corresponding server's MediaControllerAbilities.subtitles ability to "YES" to let clients send change requests to the server.
Parameters:
- listener: Change request listener to add.
Return value:
-
long:
The identifier used to remove the listener.
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 changeListener = function(clientName, enabled) { console.log("Subtitles mode change requested to: " + enabled + " by " + clientName); var result = false; /* do some action here and return according to the result */ if (!result) { return new tizen.mediacontroller.RequestReply( new tizen.Bundle({"message": "Error - Not allowed"}), 13); } return new tizen.mediacontroller.RequestReply(new tizen.Bundle({"message": "Success"}), 0); }; /* Registers to subtitles mode change requests from client. */ watcherId = mcServer.subtitles.addChangeRequestListener(changeListener);
-
removeChangeRequestListener
-
Removes the listener and stops receiving change requests of media controller subtitles mode.
void removeChangeRequestListener(long watchId);
Since: 5.5
Calling this function has no effect if there is no listener with given id.
Parameters:
- watchId: Watcher identifier.
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
Code example:
var watcherId = 0; /* Watcher identifier. */ var mcServer = tizen.mediacontroller.createServer(); var changeListener = function(clientName, enabled) { console.log("Subtitles mode change requested to: " + enabled + " by " + clientName); return new tizen.mediacontroller.RequestReply(new tizen.Bundle({"message": "Success"}), 0); }; /* Registers to receive subtitles mode change requests from clients. */ watcherId = mcServer.subtitles.addChangeRequestListener(changeListener); /* Cancels the watch operation. */ mcServer.subtitles.removeChangeRequestListener(watcherId);
2.20. MediaControllerSubtitlesInfo
[NoInterfaceObject] interface MediaControllerSubtitlesInfo { readonly attribute boolean enabled raises(WebAPIException); void sendRequest(boolean enabled, MediaControllerSendCommandSuccessCallback replyCallback) raises(WebAPIException); long addModeChangeListener(MediaControllerEnabledChangeCallback listener) raises(WebAPIException); void removeModeChangeListener(long watchId) raises(WebAPIException); };
Since: 5.5
Attributes
-
readonly
boolean enabledState of subtitles mode on the server represented by this object.
Since: 5.5
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
- WebAPIException
Methods
-
sendRequest
-
Allows to send change requests for subtitles mode to media controller server.
void sendRequest(boolean enabled, MediaControllerSendCommandSuccessCallback replyCallback);
Since: 5.5
Remark: See addChangeRequestListener() method to check how to receive and respond to commands.
Parameters:
- enabled: State which is requested by a media controller client.
- replyCallback: The method to invoke when server responded to change request.
Exceptions:
- WebAPIException
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type NotSupportedError, if related ability is not supported by the media controller server.
with error type UnknownError, if any other error occurs.
Code example:
var mcClient = tizen.mediacontroller.getClient(); var mcServerInfo = mcClient.getLatestServerInfo(); var enabled = true; mcServerInfo.subtitles.sendRequest(enabled, function(data, code) { console.log("Server replied with return data: " + JSON.stringify(data) + " and code: " + code); });
-
addModeChangeListener
-
Adds the listener for changes of a media controller subtitles mode of a media controller server.
long addModeChangeListener(MediaControllerEnabledChangeCallback listener);
Since: 5.5
Parameters:
- listener: Subtitles mode 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 subtitles mode changes. */ watcherId = mcServerInfo.subtitles.addModeChangeListener(function(enabled) { console.log(mcServerInfo.name + " server subtitles mode changed to " + enabled); });
-
removeModeChangeListener
-
Removes the listener, so stop receiving notifications about media controller server subtitles mode changes.
void removeModeChangeListener(long watchId);
Since: 5.5
Calling this function has no effect if there is no listener with given id.
Parameters:
- watchId: Watcher 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 subtitles mode changes. */ watcherId = mcServerInfo.subtitles.addModeChangeListener(function(enabled) { console.log(mcServerInfo.name + " server subtitles mode changed to " + enabled); }); /* Cancels the watch operation. */ mcServerInfo.subtitles.removeModeChangeListener(watcherId);
2.21. MediaControllerMode360
[NoInterfaceObject] interface MediaControllerMode360 { attribute boolean enabled raises(WebAPIException); long addChangeRequestListener(MediaControllerEnabledChangeRequestCallback listener) raises(WebAPIException); void removeChangeRequestListener(long watchId) raises(WebAPIException); };
Since: 5.5
Attributes
-
boolean enabledState of spherical (360°) mode on the server. Default value for a newly created server is false.
Since: 5.5
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
- WebAPIException
Methods
-
addChangeRequestListener
-
Adds the listener for change requests of a media controller spherical (360°) mode.
long addChangeRequestListener(MediaControllerEnabledChangeRequestCallback listener);
Since: 5.5
Remark: Remember to set corresponding server's MediaControllerAbilities.mode360 ability to "YES" to let clients send change requests to the server.
Parameters:
- listener: Change request listener to add.
Return value:
-
long:
The identifier used to remove the listener.
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 changeListener = function(clientName, enabled) { console.log("Spherical mode change requested to: " + enabled + " by " + clientName); var result = false; /* do some action here and return according to the result */ if (!result) { return new tizen.mediacontroller.RequestReply( new tizen.Bundle({"message": "Error - Not allowed"}), 13); } return new tizen.mediacontroller.RequestReply(new tizen.Bundle({"message": "Success"}), 0); }; /* Registers to receive spherical mode change requests from clients. */ watcherId = mcServer.mode360.addChangeRequestListener(changeListener);
-
removeChangeRequestListener
-
Removes the listener and stops receiving change requests of media controller spherical (360°) mode.
void removeChangeRequestListener(long watchId);
Since: 5.5
Calling this function has no effect if there is no listener with given id.
Parameters:
- watchId: Watcher identifier.
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
Code example:
var watcherId = 0; /* Watcher identifier. */ var mcServer = tizen.mediacontroller.createServer(); var changeListener = function(clientName, enabled) { console.log("Spherical mode change requested to: " + enabled + " by " + clientName); return new tizen.mediacontroller.RequestReply(new tizen.Bundle({"message": "Success"}), 0); }; /* Registers to receive spherical mode change requests from clients. */ watcherId = mcServer.mode360.addChangeRequestListener(changeListener); /* Cancels the watch operation. */ mcServer.mode360.removeChangeRequestListener(watcherId);
2.22. MediaControllerMode360Info
[NoInterfaceObject] interface MediaControllerMode360Info { readonly attribute boolean enabled raises(WebAPIException); void sendRequest(boolean enabled, MediaControllerSendCommandSuccessCallback replyCallback) raises(WebAPIException); long addModeChangeListener(MediaControllerEnabledChangeCallback listener) raises(WebAPIException); void removeModeChangeListener(long watchId) raises(WebAPIException); };
Since: 5.5
Attributes
-
readonly
boolean enabledState of spherical (360°) mode on the server represented by this object.
Since: 5.5
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
- WebAPIException
Methods
-
sendRequest
-
Allows to send change requests for spherical (360°) mode to media controller server.
void sendRequest(boolean enabled, MediaControllerSendCommandSuccessCallback replyCallback);
Since: 5.5
Remark: See addChangeRequestListener() method to check how to receive and respond to commands.
Parameters:
- enabled: State which is requested by a media controller client.
- replyCallback: The method to invoke when server responded to change request.
Exceptions:
- WebAPIException
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type NotSupportedError, if related ability is not supported by the media controller server.
with error type UnknownError, if any other error occurs.
Code example:
var mcClient = tizen.mediacontroller.getClient(); var mcServerInfo = mcClient.getLatestServerInfo(); var enabled = true; mcServerInfo.mode360.sendRequest(enabled, function(data, code) { console.log("Server replied with return data: " + JSON.stringify(data) + " and code: " + code); });
-
addModeChangeListener
-
Adds the listener for changes of a media controller spherical (360°) mode of a media controller server.
long addModeChangeListener(MediaControllerEnabledChangeCallback listener);
Since: 5.5
Parameters:
- listener: Spherical (360°) mode 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 spherical mode changes. */ watcherId = mcServerInfo.mode360.addModeChangeListener(function(enabled) { console.log(mcServerInfo.name + " server spherical mode changed to " + enabled); });
-
removeModeChangeListener
-
Removes the listener, so stop receiving notifications about media controller server spherical (360°) mode changes.
void removeModeChangeListener(long watchId);
Since: 5.5
Calling this function has no effect if there is no listener with given id.
Parameters:
- watchId: Watcher 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 spherical mode changes. */ watcherId = mcServerInfo.mode360.addModeChangeListener(function(enabled) { console.log(mcServerInfo.name + " server spherical mode changed to " + enabled); }); /* Cancels the watch operation. */ mcServerInfo.mode360.removeModeChangeListener(watcherId);
2.23. MediaControllerDisplayMode
[NoInterfaceObject] interface MediaControllerDisplayMode { attribute MediaControllerDisplayModeType type raises(WebAPIException); long addChangeRequestListener(MediaControllerDisplayModeChangeRequestCallback listener) raises(WebAPIException); void removeChangeRequestListener(long watchId) raises(WebAPIException); };
Since: 5.5
Attributes
-
MediaControllerDisplayModeType typeType of display mode on the server. Default value for a newly created server is "FULL_SCREEN".
Since: 5.5
Exceptions:
- WebAPIException
with error type TypeMismatchError, if an input parameter is not compatible with the expected type for that parameter.
with error type UnknownError, if any other error occurs.
- WebAPIException
Methods
-
addChangeRequestListener
-
Adds the listener for change requests of the media controller display mode.
long addChangeRequestListener(MediaControllerDisplayModeChangeRequestCallback listener);
Since: 5.5
Remark: Remember to set corresponding server's display mode ability to "YES" to let clients send change requests to the server.
Parameters:
- listener: Change request listener to add.
Return value:
-
long:
The identifier used to remove the listener.
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 changeListener = function(clientName, type) { console.log("Display mode change requested to: " + type + " by " + clientName); var result = false; /* do some action here and return according to the result */ if (!result) { return new tizen.mediacontroller.RequestReply( new tizen.Bundle({"message": "Error - Not allowed"}), 13); } return new tizen.mediacontroller.RequestReply(new tizen.Bundle({"message": "Success"}), 0); }; /* Registers to receive display mode change requests from clients. */ watcherId = mcServer.displayMode.addChangeRequestListener(changeListener);
-
removeChangeRequestListener
-
Removes the listener and stops receiving change requests of media controller display mode.
void removeChangeRequestListener(long watchId);
Since: 5.5
Calling this function has no effect if there is no listener with given id.
Parameters:
- watchId: Watcher identifier.
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
Code example:
var watcherId = 0; /* Watcher identifier. */ var mcServer = tizen.mediacontroller.createServer(); var changeListener = function(clientName, type) { console.log("Display mode change requested to: " + type + " by " + clientName); }; /* Registers to receive display mode change requests from clients. */ watcherId = mcServer.displayMode.addChangeRequestListener(changeListener); /* Cancels the watch operation. */ mcServer.displayMode.removeChangeRequestListener(watcherId);
2.24. MediaControllerDisplayModeInfo
[NoInterfaceObject] interface MediaControllerDisplayModeInfo { readonly attribute MediaControllerDisplayModeType type raises(WebAPIException); void sendRequest(MediaControllerDisplayModeType type, MediaControllerSendCommandSuccessCallback replyCallback) raises(WebAPIException); long addModeChangeListener(MediaControllerDisplayModeChangeCallback listener) raises(WebAPIException); void removeModeChangeListener(long watchId) raises(WebAPIException); };
Since: 5.5
Attributes
-
readonly
MediaControllerDisplayModeType typeType of display mode on the server represented by this object.
Since: 5.5
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
- WebAPIException
Methods
-
sendRequest
-
Allows to send change requests for display mode to media controller server.
void sendRequest(MediaControllerDisplayModeType type, MediaControllerSendCommandSuccessCallback replyCallback);
Since: 5.5
Remark: See addChangeRequestListener() method to check how to receive and respond to commands.
Parameters:
- type: Type of display mode, which is requested by a media controller client.
- replyCallback: The method to invoke when server responded to change request.
Exceptions:
- WebAPIException
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type NotSupportedError, if related ability is not supported by the media controller server.
with error type UnknownError, if any other error occurs.
Code example:
var mcClient = tizen.mediacontroller.getClient(); var mcServerInfo = mcClient.getLatestServerInfo(); var type = "CROPPED_FULL"; mcServerInfo.displayMode.sendRequest(type, function(data, code) { console.log("Server replied with return data: " + JSON.stringify(data) + " and code: " + code); });
-
addModeChangeListener
-
Adds the listener for changes of a media controller display mode of a media controller server.
long addModeChangeListener(MediaControllerDisplayModeChangeCallback listener);
Since: 5.5
Parameters:
- listener: Display mode 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 display mode changes. */ watcherId = mcServerInfo.displayMode.addModeChangeListener(function(mode) { console.log(mcServerInfo.name + " server display mode changed to " + mode); });
-
removeModeChangeListener
-
Removes the listener, so stop receiving notifications about media controller server display mode changes.
void removeModeChangeListener(long watchId);
Since: 5.5
Calling this function has no effect if there is no listener with given id.
Parameters:
- watchId: Watcher 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 display mode changes. */ watcherId = mcServerInfo.displayMode.addModeChangeListener(function(mode) { console.log(mcServerInfo.name + " server display mode changed to " + mode); }); /* Cancels the watch operation. */ mcServerInfo.displayMode.removeModeChangeListener(watcherId);
2.25. MediaControllerDisplayRotation
[NoInterfaceObject] interface MediaControllerDisplayRotation { attribute MediaControllerDisplayRotationType displayRotation raises(WebAPIException); long addChangeRequestListener(MediaControllerDisplayRotationChangeRequestCallback listener) raises(WebAPIException); void removeChangeRequestListener(long watchId) raises(WebAPIException); };
Since: 5.5
Attributes
-
MediaControllerDisplayRotationType displayRotationState of display rotation on the server. Default value for a newly created server is "ROTATION_NONE".
Since: 5.5
Exceptions:
- WebAPIException
with error type TypeMismatchError, if an input parameter is not compatible with the expected type for that parameter.
with error type UnknownError, if any other error occurs.
- WebAPIException
Methods
-
addChangeRequestListener
-
Adds the listener for change requests of a media controller display rotation.
long addChangeRequestListener(MediaControllerDisplayRotationChangeRequestCallback listener);
Since: 5.5
Remark: Remember to set corresponding server's display rotation ability to "YES" to let clients send change requests to the server.
Parameters:
- listener: Change request listener to add.
Return value:
-
long:
The identifier used to remove the listener.
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 changeListener = function(clientName, rotation) { console.log("Display rotation change requested to: " + rotation + " by " + clientName); var result = false; /* do some action here and return according to the result */ if (!result) { return new tizen.mediacontroller.RequestReply( new tizen.Bundle({"message": "Error - Not allowed"}), 13); } return new tizen.mediacontroller.RequestReply(new tizen.Bundle({"message": "Success"}), 0); }; /* Registers to receive display rotation change requests from clients. */ watcherId = mcServer.displayRotation.addChangeRequestListener(changeListener);
-
removeChangeRequestListener
-
Removes the listener and stops receiving change requests of media controller display rotation.
void removeChangeRequestListener(long watchId);
Since: 5.5
Calling this function has no effect if there is no listener with given id.
Parameters:
- watchId: Watcher identifier.
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
Code example:
var watcherId = 0; /* Watcher identifier. */ var mcServer = tizen.mediacontroller.createServer(); var changeListener = function(clientName, rotation) { console.log("Display rotation change requested to: " + rotation + " by " + clientName); return new tizen.mediacontroller.RequestReply(new tizen.Bundle({"message": "Success"}), 0); }; /* Registers to receive display rotation change requests from clients. */ watcherId = mcServer.displayRotation.addChangeRequestListener(changeListener); /* Cancels the watch operation. */ mcServer.displayRotation.removeChangeRequestListener(watcherId);
2.26. MediaControllerClientInfo
[NoInterfaceObject] interface MediaControllerClientInfo { readonly attribute ApplicationId name; void sendEvent(DOMString eventName, Bundle? data, MediaControllerSendCommandSuccessCallback successCallback) raises(WebAPIException); };
Since: 5.5
Attributes
-
readonly
ApplicationId nameId of the client application.
Since: 5.5
Methods
-
sendEvent
-
Sends an event to the client.
void sendEvent(DOMString eventName, Bundle? data, MediaControllerSendCommandSuccessCallback successCallback);
Since: 5.5
Parameters:
- eventName: Name of the event.
- data [nullable]: Additional event data.
- successCallback: Reply handling function.
Exceptions:
- WebAPIException
with error type TypeMismatchError, if any argument has invalid type.
with error type UnknownError, if any other error occurs.
Code example:
/* CLIENT APPLICATION */ var mcClient = tizen.mediacontroller.getClient(); mcClient.setCustomEventListener(function(serverName, eventName, data) { console.log("Media controller client received an event from the server:"); console.log(" name: " + eventName); console.log(" data: " + JSON.stringify(data)); mcClient.unsetCustomEventListener(); return new tizen.mediacontroller.RequestReply({response: "response data"}, 123); }); /* SERVER APPLICATION */ var mcServer = tizen.mediacontroller.createServer(); mcServer.updatePlaybackState("PLAY"); var mcClientsInfoAll = mcServer.getAllClientsInfo(); if (mcClientsInfoAll.length < 1) { console.log("Server has no active clients."); } else { mcClientsInfoAll[0].sendEvent( "test", new tizen.Bundle({param1: "value1", param2: "value2"}), function(response) { console.log("Media controller server received a reply to the event:"); console.log(" response: " + JSON.stringify(response)); }); }
Output example:
Media controller client received an event from the server: name: test data: '{param1: "value1", param2: "value2"}' Media controller server received a reply to the event: response: '{data: {response: "response data"}, code: 123}'
2.27. MediaControllerDisplayRotationInfo
[NoInterfaceObject] interface MediaControllerDisplayRotationInfo { readonly attribute MediaControllerDisplayRotationType displayRotation raises(WebAPIException); void sendRequest(MediaControllerDisplayRotationType displayRotation, MediaControllerSendCommandSuccessCallback replyCallback) raises(WebAPIException); long addDisplayRotationChangeListener(MediaControllerDisplayRotationChangeCallback listener) raises(WebAPIException); void removeDisplayRotationChangeListener(long watchId) raises(WebAPIException); };
Since: 5.5
Attributes
-
readonly
MediaControllerDisplayRotationType displayRotationState of display rotation on the server represented by this object.
Since: 5.5
Exceptions:
- WebAPIException
with error type UnknownError, if any error occurs.
- WebAPIException
Methods
-
sendRequest
-
Allows to send change requests for display rotation change to a media controller server.
void sendRequest(MediaControllerDisplayRotationType displayRotation, MediaControllerSendCommandSuccessCallback replyCallback);
Since: 5.5
Remark: See addChangeRequestListener() method to check how to receive and respond to commands.
Parameters:
- displayRotation: Display rotation, which is requested by client.
- replyCallback: The method to invoke when server responded to change request.
Exceptions:
- WebAPIException
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
with error type NotSupportedError, if related ability is not supported by server.
with error type UnknownError, if any other error occurs.
Code example:
var mcClient = tizen.mediacontroller.getClient(); var mcServerInfo = mcClient.getLatestServerInfo(); var rotation = "ROTATION_180"; mcServerInfo.displayRotation.sendRequest(rotation, function(data, code) { console.log("Server replied with return data: " + JSON.stringify(data) + " and code: " + code); });
-
addDisplayRotationChangeListener
-
Adds the listener for changes of a display rotation of a media controller server.
long addDisplayRotationChangeListener(MediaControllerDisplayRotationChangeCallback listener);
Since: 5.5
Parameters:
- listener: Display rotation 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 display rotation changes. */ watcherId = mcServerInfo.displayRotation.addDisplayRotationChangeListener(function(rotation) { console.log(mcServerInfo.name + " server display rotation changed to " + rotation); });
-
removeDisplayRotationChangeListener
-
Removes the listener, so stop receiving notifications about media controller server display rotation changes.
void removeDisplayRotationChangeListener(long watchId);
Since: 5.5
Calling this function has no effect if there is no listener with given id.
Parameters:
- watchId: Watcher 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 display rotation changes. */ watcherId = mcServerInfo.displayRotation.addDisplayRotationChangeListener(function(rotation) { console.log(mcServerInfo.name + " server display rotation changed to " + rotation); }); /* Cancels the watch operation. */ mcServerInfo.displayRotation.removeDisplayRotationChangeListener(watcherId);
2.28. 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; attribute long seasonNumber; attribute DOMString? seasonTitle; attribute long episodeNumber; attribute DOMString? episodeTitle; attribute long resolutionWidth; attribute long resolutionHeight; void save() raises(WebAPIException); };
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
-
long seasonNumberSeason number. Default value is 0.
Since: 5.5
-
DOMString seasonTitle [nullable]Season title. Default value is null.
Since: 5.5
-
long episodeNumberEpisode number. Default value is 0.
Since: 5.5
-
DOMString episodeTitle [nullable]Episode title. Default value is null.
Since: 5.5
-
long resolutionWidthResolution width. Default value is 0. It cannot be changed to less than 0. Setting inappropriate values has no effect on the attribute.
Since: 5.5
-
long resolutionHeightResolution height. Default value is 0. It cannot be changed to less than 0. Setting inappropriate values has no effect on the attribute.
Since: 5.5
Methods
-
save
-
Saves current state of metadata to the database and sends notification to the listening clients.
void save();
Since: 6.0
Exceptions:
- WebAPIException
with error type UnknownError, if any other error occurs.
Code example:
var mcServer = tizen.mediacontroller.createServer(); var mcClient = tizen.mediacontroller.getClient(); var mcServerInfo = mcClient.getLatestServerInfo(); mcServer.playback.metadata.artist = "Artist Name"; console.log("Before save metadata is: " + JSON.stringify(mcServerInfo.playback.metadata)); mcServer.playback.metadata.save(); console.log("After save metadata is: " + JSON.stringify(mcServerInfo.playback.metadata));
Output example:
Before save metadata is: {"title":"","artist":"","album":"","author":"","genre":"","duration":"","date":"", "copyright":"","description":"","trackNum":"","picture":"","seasonNumber":0,"seasonTitle":null, "episodeNumber":0,"episodeTitle":null,"resolutionWidth":0,"resolutionHeight":0} After save metadata is: {"title":"","artist":"ArtistName","album":"","author":"","genre":"","duration":"","date":"", "copyright":"","description":"","trackNum":"","picture":"","seasonNumber":0,"seasonTitle":null, "episodeNumber":0,"episodeTitle":null,"resolutionWidth":0,"resolutionHeight":0}
- WebAPIException
2.29. MediaControllerPlaylistItem
[NoInterfaceObject] interface MediaControllerPlaylistItem { readonly attribute DOMString index; readonly attribute MediaControllerMetadata metadata; };
Since: 5.5
Attributes
-
readonly
DOMString indexIndex of playlist's item. Should be unique within playlist.
Since: 5.5
-
readonly
MediaControllerMetadata metadataMetadata associated with item.
Since: 5.5
2.30. MediaControllerMetadataInit
dictionary MediaControllerMetadataInit { DOMString title; DOMString artist; DOMString album; DOMString author; DOMString genre; DOMString duration; DOMString date; DOMString copyright; DOMString description; DOMString trackNum; DOMString picture; long seasonNumber; DOMString seasonTitle; long episodeNumber; DOMString episodeTitle; long resolutionWidth; long resolutionHeight; };
Since: 5.5
See MediaControllerMetadata interface for more information about the members.
2.31. MediaControllerPlaylist
[NoInterfaceObject] interface MediaControllerPlaylist { readonly attribute DOMString name; void addItem(DOMString index, MediaControllerMetadataInit metadata) raises(WebAPIException); void getItems(MediaControllerGetItemsSuccessCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); };
Since: 5.5
Attributes
-
readonly
DOMString nameName of this playlist.
Since: 5.5
Methods
-
addItem
-
Adds new item to the playlist.
void addItem(DOMString index, MediaControllerMetadataInit metadata);
Since: 5.5
Parameters:
- index: Index for new item, should be unique within playlist.
- metadata: Metadata to be associated with new item.
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 playlist = mcServer.createPlaylist("testPlaylist"); var metadata = { title: "testTitle", artist: "testArtist", album: "testAlbum", author: "testAuthor", genre: "testGenre", duration: "testDuration", date: "testDate", copyright: "testCopyright", description: "testDescription", trackNum: "testTrackNum", picture: "testPicture", seasonNumber: 1, seasonTitle: "testSeasonTitle", episodeNumber: 1, episodeTitle: "testEpisodeTitle", resolutionWidth: 1600, resolutionHeight: 900 }; playlist.addItem("index1", metadata); console.log("Item added."); function successCallback() { console.log("savePlaylist successful."); } function errorCallback(error) { console.log("savePlaylist failed with error: " + error); } mcServer.savePlaylist(playlist, successCallback, errorCallback);
Output example:
Item added. savePlaylist successful.
-
getItems
-
Gets all items from playlist.
void getItems(MediaControllerGetItemsSuccessCallback successCallback, optional ErrorCallback? errorCallback);
Since: 5.5
The errorCallback may be triggered for one of the following errors:
- UnknownError: if any error prevents function from successful completion.
Remark: Note that getItems() method return only those items from playlist which been saved by savePlaylist() method.
Parameters:
- successCallback: Function to be called when getItems is finished without error.
- errorCallback [optional] [nullable]: Function to be called when getItems fails.
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:
/* Assumes that code example from addItem was executed before */ function successCallback(items) { items.forEach(function(item) { console.log("Index: " + item.index + " Title: " + item.metadata.title); }); } function errorCallback(error) { console.log("getItems failed with error: " + error); } playlist.getItems(successCallback, errorCallback);
Output example:
Index: index1 Title: testTitle
2.32. SearchFilter
[Constructor(MediaControllerContentType contentType, optional MediaControllerSearchCategory category = "NO_CATEGORY", optional DOMString? keyword = null, optional Bundle? extraData = null)] interface SearchFilter { attribute MediaControllerContentType contentType raises(WebAPIException); attribute MediaControllerSearchCategory category raises(WebAPIException); attribute DOMString? keyword raises(WebAPIException); attribute Bundle? extraData; };
Since: 5.5
Remark: throws WebAPIException with error type TypeMismatchError, if constructor is called with invalid argument types.
Remark: throws WebAPIException with error type InvalidValuesError, if constructor is called with null keyword and category different than NO_CATEGORY.
Constructors
-
Constructor (MediaControllerContentType, MediaControllerSearchCategory, DOMString?, Bundle?)
SearchFilter(MediaControllerContentType contentType, optional MediaControllerSearchCategory category = "NO_CATEGORY", optional DOMString? keyword = null, optional Bundle? extraData = null);
Attributes
-
MediaControllerContentType contentTypeSpecifies filter's content type parameter.
Since: 5.5
Exceptions:
- WebAPIException
with error type TypeMismatchError, if the input parameter is not compatible with the expected type.
- WebAPIException
-
MediaControllerSearchCategory categorySpecifies filter's search category parameter.
Since: 5.5
Exceptions:
- WebAPIException
with error type TypeMismatchError, if the input parameter is not compatible with the expected type.
with error type InvalidValuesError, if keyword is null and new category value is not NO_CATEGORY.
- WebAPIException
-
DOMString keyword [nullable]Specifies filter's search keyword parameter.
Since: 5.5
Remark: Keyword can only be null or empty if the category is set to NO_CATEGORY.
Exceptions:
- WebAPIException
with error type InvalidValuesError, if the category is not NO_CATEGORY and the keyword is null.
- WebAPIException
-
Bundle extraData [nullable]Additional application-dependent search parameters.
Since: 5.5
2.33. 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.34. MediaControllerSendCommandSuccessCallback
[Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerSendCommandSuccessCallback { void onsuccess(object? data, optional long code); };
Since: 2.4
Interface is used as a success method for:
- MediaControllerServerInfo.sendCommand()
- MediaControllerMode360Info.sendRequest()
- MediaControllerSubtitlesInfo.sendRequest()
- MediaControllerDisplayMode.sendRequest()
- MediaControllerDisplayRotationInfo.sendRequest()
- MediaControllerClientInfo.sendEvent()
Methods
-
onsuccess
-
Called when a response to the request is received.
void onsuccess(object? data, optional long code);
Since: 2.4
Parameters:
- data [nullable]: Response data object sent by the command handler. This object is compatible with Bundle object.
- code [optional]: Response code.
2.35. RequestReply
[Constructor(Bundle? data, optional long code = 0)] interface RequestReply { attribute Bundle? data; attribute long code; };
Since: 5.5
Attributes
-
Bundle data [nullable]Response data bundle.
Since: 5.5
-
long codeResponse status code.
Since: 5.5
2.36. MediaControllerSearchRequestReplyCallback
[Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerSearchRequestReplyCallback { void onreply(RequestReply? reply); };
Since: 5.5
Methods
-
onreply
-
Function called when search request has been processed.
void onreply(RequestReply? reply);
Since: 5.5
Interpretation of status and data parameters depends on the server implementation.
Parameters:
- reply [nullable]: Reply object returned by request handler.
2.37. MediaControllerSearchRequestCallback
[Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerSearchRequestCallback { RequestReply? onrequest(ApplicationId clientName, SearchFilter[] request); };
Since: 5.5
Methods
-
onrequest
-
Function called on the server when it receives a search request from a client.
RequestReply? onrequest(ApplicationId clientName, SearchFilter[] request);
Since: 5.5
Parameters:
- clientName: Request sender name.
- request: Collection of filters to refine the search results.
Return value:
-
RequestReply [nullable]:
RequestReply object with status code and reply data bundle.
It will be passed to the replyCallback of sendSearchRequest().
2.38. MediaControllerReceiveCommandCallback
[Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerReceiveCommandCallback { RequestReply? onsuccess(ApplicationId senderAppName, DOMString command, object data); };
Since: 2.4
Related functions:
Methods
-
onsuccess
-
Called when custom command is received by the server or custom event is received by the client.
RequestReply? onsuccess(ApplicationId senderAppName, DOMString command, object data);
Since: 2.4
Parameters:
- senderAppName: Sender application id.
- command: Custom command or event.
- data: Response object. This object is compatible with Bundle.
Return value:
-
RequestReply [nullable]:
RequestReply object which will be returned to the author of the request.
2.39. MediaControllerEnabledChangeRequestCallback
[Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerEnabledChangeRequestCallback { RequestReply? onreply(ApplicationId clientName, boolean enabled); };
Since: 5.5
Methods
-
onreply
-
Called when change request is received from client.
RequestReply? onreply(ApplicationId clientName, boolean enabled);
Since: 5.5
Remark: You can return data object from callback which will be sent in reply to the client. See mode360.addChangeRequestListener() and subtitles.addChangeRequestListener() methods to check how to handle and respond to commands.
Parameters:
- clientName: The ID of a client application which the request was sent from.
- enabled: The value requested by a client application.
Return value:
-
RequestReply [nullable]:
RequestReply object which is sent with the reply to the client.
2.40. MediaControllerEnabledChangeCallback
[Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerEnabledChangeCallback { void onchange(boolean enabled); };
Since: 5.5
2.41. MediaControllerDisplayModeChangeRequestCallback
[Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerDisplayModeChangeRequestCallback { RequestReply? onreply(ApplicationId clientName, MediaControllerDisplayModeType mode); };
Since: 5.5
Methods
-
onreply
-
Called when change request is received from client.
RequestReply? onreply(ApplicationId clientName, MediaControllerDisplayModeType mode);
Since: 5.5
Remark: You can return data object from callback which will be sent in reply to the client. See addChangeRequestListener() method to check how to handle and respond to commands.
Parameters:
- clientName: An id of a client application which sent the request.
- mode: The value requested by a client application.
Return value:
-
RequestReply [nullable]:
RequestReply object which is sent with the reply to the client.
2.42. MediaControllerDisplayModeChangeCallback
[Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerDisplayModeChangeCallback { void onchange(MediaControllerDisplayModeType mode); };
Since: 5.5
Methods
-
onchange
-
Called when server's display mode is changed.
void onchange(MediaControllerDisplayModeType mode);
Since: 5.5
Parameters:
- mode: Current server display mode.
2.43. MediaControllerDisplayRotationChangeRequestCallback
[Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerDisplayRotationChangeRequestCallback { RequestReply? onreply(ApplicationId clientName, MediaControllerDisplayRotationType displayRotation); };
Since: 5.5
Methods
-
onreply
-
Called when change request is received from a client.
RequestReply? onreply(ApplicationId clientName, MediaControllerDisplayRotationType displayRotation);
Since: 5.5
Remark: You can return data object from callback which will be sent in reply to the client. See displayRotation.addChangeRequestListener() method to check how to handle and respond to commands.
Parameters:
- clientName: An id of a client application which sent the request.
- displayRotation: The value requested by a client application.
Return value:
-
RequestReply [nullable]:
RequestReply object which is sent with the reply to the client.
2.44. MediaControllerDisplayRotationChangeCallback
[Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerDisplayRotationChangeCallback { void onchange(MediaControllerDisplayRotationType displayRotation); };
Since: 5.5
Methods
-
onchange
-
Called when display rotation is changed.
void onchange(MediaControllerDisplayRotationType displayRotation);
Since: 5.5
Parameters:
- displayRotation: Current server display rotation state.
2.45. 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.46. MediaControllerPlaybackInfoChangeCallback
[Callback, NoInterfaceObject] interface MediaControllerPlaybackInfoChangeCallback { void onplaybackchanged(MediaControllerPlaybackState state, unsigned long long position); void onshufflemodechanged(boolean mode); void onrepeatmodechanged(boolean mode); void onrepeatstatechanged(MediaControllerRepeatState state); 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.
Deprecated. Deprecated since 5.5. Instead, use onrepeatstatechanged.
void onrepeatmodechanged(boolean mode);
Since: 2.4
Remark: The onrepeatmodechanged callback will not be invoked, if the repeatState is changed to REPEAT_ONE.
Parameters:
- mode: Current repeat mode.
-
onrepeatstatechanged
-
Called when repeat state is changed.
void onrepeatstatechanged(MediaControllerRepeatState state);
Since: 5.5
It is guaranteed that the onrepeatstatechanged callback will be invoked after the onrepeatmodechanged.
Parameters:
- state: Current repeat state.
-
onmetadatachanged
-
Called when playback metadata is changed.
void onmetadatachanged(MediaControllerMetadata metadata);
Since: 2.4
Parameters:
- metadata: Current playback metadata.
2.47. MediaControllerChangeRequestPlaybackInfoCallback
[Callback, NoInterfaceObject] interface MediaControllerChangeRequestPlaybackInfoCallback { void onplaybackstaterequest(MediaControllerPlaybackState state, ApplicationId clientName); RequestReply? onplaybackactionrequest(MediaControllerPlaybackAction action, ApplicationId clientName); RequestReply? onplaybackpositionrequest(unsigned long long position, ApplicationId clientName); RequestReply? onshufflemoderequest(boolean mode, ApplicationId clientName); void onrepeatmoderequest(boolean mode, ApplicationId clientName); RequestReply? onrepeatstaterequest(MediaControllerRepeatState state, ApplicationId clientName); RequestReply? onplaybackitemrequest(DOMString playlistName, DOMString index, MediaControllerPlaybackAction action, unsigned long long position, ApplicationId clientName); };
Since: 2.4
Methods
-
onplaybackstaterequest
-
Called when client requested playback state changes.
Deprecated. Since 6.0. Instead, use onplaybackactionrequest().
void onplaybackstaterequest(MediaControllerPlaybackState state, ApplicationId clientName);
Since: 2.4
Remark: Parameter clientName is passed since Tizen 5.5.
Parameters:
- state: Requested playback state.
- clientName: Id of client application, which sent a command.
-
onplaybackactionrequest
-
Called when a client requested the playback state changes by sending the playback action.
RequestReply? onplaybackactionrequest(MediaControllerPlaybackAction action, ApplicationId clientName);
Since: 6.0
Parameters:
- action: Playback action sent by the client.
- clientName: Id of client application, which sent a command.
-
onplaybackpositionrequest
-
Called when client requested playback position changes.
RequestReply? onplaybackpositionrequest(unsigned long long position, ApplicationId clientName);
Since: 2.4
Remark: Parameter clientName is passed since Tizen 5.5.
Parameters:
- position: Requested playback position.
- clientName: Id of client application, which sent a command.
-
onshufflemoderequest
-
Called when client requested shuffle mode changes.
RequestReply? onshufflemoderequest(boolean mode, ApplicationId clientName);
Since: 2.4
Remark: Parameter clientName is passed since Tizen 5.5.
Parameters:
- mode: Requested shuffle mode.
- clientName: Id of client application, which sent a command.
-
onrepeatmoderequest
-
Called when client requested repeat mode changes.
Deprecated. Deprecated since 5.5. Instead, use onrepeatstaterequest.
void onrepeatmoderequest(boolean mode, ApplicationId clientName);
Since: 2.4
Remark: The onrepeatmoderequest callback will not be invoked, if the repeatState is requested to be changed to REPEAT_ONE.
Remark: Parameter clientName is passed since Tizen 5.5.
Parameters:
- mode: Requested repeat mode.
- clientName: Client application id which sent command.
-
onrepeatstaterequest
-
Called when client requested change of repeat state.
RequestReply? onrepeatstaterequest(MediaControllerRepeatState state, ApplicationId clientName);
Since: 5.5
It is guaranteed that the onrepeatstaterequest callback will be invoked after the onrepeatmoderequest.
Parameters:
- state: Requested repeat state.
- clientName: Id of client application, which sent a command.
-
onplaybackitemrequest
-
Called when client request change of playback item.
RequestReply? onplaybackitemrequest(DOMString playlistName, DOMString index, MediaControllerPlaybackAction action, unsigned long long position, ApplicationId clientName);
Since: 5.5
Parameters:
- playlistName: Name of playlist.
- index: Index of the item to be changed.
- action: Playback action.
- position: Playback position.
- clientName: Id of client application, which sent a command.
2.48. MediaControllerGetAllPlaylistsSuccessCallback
[Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerGetAllPlaylistsSuccessCallback { void onsuccess(MediaControllerPlaylist[] playlists); };
Since: 5.5
Methods
-
onsuccess
-
Success callback for getAllPlaylists function.
void onsuccess(MediaControllerPlaylist[] playlists);
Since: 5.5
Parameters:
- playlists: Collection of MediaControllerPlaylist objects.
2.49. MediaControllerPlaylistUpdatedCallback
[Callback, NoInterfaceObject] interface MediaControllerPlaylistUpdatedCallback { void onplaylistupdated(DOMString serverName, MediaControllerPlaylist playlist); void onplaylistdeleted(DOMString serverName, DOMString playlistName); };
Since: 5.5
Methods
-
onplaylistupdated
-
Event triggered when playlist is updated in database.
void onplaylistupdated(DOMString serverName, MediaControllerPlaylist playlist);
Since: 5.5
Parameters:
- serverName: Name of server which triggered the event.
- playlist: Playlist for which event was triggered.
-
onplaylistdeleted
-
Event triggered when playlist is removed from database.
void onplaylistdeleted(DOMString serverName, DOMString playlistName);
Since: 5.5
Parameters:
- serverName: Name of server which triggered the event.
- playlistName: Name of playlist for which the event was triggered.
2.50. MediaControllerGetItemsSuccessCallback
[Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerGetItemsSuccessCallback { void onsuccess(MediaControllerPlaylistItem[] items); };
Since: 5.5
Methods
-
onsuccess
-
Success callback for getItems function.
void onsuccess(MediaControllerPlaylistItem[] items);
Since: 5.5
Parameters:
- items: Collection of MediaControllerPlaylistItem objects.
2.51. MediaControllerAbilityChangeCallback
[Callback, NoInterfaceObject] interface MediaControllerAbilityChangeCallback { void onplaybackabilitychanged(MediaControllerServerInfo server, MediaControllerPlaybackAbilitiesInfo abilities); void ondisplaymodeabilitychanged(MediaControllerServerInfo server, MediaControllerDisplayModeAbilitiesInfo abilities); void ondisplayrotationabilitychanged(MediaControllerServerInfo server, MediaControllerDisplayRotationAbilitiesInfo abilities); void onsimpleabilitychanged(MediaControllerServerInfo server, MediaControllerSimpleAbility type, MediaControllerAbilitySupport support); };
Since: 5.5
Methods
-
onplaybackabilitychanged
-
Event triggered when server's playback ability is updated.
void onplaybackabilitychanged(MediaControllerServerInfo server, MediaControllerPlaybackAbilitiesInfo abilities);
Since: 5.5
Parameters:
- server: Server which triggered the event.
- abilities: Object with current state of playback abilities on the media controller server.
-
ondisplaymodeabilitychanged
-
Event triggered when server's display mode ability is updated.
void ondisplaymodeabilitychanged(MediaControllerServerInfo server, MediaControllerDisplayModeAbilitiesInfo abilities);
Since: 5.5
Parameters:
- server: Server which triggered the event.
- abilities: Object with current state of display mode abilities on the media controller server.
-
ondisplayrotationabilitychanged
-
Event triggered when server's display rotation is updated.
void ondisplayrotationabilitychanged(MediaControllerServerInfo server, MediaControllerDisplayRotationAbilitiesInfo abilities);
Since: 5.5
Parameters:
- server: Server which triggered the event.
- abilities: Object with current state of display mode abilities on the media controller server.
-
onsimpleabilitychanged
-
Event triggered when server's simple ability is updated.
void onsimpleabilitychanged(MediaControllerServerInfo server, MediaControllerSimpleAbility type, MediaControllerAbilitySupport support);
Since: 5.5
Parameters:
- server: Server which triggered the event.
- type: Type of simple ability.
- support: Ability value which was set on the media controller server.
3. Full WebIDL
module MediaController { enum MediaControllerServerState { "ACTIVE", "INACTIVE" }; enum MediaControllerSearchCategory { "NO_CATEGORY", "TITLE", "ARTIST", "ALBUM", "GENRE", "TPO" }; enum MediaControllerPlaybackState { "PLAY", "PAUSE", "STOP", "NEXT", "PREV", "FORWARD", "REWIND" }; enum MediaControllerPlaybackAction { "PLAY", "PAUSE", "STOP", "NEXT", "PREV", "FORWARD", "REWIND", "TOGGLE_PLAY_PAUSE" }; enum MediaControllerRepeatState { "REPEAT_OFF", "REPEAT_ONE", "REPEAT_ALL" }; enum MediaControllerContentType { "IMAGE", "MUSIC", "VIDEO", "OTHER", "UNDECIDED" }; enum MediaControllerContentAgeRating { "ALL", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19" }; enum MediaControllerAbilitySupport { "YES", "NO", "UNDECIDED" }; enum MediaControllerSimpleAbility { "PLAYBACK_POSITION", "SHUFFLE", "REPEAT", "PLAYLIST", "CLIENT_CUSTOM", "SEARCH", "SUBTITLES", "MODE_360" }; enum MediaControllerDisplayModeType { "LETTER_BOX", "ORIGIN_SIZE", "FULL_SCREEN", "CROPPED_FULL" }; enum MediaControllerDisplayRotationType { "ROTATION_NONE", "ROTATION_90", "ROTATION_180", "ROTATION_270" }; dictionary MediaControllerMetadataInit { DOMString title; DOMString artist; DOMString album; DOMString author; DOMString genre; DOMString duration; DOMString date; DOMString copyright; DOMString description; DOMString trackNum; DOMString picture; long seasonNumber; DOMString seasonTitle; long episodeNumber; DOMString episodeTitle; long resolutionWidth; long resolutionHeight; }; 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 MediaControllerServerPlaybackInfo playback; readonly attribute MediaControllerPlaylists playlists; attribute DOMString? iconURI raises(WebAPIException); readonly attribute MediaControllerAbilities abilities; readonly attribute MediaControllerSubtitles subtitles; readonly attribute MediaControllerMode360 mode360; readonly attribute MediaControllerDisplayMode displayMode; readonly attribute MediaControllerDisplayRotation displayRotation; MediaControllerClientInfo[] getAllClientsInfo() raises(WebAPIException); void setSearchRequestListener(MediaControllerSearchRequestCallback listener) raises(WebAPIException); void unsetSearchRequestListener() 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); long addAbilityChangeListener(MediaControllerAbilityChangeCallback listener) raises(WebAPIException); void removeAbilityChangeListener(long watchId) raises(WebAPIException); void findSubscribedServers(MediaControllerServerInfoArraySuccessCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void setCustomEventListener(MediaControllerReceiveCommandCallback listener) raises(WebAPIException); void unsetCustomEventListener() raises(WebAPIException); }; [NoInterfaceObject] interface MediaControllerServerInfo { readonly attribute ApplicationId name; readonly attribute MediaControllerServerState state; readonly attribute MediaControllerServerInfoPlaybackInfo playback raises(WebAPIException); readonly attribute MediaControllerPlaylistsInfo playlists; readonly attribute DOMString? iconURI raises(WebAPIException); readonly attribute MediaControllerAbilitiesInfo abilities; readonly attribute MediaControllerSubtitlesInfo subtitles; readonly attribute MediaControllerMode360Info mode360; readonly attribute MediaControllerDisplayModeInfo displayMode; readonly attribute MediaControllerDisplayRotationInfo displayRotation; void sendSearchRequest(SearchFilter[] request, MediaControllerSearchRequestReplyCallback replyCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void sendCommand(DOMString command, Bundle? data, MediaControllerSendCommandSuccessCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); long addServerStatusChangeListener(MediaControllerServerStatusChangeCallback listener) raises(WebAPIException); void removeServerStatusChangeListener(long watchId) raises(WebAPIException); }; [NoInterfaceObject] interface MediaControllerServerPlaybackInfo { attribute MediaControllerPlaybackState state raises(WebAPIException); attribute unsigned long long position raises(WebAPIException); attribute MediaControllerContentAgeRating ageRating raises(WebAPIException); attribute MediaControllerContentType contentType raises(WebAPIException); attribute boolean shuffleMode raises(WebAPIException); attribute MediaControllerRepeatState repeatState raises(WebAPIException); readonly attribute MediaControllerMetadata metadata; readonly attribute DOMString? index; readonly attribute DOMString? playlistName; void updatePlaybackItem(DOMString playlistName, DOMString index) raises(WebAPIException); long addChangeRequestListener(MediaControllerChangeRequestPlaybackInfoCallback listener) raises(WebAPIException); void removeChangeRequestListener(long watchId) raises(WebAPIException); }; [NoInterfaceObject] interface MediaControllerServerInfoPlaybackInfo { readonly attribute MediaControllerPlaybackState state; readonly attribute unsigned long long position; readonly attribute MediaControllerContentAgeRating ageRating; readonly attribute MediaControllerContentType contentType; readonly attribute boolean shuffleMode; readonly attribute MediaControllerRepeatState repeatState; readonly attribute MediaControllerMetadata metadata; readonly attribute DOMString? index; readonly attribute DOMString? playlistName; void sendPlaybackAction(MediaControllerPlaybackAction action, optional MediaControllerSendCommandSuccessCallback? replyCallback) raises(WebAPIException); void sendPlaybackPosition(unsigned long long position, optional MediaControllerSendCommandSuccessCallback? replyCallback) raises(WebAPIException); void sendShuffleMode(boolean mode, optional MediaControllerSendCommandSuccessCallback? replyCallback) raises(WebAPIException); void sendRepeatState(MediaControllerRepeatState state, optional MediaControllerSendCommandSuccessCallback? replyCallback) raises(WebAPIException); long addPlaybackInfoChangeListener(MediaControllerPlaybackInfoChangeCallback listener) raises(WebAPIException); void removePlaybackInfoChangeListener(long watchId) raises(WebAPIException); }; [NoInterfaceObject] interface MediaControllerPlaylists { MediaControllerPlaylist createPlaylist(DOMString name) raises(WebAPIException); void savePlaylist(MediaControllerPlaylist playlist, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void deletePlaylist(DOMString playlistName, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void getAllPlaylists(MediaControllerGetAllPlaylistsSuccessCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); MediaControllerPlaylist getPlaylist(DOMString playlistName) raises(WebAPIException); }; [NoInterfaceObject] interface MediaControllerPlaylistsInfo { void getAllPlaylists(MediaControllerGetAllPlaylistsSuccessCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); void sendPlaybackItem(DOMString playlistName, DOMString index, MediaControllerPlaybackAction action, unsigned long long position, optional MediaControllerSendCommandSuccessCallback? replyCallback) raises(WebAPIException); long addPlaylistUpdatedListener(MediaControllerPlaylistUpdatedCallback listener) raises(WebAPIException); void removePlaylistUpdatedListener(long listenerId) raises(WebAPIException); MediaControllerPlaylist getPlaylist(DOMString playlistName) raises(WebAPIException); }; [NoInterfaceObject] interface MediaControllerAbilities { readonly attribute MediaControllerPlaybackAbilities playback; readonly attribute MediaControllerDisplayModeAbilities displayMode; readonly attribute MediaControllerDisplayRotationAbilities displayRotation; attribute MediaControllerAbilitySupport playbackPosition raises(WebAPIException); attribute MediaControllerAbilitySupport shuffle raises(WebAPIException); attribute MediaControllerAbilitySupport repeat raises(WebAPIException); attribute MediaControllerAbilitySupport playlist raises(WebAPIException); attribute MediaControllerAbilitySupport clientCustom raises(WebAPIException); attribute MediaControllerAbilitySupport search raises(WebAPIException); attribute MediaControllerAbilitySupport subtitles raises(WebAPIException); attribute MediaControllerAbilitySupport mode360 raises(WebAPIException); }; [NoInterfaceObject] interface MediaControllerPlaybackAbilities { attribute MediaControllerAbilitySupport play raises(WebAPIException); attribute MediaControllerAbilitySupport pause raises(WebAPIException); attribute MediaControllerAbilitySupport stop raises(WebAPIException); attribute MediaControllerAbilitySupport next raises(WebAPIException); attribute MediaControllerAbilitySupport prev raises(WebAPIException); attribute MediaControllerAbilitySupport forward raises(WebAPIException); attribute MediaControllerAbilitySupport rewind raises(WebAPIException); attribute MediaControllerAbilitySupport togglePlayPause raises(WebAPIException); void saveAbilities() raises(WebAPIException); }; [NoInterfaceObject] interface MediaControllerDisplayModeAbilities { attribute MediaControllerAbilitySupport letterBox raises(WebAPIException); attribute MediaControllerAbilitySupport originSize raises(WebAPIException); attribute MediaControllerAbilitySupport fullScreen raises(WebAPIException); attribute MediaControllerAbilitySupport croppedFull raises(WebAPIException); }; [NoInterfaceObject] interface MediaControllerDisplayRotationAbilities { attribute MediaControllerAbilitySupport rotationNone raises(WebAPIException); attribute MediaControllerAbilitySupport rotation90 raises(WebAPIException); attribute MediaControllerAbilitySupport rotation180 raises(WebAPIException); attribute MediaControllerAbilitySupport rotation270 raises(WebAPIException); }; [NoInterfaceObject] interface MediaControllerAbilitiesInfo { readonly attribute MediaControllerPlaybackAbilitiesInfo playback; readonly attribute MediaControllerDisplayModeAbilitiesInfo displayMode; readonly attribute MediaControllerDisplayRotationAbilitiesInfo displayRotation; readonly attribute MediaControllerAbilitySupport playbackPosition raises(WebAPIException); readonly attribute MediaControllerAbilitySupport shuffle raises(WebAPIException); readonly attribute MediaControllerAbilitySupport repeat raises(WebAPIException); readonly attribute MediaControllerAbilitySupport playlist raises(WebAPIException); readonly attribute MediaControllerAbilitySupport clientCustom raises(WebAPIException); readonly attribute MediaControllerAbilitySupport search raises(WebAPIException); readonly attribute MediaControllerAbilitySupport subtitles raises(WebAPIException); readonly attribute MediaControllerAbilitySupport mode360 raises(WebAPIException); void subscribe() raises(WebAPIException); void unsubscribe() raises(WebAPIException); }; [NoInterfaceObject] interface MediaControllerPlaybackAbilitiesInfo { readonly attribute MediaControllerAbilitySupport play raises(WebAPIException); readonly attribute MediaControllerAbilitySupport pause raises(WebAPIException); readonly attribute MediaControllerAbilitySupport stop raises(WebAPIException); readonly attribute MediaControllerAbilitySupport next raises(WebAPIException); readonly attribute MediaControllerAbilitySupport prev raises(WebAPIException); readonly attribute MediaControllerAbilitySupport forward raises(WebAPIException); readonly attribute MediaControllerAbilitySupport rewind raises(WebAPIException); readonly attribute MediaControllerAbilitySupport togglePlayPause raises(WebAPIException); }; [NoInterfaceObject] interface MediaControllerDisplayModeAbilitiesInfo { readonly attribute MediaControllerAbilitySupport letterBox raises(WebAPIException); readonly attribute MediaControllerAbilitySupport originSize raises(WebAPIException); readonly attribute MediaControllerAbilitySupport fullScreen raises(WebAPIException); readonly attribute MediaControllerAbilitySupport croppedFull raises(WebAPIException); }; [NoInterfaceObject] interface MediaControllerDisplayRotationAbilitiesInfo { readonly attribute MediaControllerAbilitySupport rotationNone raises(WebAPIException); readonly attribute MediaControllerAbilitySupport rotation90 raises(WebAPIException); readonly attribute MediaControllerAbilitySupport rotation180 raises(WebAPIException); readonly attribute MediaControllerAbilitySupport rotation270 raises(WebAPIException); }; [NoInterfaceObject] interface MediaControllerSubtitles { attribute boolean enabled raises(WebAPIException); long addChangeRequestListener(MediaControllerEnabledChangeRequestCallback listener) raises(WebAPIException); void removeChangeRequestListener(long watchId) raises(WebAPIException); }; [NoInterfaceObject] interface MediaControllerSubtitlesInfo { readonly attribute boolean enabled raises(WebAPIException); void sendRequest(boolean enabled, MediaControllerSendCommandSuccessCallback replyCallback) raises(WebAPIException); long addModeChangeListener(MediaControllerEnabledChangeCallback listener) raises(WebAPIException); void removeModeChangeListener(long watchId) raises(WebAPIException); }; [NoInterfaceObject] interface MediaControllerMode360 { attribute boolean enabled raises(WebAPIException); long addChangeRequestListener(MediaControllerEnabledChangeRequestCallback listener) raises(WebAPIException); void removeChangeRequestListener(long watchId) raises(WebAPIException); }; [NoInterfaceObject] interface MediaControllerMode360Info { readonly attribute boolean enabled raises(WebAPIException); void sendRequest(boolean enabled, MediaControllerSendCommandSuccessCallback replyCallback) raises(WebAPIException); long addModeChangeListener(MediaControllerEnabledChangeCallback listener) raises(WebAPIException); void removeModeChangeListener(long watchId) raises(WebAPIException); }; [NoInterfaceObject] interface MediaControllerDisplayMode { attribute MediaControllerDisplayModeType type raises(WebAPIException); long addChangeRequestListener(MediaControllerDisplayModeChangeRequestCallback listener) raises(WebAPIException); void removeChangeRequestListener(long watchId) raises(WebAPIException); }; [NoInterfaceObject] interface MediaControllerDisplayModeInfo { readonly attribute MediaControllerDisplayModeType type raises(WebAPIException); void sendRequest(MediaControllerDisplayModeType type, MediaControllerSendCommandSuccessCallback replyCallback) raises(WebAPIException); long addModeChangeListener(MediaControllerDisplayModeChangeCallback listener) raises(WebAPIException); void removeModeChangeListener(long watchId) raises(WebAPIException); }; [NoInterfaceObject] interface MediaControllerDisplayRotation { attribute MediaControllerDisplayRotationType displayRotation raises(WebAPIException); long addChangeRequestListener(MediaControllerDisplayRotationChangeRequestCallback listener) raises(WebAPIException); void removeChangeRequestListener(long watchId) raises(WebAPIException); }; [NoInterfaceObject] interface MediaControllerClientInfo { readonly attribute ApplicationId name; void sendEvent(DOMString eventName, Bundle? data, MediaControllerSendCommandSuccessCallback successCallback) raises(WebAPIException); }; [NoInterfaceObject] interface MediaControllerDisplayRotationInfo { readonly attribute MediaControllerDisplayRotationType displayRotation raises(WebAPIException); void sendRequest(MediaControllerDisplayRotationType displayRotation, MediaControllerSendCommandSuccessCallback replyCallback) raises(WebAPIException); long addDisplayRotationChangeListener(MediaControllerDisplayRotationChangeCallback listener) raises(WebAPIException); void removeDisplayRotationChangeListener(long watchId) raises(WebAPIException); }; [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; attribute long seasonNumber; attribute DOMString? seasonTitle; attribute long episodeNumber; attribute DOMString? episodeTitle; attribute long resolutionWidth; attribute long resolutionHeight; void save() raises(WebAPIException); }; [NoInterfaceObject] interface MediaControllerPlaylistItem { readonly attribute DOMString index; readonly attribute MediaControllerMetadata metadata; }; [NoInterfaceObject] interface MediaControllerPlaylist { readonly attribute DOMString name; void addItem(DOMString index, MediaControllerMetadataInit metadata) raises(WebAPIException); void getItems(MediaControllerGetItemsSuccessCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); }; [Constructor(MediaControllerContentType contentType, optional MediaControllerSearchCategory category = "NO_CATEGORY", optional DOMString? keyword = null, optional Bundle? extraData = null)] interface SearchFilter { attribute MediaControllerContentType contentType raises(WebAPIException); attribute MediaControllerSearchCategory category raises(WebAPIException); attribute DOMString? keyword raises(WebAPIException); attribute Bundle? extraData; }; [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerServerInfoArraySuccessCallback { void onsuccess(MediaControllerServerInfo[] servers); }; [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerSendCommandSuccessCallback { void onsuccess(object? data, optional long code); }; [Constructor(Bundle? data, optional long code = 0)] interface RequestReply { attribute Bundle? data; attribute long code; }; [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerSearchRequestReplyCallback { void onreply(RequestReply? reply); }; [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerSearchRequestCallback { RequestReply? onrequest(ApplicationId clientName, SearchFilter[] request); }; [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerReceiveCommandCallback { RequestReply? onsuccess(ApplicationId senderAppName, DOMString command, object data); }; [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerEnabledChangeRequestCallback { RequestReply? onreply(ApplicationId clientName, boolean enabled); }; [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerEnabledChangeCallback { void onchange(boolean enabled); }; [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerDisplayModeChangeRequestCallback { RequestReply? onreply(ApplicationId clientName, MediaControllerDisplayModeType mode); }; [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerDisplayModeChangeCallback { void onchange(MediaControllerDisplayModeType mode); }; [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerDisplayRotationChangeRequestCallback { RequestReply? onreply(ApplicationId clientName, MediaControllerDisplayRotationType displayRotation); }; [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerDisplayRotationChangeCallback { void onchange(MediaControllerDisplayRotationType displayRotation); }; [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 onrepeatstatechanged(MediaControllerRepeatState state); void onmetadatachanged(MediaControllerMetadata metadata); }; [Callback, NoInterfaceObject] interface MediaControllerChangeRequestPlaybackInfoCallback { RequestReply? onplaybackactionrequest(MediaControllerPlaybackAction action, ApplicationId clientName); RequestReply? onplaybackpositionrequest(unsigned long long position, ApplicationId clientName); RequestReply? onshufflemoderequest(boolean mode, ApplicationId clientName); RequestReply? onrepeatstaterequest(MediaControllerRepeatState state, ApplicationId clientName); RequestReply? onplaybackitemrequest(DOMString playlistName, DOMString index, MediaControllerPlaybackAction action, unsigned long long position, ApplicationId clientName); }; [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerGetAllPlaylistsSuccessCallback { void onsuccess(MediaControllerPlaylist[] playlists); }; [Callback, NoInterfaceObject] interface MediaControllerPlaylistUpdatedCallback { void onplaylistupdated(DOMString serverName, MediaControllerPlaylist playlist); void onplaylistdeleted(DOMString serverName, DOMString playlistName); }; [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerGetItemsSuccessCallback { void onsuccess(MediaControllerPlaylistItem[] items); }; [Callback, NoInterfaceObject] interface MediaControllerAbilityChangeCallback { void onplaybackabilitychanged(MediaControllerServerInfo server, MediaControllerPlaybackAbilitiesInfo abilities); void ondisplaymodeabilitychanged(MediaControllerServerInfo server, MediaControllerDisplayModeAbilitiesInfo abilities); void ondisplayrotationabilitychanged(MediaControllerServerInfo server, MediaControllerDisplayRotationAbilitiesInfo abilities); void onsimpleabilitychanged(MediaControllerServerInfo server, MediaControllerSimpleAbility type, MediaControllerAbilitySupport support); }; };