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: 5.0
enum MediaControllerServerState { "ACTIVE", "INACTIVE" };
enum MediaControllerSearchCategory { "NO_CATEGORY", "TITLE", "ARTIST", "ALBUM", "GENRE", "TPO" };
Since: 5.5
enum MediaControllerPlaybackState { "PLAY", "PAUSE", "STOP", "NEXT", "PREV", "FORWARD", "REWIND" };
enum MediaControllerRepeatState { "REPEAT_OFF", "REPEAT_ONE", "REPEAT_ALL" };
The possible states are:
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" };
Each value represents the minimum age restriction for the media.
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" };
[NoInterfaceObject] interface MediaControllerObject { readonly attribute MediaControllerManager mediacontroller; };
Tizen implements MediaControllerObject;
There is a tizen.mediacontroller object that allows access to the Media Controller API.
[NoInterfaceObject] interface MediaControllerManager { MediaControllerClient getClient() raises(WebAPIException); MediaControllerServer createServer() raises(WebAPIException); };
getClient
MediaControllerClient getClient();
Privilege level: public
Privilege: http://tizen.org/privilege/mediacontroller.client
Return value:
Exceptions:
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); }
createServer
MediaControllerServer createServer();
Privilege: http://tizen.org/privilege/mediacontroller.server
try { var mcServer = tizen.mediacontroller.createServer(); } catch (err) { console.log(err.name + ": " + err.message); }
[NoInterfaceObject] interface MediaControllerServer { readonly attribute MediaControllerPlaybackInfo playbackInfo; readonly attribute DOMString? iconURI; 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); };
Allows the application to send the playback state and metadata to other application and be controlled by other application(client) remotely.
Remark: Object holds state which is automatically updated by update methods.
getAllClientsInfo
MediaControllerClientInfo[] getAllClientsInfo();
Remark: Code example available at sendEvent() method documentation.
with error type UnknownError, if any platform error occurs.
updatePlaybackState
void updatePlaybackState(MediaControllerPlaybackState state);
Parameters:
with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.
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
void updateIconURI(DOMString? iconURI);
with error type UnknownError, if any error occurs.
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);
http://example.com/res/icon2.ico
updatePlaybackPosition
void updatePlaybackPosition(unsigned long long position);
with error type InvalidValuesError, if any of the input parameters contain an invalid value.
var mcServer = tizen.mediacontroller.createServer(); mcServer.updatePlaybackPosition(164); console.log("Current playback position is: " + mcServer.playbackInfo.position);
Current playback position is: 164
updatePlaybackAgeRating
void updatePlaybackAgeRating(MediaControllerContentAgeRating rating);
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.");
Only viewers older than 10 are allowed to access this content.
updatePlaybackContentType
void updatePlaybackContentType(MediaControllerContentType type);
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);
Content type of current item is MUSIC
updateShuffleMode
void updateShuffleMode(boolean mode);
var mcServer = tizen.mediacontroller.createServer(); mcServer.updateShuffleMode(true); console.log("Current shuffle mode is: " + mcServer.playbackInfo.shuffleMode);
Current shuffle mode is: true
updateRepeatMode
Deprecated. Deprecated since 5.5. Instead, use updateRepeatState.
void updateRepeatMode(boolean mode);
var mcServer = tizen.mediacontroller.createServer(); mcServer.updateRepeatMode(true); console.log("Current repeat mode is: " + mcServer.playbackInfo.repeatMode);
updateRepeatState
void updateRepeatState(MediaControllerRepeatState state);
var mcServer = tizen.mediacontroller.createServer(); mcServer.updateRepeatState("REPEAT_ONE"); console.log("Current repeat state is: " + mcServer.playbackInfo.repeatState);
Current repeat state is: REPEAT_ONE
updateMetadata
void updateMetadata(MediaControllerMetadata metadata);
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));
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
long addChangeRequestPlaybackInfoListener(MediaControllerChangeRequestPlaybackInfoCallback listener);
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
void removeChangeRequestPlaybackInfoListener(long watchId);
Calling this function has no effect if there is no listener with given id.
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
void setSearchRequestListener(MediaControllerSearchRequestCallback listener);
with error type TypeMismatchError, if any of the arguments has invalid type.
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
void unsetSearchRequestListener();
Calling this function has no effect if the listener was not set.
with error type UnknownError, if unknown error occurs.
var mcServer = tizen.mediacontroller.createServer(); function searchRequestListener(clientName, request) { console.log("search command received."); } mcServer.setSearchRequestListener(searchRequestListener); mcServer.unsetSearchRequestListener();
addCommandListener
long addCommandListener(MediaControllerReceiveCommandCallback listener);
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
void removeCommandListener(long watchId);
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
MediaControllerPlaylist createPlaylist(DOMString name);
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.
with error type InvalidValuesError, if playlist with given name already exists.
var mcServer = tizen.mediacontroller.createServer(); var playlist = mcServer.createPlaylist("testPlaylistName");
savePlaylist
void savePlaylist(MediaControllerPlaylist playlist, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
The errorCallback may be triggered for one of the following errors:
Remark: All playlists will be deleted after the application is closed.
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);
savePlaylist successful.
deletePlaylist
void deletePlaylist(DOMString playlistName, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
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);
deletePlaylist successful.
updatePlaybackItem
void updatePlaybackItem(DOMString playlistName, DOMString index);
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); });
Current playlist: testPlaylistName Current index: index1
getAllPlaylists
void getAllPlaylists(MediaControllerGetAllPlaylistsSuccessCallback successCallback, optional ErrorCallback? errorCallback);
with error type TypeMismatchError, if any parameter has invalid type.
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);
savePlaylist successful Playlist name: testPlaylistName
[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); };
findServers
void findServers(MediaControllerServerInfoArraySuccessCallback successCallback, optional ErrorCallback? errorCallback);
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);
Found server: og8WN4XlLg.BasicUIStudio, state: ACTIVE
getLatestServerInfo
MediaControllerServerInfo? getLatestServerInfo();
Remark: If there is no activated media controller server, null value is returned.
/* 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);
Latest server name is: 2cpQcelP8a.HelloTizen, server state: INACTIVE
addAbilityChangeListener
long addAbilityChangeListener(MediaControllerAbilityChangeCallback listener);
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.
/* 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";
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
void removeAbilityChangeListener(long watchId);
Remark: All subscriptions added by function subscribe() will be lost after removing last MediaControllerAbilityChangeListener.
/* 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();
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
void findSubscribedServers(MediaControllerServerInfoArraySuccessCallback successCallback, optional ErrorCallback? errorCallback);
The ErrorCallback may be triggered for one of the following errors:
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);
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
void setCustomEventListener(MediaControllerReceiveCommandCallback listener);
If the listener has already been set, calling this method will override it.
with error type TypeMismatchError, if any of the arguments has invalid types.
/* 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
void unsetCustomEventListener();
Calling this function has no effect, if the listener is not set.
/* 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();
[NoInterfaceObject] interface MediaControllerServerInfo { readonly attribute ApplicationId name; readonly attribute MediaControllerServerState state; readonly attribute MediaControllerPlaybackInfo playbackInfo raises(WebAPIException); 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); };
sendPlaybackState
void sendPlaybackState(MediaControllerPlaybackState state, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
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); });
Playback has stopped
sendPlaybackPosition
void sendPlaybackPosition(unsigned long long position, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
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); });
Playback position changed
sendShuffleMode
void sendShuffleMode(boolean mode, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
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); });
Shuffle mode changed
sendRepeatMode
Deprecated. Deprecated since 5.5. Instead, use sendRepeatState.
void sendRepeatMode(boolean mode, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
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
void sendRepeatState(MediaControllerRepeatState state, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
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); });
Repeat state changed
sendSearchRequest
void sendSearchRequest(SearchFilter[] request, MediaControllerSearchRequestReplyCallback replyCallback, optional ErrorCallback? errorCallback);
Remark: Search request handler should be specified on the server using setSearchRequestListener() method.
with error type InvalidValuesError, if request has invalid number of filters.
/* 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); });
search command received reply status: 5 reply data: {"key": "value"}
sendCommand
void sendCommand(DOMString command, Bundle? data, MediaControllerSendCommandSuccessCallback successCallback, optional ErrorCallback? errorCallback);
Remark: See addCommandListener() method to check how to receive and respond to custom commands.
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
long addServerStatusChangeListener(MediaControllerServerStatusChangeCallback listener);
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
void removeServerStatusChangeListener(long watchId);
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
long addPlaybackInfoChangeListener(MediaControllerPlaybackInfoChangeCallback listener);
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
void removePlaybackInfoChangeListener(long watchId);
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);
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);
savePlaylist successful Playlist name: testPlaylist
sendPlaybackItem
void sendPlaybackItem(DOMString playlistName, DOMString index, MediaControllerPlaybackState state, unsigned long long position);
Remark: PlaybackInfoChangeListener should be invoked, if registered.
var mcClient = tizen.mediacontroller.getClient(); var mcServerInfo = mcClient.getLatestServerInfo(); mcServerInfo.sendPlaybackItem("testPlaylist", "1", "PLAY", 0);
addPlaylistUpdatedListener
long addPlaylistUpdatedListener(MediaControllerPlaylistUpdatedCallback listener);
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
void removePlaylistUpdatedListener(long listenerId);
Remark: This function has no effect, if there is no listener for given id.
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);
[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; };
Default value is UNDECIDED.
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.
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.
Remark: Null if no item currently in playback.
[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); };
with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.
with error type InvalidValuesError, if set value will be "UNDECIDED".
Default value is NO.
[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); };
Remark: Calling saveAbilities() is required to update playback abilities on the media controller server.
saveAbilities
void saveAbilities();
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.
/* 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);
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
[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); };
subscribe
void subscribe();
Remark: Function addAbilityChangeListener() must be called before current method. For code example see unsubscribe().
with error type InvalidStateError, if addAbilityChangeListener() is not set.
unsubscribe
void unsubscribe();
/* 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 */
#### 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"
[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); };
addChangeRequestListener
long addChangeRequestListener(MediaControllerEnabledChangeRequestCallback listener);
Remark: Remember to set corresponding server's MediaControllerAbilities.subtitles ability to "YES" to let clients send change requests to the server.
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
void removeChangeRequestListener(long watchId);
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);
[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); };
sendRequest
void sendRequest(boolean enabled, MediaControllerSendCommandSuccessCallback replyCallback);
Remark: See addChangeRequestListener() method to check how to receive and respond to commands.
with error type NotSupportedError, if related ability is not supported by the media controller server.
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
long addModeChangeListener(MediaControllerEnabledChangeCallback listener);
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
void removeModeChangeListener(long watchId);
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);
[NoInterfaceObject] interface MediaControllerMode360 { attribute boolean enabled raises(WebAPIException); long addChangeRequestListener(MediaControllerEnabledChangeRequestCallback listener) raises(WebAPIException); void removeChangeRequestListener(long watchId) raises(WebAPIException); };
Remark: Remember to set corresponding server's MediaControllerAbilities.mode360 ability to "YES" to let clients send change requests to the server.
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);
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);
[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); };
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); });
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); });
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);
[NoInterfaceObject] interface MediaControllerDisplayMode { attribute MediaControllerDisplayModeType type raises(WebAPIException); long addChangeRequestListener(MediaControllerDisplayModeChangeRequestCallback listener) raises(WebAPIException); void removeChangeRequestListener(long watchId) raises(WebAPIException); };
with error type TypeMismatchError, if an input parameter is not compatible with the expected type for that parameter.
long addChangeRequestListener(MediaControllerDisplayModeChangeRequestCallback listener);
Remark: Remember to set corresponding server's display mode ability to "YES" to let clients send change requests to the server.
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);
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);
[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); };
void sendRequest(MediaControllerDisplayModeType type, MediaControllerSendCommandSuccessCallback replyCallback);
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); });
long addModeChangeListener(MediaControllerDisplayModeChangeCallback listener);
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); });
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);
[NoInterfaceObject] interface MediaControllerDisplayRotation { attribute MediaControllerDisplayRotationType displayRotation raises(WebAPIException); long addChangeRequestListener(MediaControllerDisplayRotationChangeRequestCallback listener) raises(WebAPIException); void removeChangeRequestListener(long watchId) raises(WebAPIException); };
long addChangeRequestListener(MediaControllerDisplayRotationChangeRequestCallback listener);
Remark: Remember to set corresponding server's display rotation ability to "YES" to let clients send change requests to the server.
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);
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);
[NoInterfaceObject] interface MediaControllerClientInfo { readonly attribute ApplicationId name; void sendEvent(DOMString eventName, Bundle? data, MediaControllerSendCommandSuccessCallback successCallback) raises(WebAPIException); };
sendEvent
void sendEvent(DOMString eventName, Bundle? data, MediaControllerSendCommandSuccessCallback successCallback);
with error type TypeMismatchError, if any argument has invalid type.
/* 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)); }); }
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}'
[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); };
void sendRequest(MediaControllerDisplayRotationType displayRotation, MediaControllerSendCommandSuccessCallback replyCallback);
with error type NotSupportedError, if related ability is not supported by server.
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
long addDisplayRotationChangeListener(MediaControllerDisplayRotationChangeCallback listener);
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
void removeDisplayRotationChangeListener(long watchId);
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);
[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; };
[NoInterfaceObject] interface MediaControllerPlaylistItem { readonly attribute DOMString index; readonly attribute MediaControllerMetadata metadata; };
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; };
See MediaControllerMetadata interface for more information about the members.
[NoInterfaceObject] interface MediaControllerPlaylist { readonly attribute DOMString name; void addItem(DOMString index, MediaControllerMetadataInit metadata) raises(WebAPIException); void getItems(MediaControllerGetItemsSuccessCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); };
addItem
void addItem(DOMString index, MediaControllerMetadataInit metadata);
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);
Item added. savePlaylist successful.
getItems
void getItems(MediaControllerGetItemsSuccessCallback successCallback, optional ErrorCallback? errorCallback);
Remark: Note that getItems() method return only those items from playlist which been saved by savePlaylist() method.
/* 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);
Index: index1 Title: testTitle
[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; };
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.
Constructor (MediaControllerContentType, MediaControllerSearchCategory, DOMString?, Bundle?)
SearchFilter(MediaControllerContentType contentType, optional MediaControllerSearchCategory category = "NO_CATEGORY", optional DOMString? keyword = null, optional Bundle? extraData = null);
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.
Remark: Keyword can only be null or empty if the category is set to NO_CATEGORY.
with error type InvalidValuesError, if the category is not NO_CATEGORY and the keyword is null.
[Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerServerInfoArraySuccessCallback { void onsuccess(MediaControllerServerInfo[] servers); };
onsuccess
void onsuccess(MediaControllerServerInfo[] servers);
[Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerSendCommandSuccessCallback { void onsuccess(object? data, optional long code); };
Interface is used as a success method for:
void onsuccess(object? data, optional long code);
[Constructor(Bundle? data, optional long code = 0)] interface RequestReply { attribute Bundle? data; attribute long code; };
Constructor (Bundle?, long)
RequestReply(Bundle? data, optional long code = 0);
[Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerSearchRequestReplyCallback { void onreply(RequestReply? reply); };
onreply
void onreply(RequestReply? reply);
Interpretation of status and data parameters depends on the server implementation.
[Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerSearchRequestCallback { RequestReply? onrequest(ApplicationId clientName, SearchFilter[] request); };
onrequest
RequestReply? onrequest(ApplicationId clientName, SearchFilter[] request);
[Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerReceiveCommandCallback { RequestReply? onsuccess(ApplicationId senderAppName, DOMString command, object data); };
Related functions:
RequestReply? onsuccess(ApplicationId senderAppName, DOMString command, object data);
[Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerEnabledChangeRequestCallback { RequestReply? onreply(ApplicationId clientName, boolean enabled); };
RequestReply? onreply(ApplicationId clientName, boolean enabled);
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.
[Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerEnabledChangeCallback { void onchange(boolean enabled); };
onchange
void onchange(boolean enabled);
[Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerDisplayModeChangeRequestCallback { RequestReply? onreply(ApplicationId clientName, MediaControllerDisplayModeType mode); };
RequestReply? onreply(ApplicationId clientName, MediaControllerDisplayModeType mode);
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.
[Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerDisplayModeChangeCallback { void onchange(MediaControllerDisplayModeType mode); };
void onchange(MediaControllerDisplayModeType mode);
[Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerDisplayRotationChangeRequestCallback { RequestReply? onreply(ApplicationId clientName, MediaControllerDisplayRotationType displayRotation); };
RequestReply? onreply(ApplicationId clientName, MediaControllerDisplayRotationType displayRotation);
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.
[Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerDisplayRotationChangeCallback { void onchange(MediaControllerDisplayRotationType displayRotation); };
void onchange(MediaControllerDisplayRotationType displayRotation);
[Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerServerStatusChangeCallback { void onsuccess(MediaControllerServerState status); };
void onsuccess(MediaControllerServerState status);
[Callback, NoInterfaceObject] interface MediaControllerPlaybackInfoChangeCallback { void onplaybackchanged(MediaControllerPlaybackState state, unsigned long long position); void onshufflemodechanged(boolean mode); void onrepeatmodechanged(boolean mode); void onrepeatstatechanged(MediaControllerRepeatState state); void onmetadatachanged(MediaControllerMetadata metadata); };
onplaybackchanged
void onplaybackchanged(MediaControllerPlaybackState state, unsigned long long position);
onshufflemodechanged
void onshufflemodechanged(boolean mode);
onrepeatmodechanged
Deprecated. Deprecated since 5.5. Instead, use onrepeatstatechanged.
void onrepeatmodechanged(boolean mode);
Remark: The onrepeatmodechanged callback will not be invoked, if the repeatState is changed to REPEAT_ONE.
onrepeatstatechanged
void onrepeatstatechanged(MediaControllerRepeatState state);
It is guaranteed that the onrepeatstatechanged callback will be invoked after the onrepeatmodechanged.
onmetadatachanged
void onmetadatachanged(MediaControllerMetadata metadata);
[Callback, NoInterfaceObject] interface MediaControllerChangeRequestPlaybackInfoCallback { void onplaybackstaterequest(MediaControllerPlaybackState state, ApplicationId clientName); void onplaybackpositionrequest(unsigned long long position, ApplicationId clientName); void onshufflemoderequest(boolean mode, ApplicationId clientName); void onrepeatmoderequest(boolean mode, ApplicationId clientName); void onrepeatstaterequest(MediaControllerRepeatState state, ApplicationId clientName); void onplaybackitemrequest(DOMString playlistName, DOMString index, MediaControllerPlaybackState state, unsigned long long position, ApplicationId clientName); };
onplaybackstaterequest
void onplaybackstaterequest(MediaControllerPlaybackState state, ApplicationId clientName);
Remark: Parameter clientName is passed since Tizen 5.5.
onplaybackpositionrequest
void onplaybackpositionrequest(unsigned long long position, ApplicationId clientName);
onshufflemoderequest
void onshufflemoderequest(boolean mode, ApplicationId clientName);
onrepeatmoderequest
Deprecated. Deprecated since 5.5. Instead, use onrepeatstaterequest.
void onrepeatmoderequest(boolean mode, ApplicationId clientName);
Remark: The onrepeatmoderequest callback will not be invoked, if the repeatState is requested to be changed to REPEAT_ONE.
onrepeatstaterequest
void onrepeatstaterequest(MediaControllerRepeatState state, ApplicationId clientName);
It is guaranteed that the onrepeatstaterequest callback will be invoked after the onrepeatmoderequest.
onplaybackitemrequest
void onplaybackitemrequest(DOMString playlistName, DOMString index, MediaControllerPlaybackState state, unsigned long long position, ApplicationId clientName);
[Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerGetAllPlaylistsSuccessCallback { void onsuccess(MediaControllerPlaylist[] playlists); };
void onsuccess(MediaControllerPlaylist[] playlists);
[Callback, NoInterfaceObject] interface MediaControllerPlaylistUpdatedCallback { void onplaylistupdated(DOMString serverName, MediaControllerPlaylist playlist); void onplaylistdeleted(DOMString serverName, DOMString playlistName); };
onplaylistupdated
void onplaylistupdated(DOMString serverName, MediaControllerPlaylist playlist);
onplaylistdeleted
void onplaylistdeleted(DOMString serverName, DOMString playlistName);
[Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerGetItemsSuccessCallback { void onsuccess(MediaControllerPlaylistItem[] items); };
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); };
onplaybackabilitychanged
void onplaybackabilitychanged(MediaControllerServerInfo server, MediaControllerPlaybackAbilitiesInfo abilities);
ondisplaymodeabilitychanged
void ondisplaymodeabilitychanged(MediaControllerServerInfo server, MediaControllerDisplayModeAbilitiesInfo abilities);
ondisplayrotationabilitychanged
void ondisplayrotationabilitychanged(MediaControllerServerInfo server, MediaControllerDisplayRotationAbilitiesInfo abilities);
onsimpleabilitychanged
void onsimpleabilitychanged(MediaControllerServerInfo server, MediaControllerSimpleAbility type, MediaControllerAbilitySupport support);
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 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 MediaControllerPlaybackInfo playbackInfo; readonly attribute DOMString? iconURI; 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 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); }; [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 MediaControllerPlaybackInfo playbackInfo raises(WebAPIException); 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 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); }; [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 MediaControllerRepeatState repeatState; readonly attribute MediaControllerMetadata metadata; readonly attribute DOMString? index; readonly attribute DOMString? playlistName; }; [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; }; [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 { void onplaybackstaterequest(MediaControllerPlaybackState state, ApplicationId clientName); void onplaybackpositionrequest(unsigned long long position, ApplicationId clientName); void onshufflemoderequest(boolean mode, ApplicationId clientName); void onrepeatstaterequest(MediaControllerRepeatState state, ApplicationId clientName); void onplaybackitemrequest(DOMString playlistName, DOMString index, MediaControllerPlaybackState state, 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); }; };