MediaController API

The Media Controller API provides functions for communication between the media controller server and the media controller client.

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


Summary of Interfaces and Methods

Interface Method
MediaControllerObject
MediaControllerManager
MediaControllerServer
void updateIconURI (DOMString? iconURI)
void updatePlaybackPosition (unsigned long long position)
void updateShuffleMode (boolean mode)
void removeCommandListener (long watchId)
void savePlaylist (MediaControllerPlaylist playlist, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback)
void deletePlaylist (DOMString playlistName, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback)
void updatePlaybackItem (DOMString playlistName, DOMString index)
void getAllPlaylists (MediaControllerGetAllPlaylistsSuccessCallback successCallback, optional ErrorCallback? errorCallback)
MediaControllerClient
void findServers (MediaControllerServerInfoArraySuccessCallback successCallback, optional ErrorCallback? errorCallback)
void removeAbilityChangeListener (long watchId)
MediaControllerServerInfo
void sendPlaybackState (MediaControllerPlaybackState state, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback)
void sendPlaybackPosition (unsigned long long position, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback)
void sendShuffleMode (boolean mode, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback)
void sendRepeatState (MediaControllerRepeatState state, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback)
void sendSearchRequest (SearchFilter[] request, MediaControllerSearchRequestReplyCallback replyCallback, optional ErrorCallback? errorCallback)
void sendCommand (DOMString command, Bundle? data, MediaControllerSendCommandSuccessCallback successCallback, optional ErrorCallback? errorCallback)
void getAllPlaylists (MediaControllerGetAllPlaylistsSuccessCallback successCallback, optional ErrorCallback? errorCallback)
void sendPlaybackItem (DOMString playlistName, DOMString index, MediaControllerPlaybackState state, unsigned long long position)
void removePlaylistUpdatedListener (long listenerId)
MediaControllerPlaybackInfo
MediaControllerAbilities
MediaControllerPlaybackAbilities
MediaControllerDisplayModeAbilities
MediaControllerDisplayRotationAbilities
MediaControllerAbilitiesInfo
void subscribe ()
void unsubscribe ()
MediaControllerPlaybackAbilitiesInfo
MediaControllerDisplayModeAbilitiesInfo
MediaControllerDisplayRotationAbilitiesInfo
MediaControllerSubtitles
void removeChangeRequestListener (long watchId)
MediaControllerSubtitlesInfo
void sendRequest (boolean enabled, MediaControllerSendCommandSuccessCallback replyCallback)
void removeModeChangeListener (long watchId)
MediaControllerMode360
void removeChangeRequestListener (long watchId)
MediaControllerMode360Info
void sendRequest (boolean enabled, MediaControllerSendCommandSuccessCallback replyCallback)
void removeModeChangeListener (long watchId)
MediaControllerDisplayMode
void removeChangeRequestListener (long watchId)
MediaControllerDisplayModeInfo
void removeModeChangeListener (long watchId)
MediaControllerDisplayRotation
void removeChangeRequestListener (long watchId)
MediaControllerClientInfo
void sendEvent (DOMString eventName, Bundle? data, MediaControllerSendCommandSuccessCallback successCallback)
MediaControllerDisplayRotationInfo
MediaControllerMetadata
MediaControllerPlaylistItem
MediaControllerMetadataInit
MediaControllerPlaylist
void addItem (DOMString index, MediaControllerMetadataInit metadata)
void getItems (MediaControllerGetItemsSuccessCallback successCallback, optional ErrorCallback? errorCallback)
SearchFilter
MediaControllerServerInfoArraySuccessCallback
MediaControllerSendCommandSuccessCallback
void onsuccess (object? data, optional long code)
RequestReply
MediaControllerSearchRequestReplyCallback
void onreply (RequestReply? reply)
MediaControllerSearchRequestCallback
MediaControllerReceiveCommandCallback
RequestReply? onsuccess (ApplicationId senderAppName, DOMString command, object data)
MediaControllerEnabledChangeRequestCallback
RequestReply? onreply (ApplicationId clientName, boolean enabled)
MediaControllerEnabledChangeCallback
void onchange (boolean enabled)
MediaControllerDisplayModeChangeRequestCallback
MediaControllerDisplayModeChangeCallback
MediaControllerDisplayRotationChangeRequestCallback
MediaControllerDisplayRotationChangeCallback
MediaControllerServerStatusChangeCallback
MediaControllerPlaybackInfoChangeCallback
void onplaybackchanged (MediaControllerPlaybackState state, unsigned long long position)
void onshufflemodechanged (boolean mode)
MediaControllerChangeRequestPlaybackInfoCallback
void onplaybackpositionrequest (unsigned long long position, ApplicationId clientName)
void onshufflemoderequest (boolean mode, ApplicationId clientName)
void onplaybackitemrequest (DOMString playlistName, DOMString index, MediaControllerPlaybackState state, unsigned long long position, ApplicationId clientName)
MediaControllerGetAllPlaylistsSuccessCallback
MediaControllerPlaylistUpdatedCallback
void onplaylistupdated (DOMString serverName, MediaControllerPlaylist playlist)
void onplaylistdeleted (DOMString serverName, DOMString playlistName)
MediaControllerGetItemsSuccessCallback
MediaControllerAbilityChangeCallback

1. Type Definitions

1.1. MediaControllerServerState

The media controller server state.
  enum MediaControllerServerState { "ACTIVE", "INACTIVE" };

Since: 5.0

  • ACTIVE - Corresponds to active server state.
  • INACTIVE - Corresponds to inactive server state.

1.2. MediaControllerSearchCategory

Search category.
  enum MediaControllerSearchCategory { "NO_CATEGORY", "TITLE", "ARTIST", "ALBUM", "GENRE", "TPO" };

Since: 5.5

  • NO_CATEGORY - No search category.
  • TITLE - Search by title.
  • ARTIST - Search by artist.
  • ALBUM - Search by album.
  • GENRE - Search by genre.
  • TPO - Search by Time Place Occasion.

1.3. MediaControllerPlaybackState

Defines media playback state.
  enum MediaControllerPlaybackState { "PLAY", "PAUSE", "STOP", "NEXT", "PREV", "FORWARD", "REWIND" };

Since: 5.0

  • PLAY - Corresponds to the "playing" media controller playback state.
  • PAUSE - Corresponds to the "paused" media controller playback state.
  • STOP - Corresponds to the "stopped" media controller playback state.
  • NEXT - Corresponds to the "moving to next" media controller playback state.
  • PREV - Corresponds to the "moving to previous" media controller playback state.
  • FORWARD - Corresponds to the "forwarding" media controller playback state.
  • REWIND - Corresponds to the "rewinding" media controller playback state.

1.4. MediaControllerRepeatState

Defines states for repeating media.
  enum MediaControllerRepeatState { "REPEAT_OFF", "REPEAT_ONE", "REPEAT_ALL" };

Since: 5.5

The possible states are:

  • REPEAT_OFF - repeating is disabled.
  • REPEAT_ONE - repeating one media.
  • REPEAT_ALL - repeating all media.

1.5. MediaControllerContentType

Content type.
  enum MediaControllerContentType { "IMAGE", "MUSIC", "VIDEO", "OTHER", "UNDECIDED" };

Since: 5.5

  • IMAGE - content type for images.
  • MUSIC - content type for music.
  • VIDEO - content type for videos.
  • OTHER - content type for other media.
  • UNDECIDED - content type for unspecified media types.

1.6. MediaControllerContentAgeRating

Media Controller content age rating.
  enum MediaControllerContentAgeRating { "ALL", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16",
    "17", "18", "19" };

Since: 5.5

Each value represents the minimum age restriction for the media.

1.7. MediaControllerAbilitySupport

The media controller ability support values.
  enum MediaControllerAbilitySupport { "YES", "NO", "UNDECIDED" };

Since: 5.5

  • YES - Ability is supported.
  • NO - Ability is not supported.
  • UNDECIDED - The support of ability is not set.

1.8. MediaControllerSimpleAbility

The media controller simple ability types. Simple means, that each ability is described by a single MediaControllerAbilitySupport value and is not a part of a complex ability structure.
  enum MediaControllerSimpleAbility { "PLAYBACK_POSITION", "SHUFFLE", "REPEAT", "PLAYLIST", "CLIENT_CUSTOM", "SEARCH", "SUBTITLES",
    "MODE_360" };

Since: 5.5

  • PLAYBACK_POSITION - Ability to change playback position.
  • SHUFFLE - Ability to change shuffle mode.
  • REPEAT - Ability to change repeat state.
  • PLAYLIST - Ability to add/change/remove playlists.
  • CLIENT_CUSTOM - Ability to receive custom commands from media controller clients.
  • SEARCH - Ability to receive search requests from media controller clients.
  • SUBTITLES - Ability to receive requests for subtitles mode change from media controller clients.
  • MODE_360 - Ability to receive requests for spherical (360°) mode change from media controller clients.

1.9. MediaControllerDisplayModeType

Types of supported media controller display modes.
  enum MediaControllerDisplayModeType { "LETTER_BOX", "ORIGIN_SIZE", "FULL_SCREEN", "CROPPED_FULL" };

Since: 5.5

  • LETTER_BOX - Letter box display mode type.
  • ORIGIN_SIZE - Origin size display mode type.
  • FULL_SCREEN - Full screen display mode type.
  • CROPPED_FULL - Cropped full screen display mode type.

1.10. MediaControllerDisplayRotationType

The media controller rotation values.
  enum MediaControllerDisplayRotationType { "ROTATION_NONE", "ROTATION_90", "ROTATION_180", "ROTATION_270" };

Since: 5.5

  • ROTATION_NONE - Display is not rotated.
  • ROTATION_90 - Display is rotated by 90°.
  • ROTATION_180 - Display is rotated by 180°.
  • ROTATION_270 - Display is rotated by 270°.

2. Interfaces

2.1. MediaControllerObject

This interface defines what is instantiated by the Tizen object from the Tizen platform.
  [NoInterfaceObject] interface MediaControllerObject {
    readonly attribute MediaControllerManager mediacontroller;
  };
  Tizen implements MediaControllerObject;

Since: 5.0

There is a tizen.mediacontroller object that allows access to the Media Controller API.

Attributes

  • readonly MediaControllerManager mediacontroller
    Object representing a media controller manager.

    Since: 5.0

2.2. MediaControllerManager

This interface provides access to the MediaControllerObject object.
  [NoInterfaceObject] interface MediaControllerManager {
    MediaControllerClient getClient() raises(WebAPIException);
    MediaControllerServer createServer() raises(WebAPIException);
  };

Since: 5.0

Methods

getClient
Gets the client object. If not exist, client will be automatically created.

Since: 5.0

Privilege level: public

Privilege: http://tizen.org/privilege/mediacontroller.client

Return value:

    MediaControllerClient: The MediaController Client object.

Exceptions:

  • WebAPIException
    • with error type NotSupportedError, if this feature is not supported.

    • with error type SecurityError, if the application does not have the privilege to call this method.

    • with error type UnknownError, if any other error occurs.

Code example:

try
{
  var mcClient = tizen.mediacontroller.getClient();
}
catch (err)
{
  console.log(err.name + ": " + err.message);
}
createServer
Creates the Server object which holds playback state, meta data and is controlled by Client.
MediaControllerServer createServer();

Since: 5.0

Privilege level: public

Privilege: http://tizen.org/privilege/mediacontroller.server

Return value:

    MediaControllerServer: The MediaController Server object.

Exceptions:

  • WebAPIException
    • with error type NotSupportedError, if this feature is not supported.

    • with error type SecurityError, if the application does not have the privilege to call this method.

    • with error type UnknownError, if any other error occurs.

Code example:

try
{
  var mcServer = tizen.mediacontroller.createServer();
}
catch (err)
{
  console.log(err.name + ": " + err.message);
}

2.3. MediaControllerServer

Provides functions for sending the server information to the client.
  [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);
  };

Since: 5.0

Allows the application to send the playback state and metadata to other application and be controlled by other application(client) remotely.

Attributes

  • readonly MediaControllerPlaybackInfo playbackInfo
    Current playback info.

    Since: 5.0

    Remark: Object holds state which is automatically updated by update methods.

  • readonly DOMString iconURI [nullable]
    Server icon URI.

    Since: 5.5

  • readonly MediaControllerAbilities abilities
    Abilities of the media controller server.

    Since: 5.5

  • readonly MediaControllerSubtitles subtitles
    Object representing features related to subtitles control of a media controller server.

    Since: 5.5

  • readonly MediaControllerMode360 mode360
    Object representing features related to spherical (360°) mode control of a media controller server.

    Since: 5.5

  • readonly MediaControllerDisplayMode displayMode
    Object representing features related to display mode control of a media controller server.

    Since: 5.5

  • readonly MediaControllerDisplayRotation displayRotation
    Object representing features related to display rotation control of a media controller server.

    Since: 5.5

Methods

getAllClientsInfo
Returns all existing clients info.
MediaControllerClientInfo[] getAllClientsInfo();

Since: 5.5

Remark: Code example available at sendEvent() method documentation.

Return value:

    MediaControllerClientInfo[]: All existing clients info.

Exceptions:

  • WebAPIException
    • with error type UnknownError, if any platform error occurs.

updatePlaybackState
Updates playback state and send notification to the listening clients. See MediaControllerServerInfo.addPlaybackInfoChangeListener to check how to receive playback info changes from server on client side.
void updatePlaybackState(MediaControllerPlaybackState state);

Since: 5.0

Parameters:

  • state: Playback state.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type UnknownError, if any other error occurs.

Code example:

var mcServer = tizen.mediacontroller.createServer();

mcServer.updatePlaybackState("PLAY");
console.log("Current playback state is: " + mcServer.playbackInfo.state);

Output example:

Current playback state is: PLAY
updateIconURI
Updates server icon URI.
void updateIconURI(DOMString? iconURI);

Since: 5.5

Parameters:

  • iconURI [nullable]: URI of the icon to be set.

Exceptions:

  • WebAPIException
    • with error type UnknownError, if any error occurs.

Code example:

var mcServer = tizen.mediacontroller.createServer();
mcServer.updatePlaybackState("PLAY");
var mcClient = tizen.mediacontroller.getClient();
var mcServerInfo = mcClient.getLatestServerInfo();
mcServer.updateIconURI("http://example.com/res/icon2.ico");
console.log(mcServerInfo.iconURI);

Output example:

http://example.com/res/icon2.ico
updatePlaybackPosition
Updates playback position and send notification to the listening clients.
void updatePlaybackPosition(unsigned long long position);

Since: 5.0

Parameters:

  • position: Playback position.

Exceptions:

  • WebAPIException
    • with error type InvalidValuesError, if any of the input parameters contain an invalid value.

    • with error type UnknownError, if any other error occurs.

Code example:

var mcServer = tizen.mediacontroller.createServer();

mcServer.updatePlaybackPosition(164);
console.log("Current playback position is: " + mcServer.playbackInfo.position);

Output example:

Current playback position is: 164
updatePlaybackAgeRating
Sets content age rating for current playback item.
void updatePlaybackAgeRating(MediaControllerContentAgeRating rating);

Since: 5.5

Parameters:

  • rating: New age rating for current playback item.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type UnknownError, if any other error occurs.

Code example:

var mcServer = tizen.mediacontroller.createServer();
mcServer.updatePlaybackAgeRating("10");
var mcClient = tizen.mediacontroller.getClient();
var mcServerInfo = mcClient.getLatestServerInfo();
console.log("Only viewers older than " + mcServerInfo.playbackInfo.ageRating +
            " are allowed to access this content.");

Output example:

Only viewers older than 10 are allowed to access this content.
updatePlaybackContentType
Sets content type for the current playback item.
void updatePlaybackContentType(MediaControllerContentType type);

Since: 5.5

Parameters:

  • type: New content type for the current playback item.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type UnknownError, if any other error occurs.

Code example:

var mcServer = tizen.mediacontroller.createServer();
mcServer.updatePlaybackContentType("MUSIC");
var mcClient = tizen.mediacontroller.getClient();
var mcServerInfo = mcClient.getLatestServerInfo();
console.log("Content type of current item is " + mcServerInfo.playbackInfo.contentType);

Output example:

Content type of current item is MUSIC
updateShuffleMode
Updates shuffle mode and send notification to the listening clients.
void updateShuffleMode(boolean mode);

Since: 5.0

Parameters:

  • mode: Shuffle mode.

Exceptions:

  • WebAPIException
    • with error type UnknownError, if any error occurs.

Code example:

var mcServer = tizen.mediacontroller.createServer();

mcServer.updateShuffleMode(true);
console.log("Current shuffle mode is: " + mcServer.playbackInfo.shuffleMode);

Output example:

Current shuffle mode is: true
updateRepeatMode
Updates repeat mode and send notification to the listening clients.

Deprecated. Deprecated since 5.5. Instead, use updateRepeatState.

void updateRepeatMode(boolean mode);

Since: 5.0

Parameters:

  • mode: Repeat mode.

Exceptions:

  • WebAPIException
    • with error type UnknownError, if any error occurs.

Code example:

var mcServer = tizen.mediacontroller.createServer();

mcServer.updateRepeatMode(true);
console.log("Current repeat mode is: " + mcServer.playbackInfo.repeatMode);
updateRepeatState
Updates repeat state and sends notification to the listening clients.
void updateRepeatState(MediaControllerRepeatState state);

Since: 5.5

Parameters:

  • state: Repeat state to be set.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type UnknownError, if any other error occurs.

Code example:

var mcServer = tizen.mediacontroller.createServer();

mcServer.updateRepeatState("REPEAT_ONE");
console.log("Current repeat state is: " + mcServer.playbackInfo.repeatState);

Output example:

Current repeat state is: REPEAT_ONE
updateMetadata
Updates metadata and send notification to the listening clients.
void updateMetadata(MediaControllerMetadata metadata);

Since: 5.0

Parameters:

  • metadata: Metadata object.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type UnknownError, if any other error occurs.

Code example:

var mcServer = tizen.mediacontroller.createServer();
var metadata = mcServer.playbackInfo.metadata;

metadata.artist = "Artist Name";
mcServer.updateMetadata(metadata);

console.log("Current metadata is: " + JSON.stringify(mcServer.playbackInfo.metadata));

Output example:

Current metadata is: {"title":"","artist":"Artist Name","album":"","author":"","genre":"",
"duration":"","date":"","copyright":"","description":"","trackNum":"","picture":"",
"seasonNumber":0,"seasonTitle":"","episodeNumber":0,"episodeTitle":"","resolutionWidth":0,"resolutionHeight":0}
addChangeRequestPlaybackInfoListener
Adds the listener for a media playback info requests from client. See MediaControllerServerInfo to check how to send playback info change requests from client.
long addChangeRequestPlaybackInfoListener(MediaControllerChangeRequestPlaybackInfoCallback listener);

Since: 5.0

Parameters:

  • listener: Change request listener to add.

Return value:

    long: The identifier used to clear the watch subscription.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type UnknownError, if any other error occurs.

Code example:

var watcherId = 0;  /* Watcher identifier. */
var mcServer = tizen.mediacontroller.createServer();

var playbackRequestListener =
{
  onplaybackstaterequest: function(state, clientName)
  {
    console.log("Playback state requested to: " + state + " by " + clientName);
  },
  onplaybackpositionrequest: function(position, clientName)
  {
    console.log("Playback position requested to: " + position + " by " + clientName);
  },
  onshufflemoderequest: function(mode, clientName)
  {
    console.log("Shuffle mode requested to: " + mode + " by " + clientName);
  },
  onrepeatstaterequest: function(state, clientName)
  {
    console.log("Repeat state requested to: " + state + " by " + clientName);
  },
  onplaybackitemrequest: function(playlistName, index, state, position, clientName)
  {
    console.log("Playlist: " + playlistName + " index: " + index + " state: " + state +
                " position " + position + " requested by " + clientName);
  }
};

/* Registers to receive playback info change requests from client. */
watcherId = mcServer.addChangeRequestPlaybackInfoListener(playbackRequestListener);
removeChangeRequestPlaybackInfoListener
Removes the listener, so stop receiving playback state requests from clients.
void removeChangeRequestPlaybackInfoListener(long watchId);

Since: 5.0

Calling this function has no effect if there is no listener with given id.

Parameters:

  • watchId: Subscription identifier.

Exceptions:

  • WebAPIException
    • with error type UnknownError, if any error occurs.

Code example:

var watcherId = 0;  /* Watcher identifier. */
var mcServer = tizen.mediacontroller.createServer();

var playbackRequestListener =
{
  onplaybackstaterequest: function(state, clientName)
  {
    console.log("Playback state requested to: " + state + " by " + clientName);
  },
  onplaybackpositionrequest: function(position, clientName)
  {
    console.log("Playback position requested to: " + position + " by " + clientName);
  },
  onshufflemoderequest: function(mode, clientName)
  {
    console.log("Shuffle mode requested to: " + mode + " by " + clientName);
  },
  onrepeatstaterequest: function(state, clientName)
  {
    console.log("Repeat state requested to: " + state + " by " + clientName);
  },
  onplaybackitemrequest: function(playlistName, index, state, position, clientName)
  {
    console.log("Playlist: " + playlistName + " index: " + index + " state: " + state +
                " position " + position + " requested by " + clientName);
  }
};

/* Registers to receive playback info change requests. */
watcherId = mcServer.addChangeRequestPlaybackInfoListener(playbackRequestListener);

/* Cancels the watch operation. */
mcServer.removeChangeRequestPlaybackInfoListener(watcherId);
setSearchRequestListener
Sets the listener for receiving search requests from a client.
void setSearchRequestListener(MediaControllerSearchRequestCallback listener);

Since: 5.5

Parameters:

  • listener: Function to be called for each search command received.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any of the arguments has invalid type.

    • with error type UnknownError, if any other error occurs.

Code example:

var mcServer = tizen.mediacontroller.createServer();
function searchRequestListener(clientName, request)
{
  console.log("name of the client application which sent the request: " + clientName);
  console.log("search command received.");
  request.forEach(filter =>
  {
    console.log("filter: " + JSON.stringify(filter));
  });
}
mcServer.setSearchRequestListener(searchRequestListener);
unsetSearchRequestListener
Unsets search request listener.
void unsetSearchRequestListener();

Since: 5.5

Calling this function has no effect if the listener was not set.

Exceptions:

  • WebAPIException
    • with error type UnknownError, if unknown error occurs.

Code example:

var mcServer = tizen.mediacontroller.createServer();
function searchRequestListener(clientName, request)
{
  console.log("search command received.");
}
mcServer.setSearchRequestListener(searchRequestListener);
mcServer.unsetSearchRequestListener();
addCommandListener
Adds the listener for receiving custom commands from client. See MediaControllerServerInfo to check how to send custom commands from client.
long addCommandListener(MediaControllerReceiveCommandCallback listener);

Since: 5.0

Parameters:

  • listener: Custom commands listener to add.

Return value:

    long: The identifier used to clear the watch subscription.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type UnknownError, if any other error occurs.

Code example:

var watcherId = 0;  /* Watcher identifier. */
var mcServer = tizen.mediacontroller.createServer();

var commandReceiveListener = function(clientName, command, data)
{
  console.log("Command " + command + " received from: " + clientName + " with data: " +
              JSON.stringify(data));

  return new tizen.mediacontroller.RequestReply(new tizen.Bundle({myReply: "someValue"}), 0);
};

/* Registers to receive custom commands from client. */
watcherId = mcServer.addCommandListener(commandReceiveListener);
removeCommandListener
Removes the listener, so stop receiving custom commands from clients.
void removeCommandListener(long watchId);

Since: 5.0

Calling this function has no effect if there is no listener with given id.

Parameters:

  • watchId: Subscription identifier.

Exceptions:

  • WebAPIException
    • with error type UnknownError, if any error occurs.

Code example:

var watcherId = 0;  /* Watcher identifier. */
var mcServer = tizen.mediacontroller.createServer();

var commandReceiveListener = function(clientName, command, data)
{
  console.log("Command " + command + " received from: " + clientName + " with data: " +
              JSON.stringify(data));

  return new tizen.mediacontroller.RequestReply(new tizen.Bundle({myReply: "someValue"}), 0);
};

/* Registers to receive custom commands from client. */
watcherId = mcServer.addCommandListener(commandReceiveListener);

/* Cancels the watch operation. */
mcServer.removeCommandListener(watcherId);
createPlaylist
Creates MediaControllerPlaylist object.
MediaControllerPlaylist createPlaylist(DOMString name);

Since: 5.5

Remark: Please note that there is a need to use savePlaylist(), otherwise playlist creation will have no effect on a device. All playlists will be deleted after application is closed.

Parameters:

  • name: Name of the new playlist.

Return value:

    MediaControllerPlaylist: New empty MediaControllerPlaylist object with given name.

Exceptions:

  • WebAPIException
    • with error type InvalidValuesError, if playlist with given name already exists.

    • with error type UnknownError, if any other error occurs.

Code example:

var mcServer = tizen.mediacontroller.createServer();
var playlist = mcServer.createPlaylist("testPlaylistName");
savePlaylist
Saves the playlist in a local database.
void savePlaylist(MediaControllerPlaylist playlist, optional SuccessCallback? successCallback,
                  optional ErrorCallback? errorCallback);

Since: 5.5

The errorCallback may be triggered for one of the following errors:

  • InvalidValuesError: if playlist with given name does not exist.
  • UnknownError: if any other error prevents the function from successful completion.

Remark: All playlists will be deleted after the application is closed.

Parameters:

  • playlist: MediaControllerPlaylist object to save.
  • successCallback [optional] [nullable]: Function to be called when savePlaylist is finished without error.
  • errorCallback [optional] [nullable]: Function to be called when savePlaylist fails.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type UnknownError, if any other error occurs.

Code example:

var mcServer = tizen.mediacontroller.createServer();
var playlist = mcServer.createPlaylist("testPlaylistName");
function successCallback()
{
  console.log("savePlaylist successful.");
}
function errorCallback(error)
{
  console.log("savePlaylist failed with error: " + error);
}
mcServer.savePlaylist(playlist, successCallback, errorCallback);

Output example:

savePlaylist successful.
deletePlaylist
Deletes playlist from local database.
void deletePlaylist(DOMString playlistName, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);

Since: 5.5

The errorCallback may be triggered for one of the following errors:

  • InvalidValuesError: if playlist with given name does not exist.
  • UnknownError: if any other error prevents the function from successful completion.

Parameters:

  • playlistName: Name of the playlist to remove.
  • successCallback [optional] [nullable]: Function to be called when deletePlaylist is finished without error.
  • errorCallback [optional] [nullable]: Function to be called when deletePlaylist fails.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type UnknownError, if any other error occurs.

Code example:

var mcServer = tizen.mediacontroller.createServer();
var playlist = mcServer.createPlaylist("testPlaylistName");
function deleteSuccess()
{
  console.log("deletePlaylist successful.");
}
function deleteFailure(error)
{
  console.log("deletePlaylist failed with error: " + error);
}
function saveSuccess()
{
  mcServer.deletePlaylist(playlist.name, deleteSuccess, deleteFailure);
}
mcServer.savePlaylist(playlist, saveSuccess);

Output example:

deletePlaylist successful.
updatePlaybackItem
Sets index and playlist name properties of playback info object.
void updatePlaybackItem(DOMString playlistName, DOMString index);

Since: 5.5

Parameters:

  • playlistName: Name of playlist to be set.
  • index: Index of item on playlist playlistName to be set.

Exceptions:

  • WebAPIException
    • with error type UnknownError, if any error occurs.

Code example:

var mcServer = tizen.mediacontroller.createServer();
var playlist = mcServer.createPlaylist("testPlaylistName");
var metadata =
{
  title: "testTitle",
  artist: "testArtist",
  album: "testAlbum",
  author: "testAuthor",
  genre: "testGenre",
  duration: "testDuration",
  date: "testDate",
  copyright: "testCopyright",
  description: "testDescription",
  trackNum: "testTrackNum",
  picture: "testPicture"
};
playlist.addItem("index1", metadata);
mcServer.savePlaylist(playlist, function()
{
  mcServer.updatePlaybackItem("testPlaylistName", "index1");
  console.log("Current playlist: " + mcServer.playbackInfo.playlistName);
  console.log("Current index: " + mcServer.playbackInfo.index);
});

Output example:

Current playlist: testPlaylistName
Current index: index1
getAllPlaylists
Retrieves all playlists from a local database.
void getAllPlaylists(MediaControllerGetAllPlaylistsSuccessCallback successCallback, optional ErrorCallback? errorCallback);

Since: 5.5

The errorCallback may be triggered for one of the following errors:

  • UnknownError: if any error prevents function from successful completion.

Parameters:

  • successCallback: Function to be called on getAllPlaylists success.
  • errorCallback [optional] [nullable]: Function to be called when getAllPlaylists fails.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any parameter has invalid type.

    • with error type UnknownError, if any other error occurs.

Code example:

var mcServer = tizen.mediacontroller.createServer();
var playlist = mcServer.createPlaylist("testPlaylist");

function saveSuccess()
{
  console.log("savePlaylist successful");
  function successCallback(playlists)
  {
    playlists.forEach(function(playlist)
    {
      console.log("Playlist name: " + playlist.name);
    });
  }
  function errorCallback(error)
  {
    console.log("getAllPlaylists failed with error: " + error);
  }
  mcServer.getAllPlaylists(successCallback, errorCallback);
}
function saveError(error)
{
  console.log("savePlaylist failed with error: " + error);
}

mcServer.savePlaylist(playlist, saveSuccess, saveError);

Output example:

savePlaylist successful
Playlist name: testPlaylistName

2.4. MediaControllerClient

The media controller client API and functions related with handling media control. Functions include operations to get the latest status of the media controller servers.
  [NoInterfaceObject] interface MediaControllerClient {
    void findServers(MediaControllerServerInfoArraySuccessCallback successCallback, optional ErrorCallback? errorCallback)
                     raises(WebAPIException);
    MediaControllerServerInfo? getLatestServerInfo() raises(WebAPIException);
    long addAbilityChangeListener(MediaControllerAbilityChangeCallback listener) raises(WebAPIException);
    void removeAbilityChangeListener(long watchId) raises(WebAPIException);
    void findSubscribedServers(MediaControllerServerInfoArraySuccessCallback successCallback, optional ErrorCallback? errorCallback)
                               raises(WebAPIException);
    void setCustomEventListener(MediaControllerReceiveCommandCallback listener) raises(WebAPIException);
    void unsetCustomEventListener() raises(WebAPIException);
  };

Since: 5.0

Methods

findServers
Retrieves all activated media controller servers.
void findServers(MediaControllerServerInfoArraySuccessCallback successCallback, optional ErrorCallback? errorCallback);

Since: 5.0

Parameters:

  • successCallback: The method to invoke when all of the registered media controller servers have been found.
  • errorCallback [optional] [nullable]: The method to invoke on failure of retrieving servers list.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type UnknownError, if any other error occurs.

Code example:

var mcClient;
try
{
  mcClient = tizen.mediacontroller.getClient();
}
catch (err)
{
  console.log(err.name + " error: " + err.message);
}

function successCallback(list)
{
  for (var s in list)
  {
    console.log("Found server: " + list[s].name + ", state: " + list[s].state);
  }
}

function errorCallback(err)
{
  console.log(err.name + " error: " + err.message);
}

mcClient.findServers(successCallback, errorCallback);

Output example:

Found server: og8WN4XlLg.BasicUIStudio, state: ACTIVE
getLatestServerInfo
Gets the latest activated media controller server info.
MediaControllerServerInfo? getLatestServerInfo();

Since: 5.0

Remark: If there is no activated media controller server, null value is returned.

Return value:

    MediaControllerServerInfo [nullable]: Server info or null.

Exceptions:

  • WebAPIException
    • with error type UnknownError, if any error occurs.

Code example:

/* Access latest server info. */
var mcClient = tizen.mediacontroller.getClient();
var mcServerInfo = mcClient.getLatestServerInfo();
console.log(
    "Latest server name is: " + mcServerInfo.name + ", server state: " + mcServerInfo.state);

Output example:

Latest server name is: 2cpQcelP8a.HelloTizen, server state: INACTIVE
addAbilityChangeListener
Adds a listener to be invoked when ability of the media controller server is changed.
long addAbilityChangeListener(MediaControllerAbilityChangeCallback listener);

Since: 5.5

Remark: Implicitly the media controller client will receive information about ability changes of every active media controller server. To receive information only from selected servers, calling function subscribe() is required.

Parameters:

  • listener: Function to call on mediacontroller server's ability change.

Return value:

    long: The identifier used to clear the watch subscription.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type UnknownError, if any other error occurs.

Code example:

/* Client-side code */
var mcClient = tizen.mediacontroller.getClient();

var listener =
{
  onplaybackabilitychanged: function(server, ability)
  {
    console.log("Playback ability changed, server name: " + server.name + ", abilities: ");
    console.log(JSON.stringify(ability));
  },
  ondisplaymodeabilitychanged: function(server, ability)
  {
    console.log("Display mode ability changed, server name: " + server.name + ", abilities: ");
    console.log(JSON.stringify(ability));
  },
  ondisplayrotationabilitychanged: function(server, ability)
  {
    console.log("Display rotation ability changed, server name: " + server.name + ", abilities: ");
    console.log(JSON.stringify(ability));
  },
  onsimpleabilitychanged: function(server, type, ability)
  {
    console.log(type + " ability changed, server name: " + server.name + ", ability: " + ability);
  }
};

var watchId = mcClient.addAbilityChangeListener(listener);

/* Server-side code */
var mcServer = tizen.mediacontroller.createServer();
mcServer.abilities.playback.play = "YES";
mcServer.abilities.playback.saveAbilities();
mcServer.abilities.shuffle = "NO";
mcServer.abilities.repeat = "YES";
mcServer.abilities.displayMode.fullScreen = "YES";
mcServer.abilities.displayRotation.rotation180 = "YES";

Output example:

Playback ability changed, server name: GC8qUW5iQj.MediaControllerServer, abilities:
{"play":"YES","pause":"UNDECIDED","stop":"UNDECIDED","next":"UNDECIDED","prev":"UNDECIDED","forward":"UNDECIDED","rewind":"UNDECIDED","togglePlayPause":"UNDECIDED"}
SHUFFLE ability changed, server name: GC8qUW5iQj.MediaControllerServer, ability: "NO"
REPEAT ability changed, server name: GC8qUW5iQj.MediaControllerServer, ability: "YES"
Display mode ability changed, server name: GC8qUW5iQj.MediaControllerServer, abilities: "
{"letterBox":"NO","originSize":"NO","fullScreen":"YES","croppedFull":"NO"}
Display rotation ability changed, server name: GC8qUW5iQj.MediaControllerServer, abilities: "
{"rotationNone":"NO","rotation90":"NO","rotation180":"YES","rotation270":"NO"}
removeAbilityChangeListener
Removes selected MediaControllerAbilityChangeListener.
void removeAbilityChangeListener(long watchId);

Since: 5.5

Remark: All subscriptions added by function subscribe() will be lost after removing last MediaControllerAbilityChangeListener.

Parameters:

Exceptions:

  • WebAPIException
    • with error type UnknownError, if any error occurs.

Code example:

/* Client-side code */
var mcClient = tizen.mediacontroller.getClient();

var listener =
{
  onplaybackabilitychanged: function(server, ability)
  {
    console.log("Playback ability changed, server name: " + mcServer.name + ", abilities: ");
    console.log(JSON.stringify(ability));
  }
};

var watchId = mcClient.addAbilityChangeListener(listener);

/* Server-side code */
var mcServer = tizen.mediacontroller.createServer();
mcServer.abilities.playback.play = "YES";
mcServer.abilities.playback.saveAbilities();

/* Client-side code */
mcClient.removeAbilityChangeListener(watchId);

/* Server-side code */
mcServer.abilities.playback.forward = "YES";
mcServer.abilities.playback.saveAbilities();

Output example:

Playback ability changed, server name: GC8qUW5iQj.MediaControllerServer, abilities:
{"play":"YES","pause":"UNDECIDED","stop":"UNDECIDED","next":"UNDECIDED","prev":"UNDECIDED","forward":"UNDECIDED","rewind":"UNDECIDED","togglePlayPause":"UNDECIDED"}
findSubscribedServers
Retrieves all subscribed media controller servers.
void findSubscribedServers(MediaControllerServerInfoArraySuccessCallback successCallback, optional ErrorCallback? errorCallback);

Since: 5.5

The ErrorCallback may be triggered for one of the following errors:

  • UnknownError: if any error prevents function from successful completion.

Parameters:

  • successCallback: The method to invoke when all of subscribed media controller servers have been found.
  • errorCallback [optional] [nullable]: The method to invoke on failure of retrieving servers list.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type UnknownError, if any other error occurs.

Code example:

var mcClient = tizen.mediacontroller.getClient();

var listener =
{
  onsimpleabilitychanged: function(server, type, ability)
  {
    console.log(type + " ability changed, server name: " + server.name + ", ability: " + ability);
  }
};

var watchId = mcClient.addAbilityChangeListener(listener);

function errorCB(err)
{
  console.log(err.name + " error: " + err.message);
}

function subscribedSuccessCB(list)
{
  console.log("Subscribed servers:");
  for (var s in list)
  {
    console.log("  server name: " + list[s].name + ", state: " + list[s].state);
  }
}

function findSuccessCB(list)
{
  console.log("Found servers:");
  for (var s in list)
  {
    console.log("  server name: " + list[s].name + ", state: " + list[s].state);
  }
  if (list.length > 0)
  {
    list[0].abilities.subscribe();
    mcClient.findSubscribedServers(subscribedSuccessCB, errorCB);
  }
}

mcClient.findServers(findSuccessCB, errorCB);

Output example:

Found servers:
  server name: XX8qUW5iFF.MediaControllerServerOne, state: ACTIVE
  server name: 2cpQcelP8a.MediaControllerServerTwo, state: ACTIVE
  server name: To0BJCUxbR.MediaControllerServerThree, state: ACTIVE
Subscribed servers:
  server name: XX8qUW5iFF.MediaControllerServerOne, state: ACTIVE
setCustomEventListener
Sets the media controller client's listener for custom events from the server.
void setCustomEventListener(MediaControllerReceiveCommandCallback listener);

Since: 5.5

If the listener has already been set, calling this method will override it.

Parameters:

  • listener: Event handling function.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any of the arguments has invalid types.

    • with error type UnknownError, if any other error occurs.

Code example:

/* this example assumes that the server and client objects already exist. */
mcClient.setCustomEventListener(function(serverName, eventName, data)
{
  return new tizen.mediacontroller.RequestReply({"reply": "data"}, 123);
});
mcClient.unsetCustomEventListener();
unsetCustomEventListener
Removes the server's events listener.
void unsetCustomEventListener();

Since: 5.5

Calling this function has no effect, if the listener is not set.

Exceptions:

  • WebAPIException
    • with error type UnknownError, if any error occurs.

Code example:

/* this example assumes that the server and client already exist. */
mcClient.setCustomEventListener(function(serverName, eventName, data)
{
  return new tizen.mediacontroller.RequestReply({"reply": "data"}, 123);
});
mcClient.unsetCustomEventListener();

2.5. MediaControllerServerInfo

This interface provides media controller server state and playback info. Provides methods to send commands to server and listen for server status change.
  [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);
  };

Since: 5.0

Attributes

  • readonly ApplicationId name
    The appId of the media controller server.

    Since: 5.0

  • readonly MediaControllerServerState state
    State of the media controller server.

    Since: 5.0

  • readonly MediaControllerPlaybackInfo playbackInfo
    Current playback info.

    Since: 5.0

    Exceptions:

    • WebAPIException
      • with error type UnknownError, if any error occurs.

  • readonly DOMString iconURI [nullable]
    Server icon URI.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type UnknownError, if any error occurs.

  • readonly MediaControllerAbilitiesInfo abilities
    Abilities of the media controller server.

    Since: 5.5

  • readonly MediaControllerSubtitlesInfo subtitles
    Object representing features related to subtitles control of a media controller server.

    Since: 5.5

  • readonly MediaControllerMode360Info mode360
    Object representing features related to spherical (360°) mode control of a media controller server.

    Since: 5.5

  • readonly MediaControllerDisplayModeInfo displayMode
    Object representing features related to display mode control of a media controller server.

    Since: 5.5

  • readonly MediaControllerDisplayRotationInfo displayRotation
    Object representing features related to display rotation control of a media controller server.

    Since: 5.5

Methods

sendPlaybackState
Allows to change playback state of media controller server.
void sendPlaybackState(MediaControllerPlaybackState state, optional SuccessCallback? successCallback,
                       optional ErrorCallback? errorCallback);

Since: 5.0

Parameters:

  • state: Playback state.
  • successCallback [optional] [nullable]: The method to invoke when playback state was changed.
  • errorCallback [optional] [nullable]: The method to invoke on operation failure.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type UnknownError, if any other error occurs.

Code example:

var mcClient = tizen.mediacontroller.getClient();
var mcServerInfo = mcClient.getLatestServerInfo();

mcServerInfo.sendPlaybackState("STOP",
    function()
    {
      console.log("Playback has stopped");
    },
    function(e)
    {
      console.log("Unable to change playback state: " + e.message);
    });

Output example:

Playback has stopped
sendPlaybackPosition
Allows to change playback position of media controller server.
void sendPlaybackPosition(unsigned long long position, optional SuccessCallback? successCallback,
                          optional ErrorCallback? errorCallback);

Since: 5.0

Parameters:

  • position: Playback position.
  • successCallback [optional] [nullable]: The method to invoke when playback position was changed.
  • errorCallback [optional] [nullable]: The method to invoke on operation failure.

Exceptions:

  • WebAPIException
    • with error type InvalidValuesError, if any of the input parameters contain an invalid value.

    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type UnknownError, if any other error occurs.

Code example:

var mcClient = tizen.mediacontroller.getClient();
var mcServerInfo = mcClient.getLatestServerInfo();

mcServerInfo.sendPlaybackPosition(164,
    function()
    {
      console.log("Playback position changed");
    },
    function(e)
    {
      console.log("Unable to change playback position: " + e.message);
    });

Output example:

Playback position changed
sendShuffleMode
Allows to change shuffle mode of media controller server.
void sendShuffleMode(boolean mode, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);

Since: 5.0

Parameters:

  • mode: Shuffle mode.
  • successCallback [optional] [nullable]: The method to invoke when shuffle mode was changed.
  • errorCallback [optional] [nullable]: The method to invoke on operation failure.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type UnknownError, if any other error occurs.

Code example:

var mcClient = tizen.mediacontroller.getClient();
var mcServerInfo = mcClient.getLatestServerInfo();

mcServerInfo.sendShuffleMode(true,
    function()
    {
      console.log("Shuffle mode changed");
    },
    function(e)
    {
      console.log("Unable to change shuffle mode: " + e.message);
    });

Output example:

Shuffle mode changed
sendRepeatMode
Allows to change repeat mode of media controller server.

Deprecated. Deprecated since 5.5. Instead, use sendRepeatState.

void sendRepeatMode(boolean mode, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);

Since: 5.0

Parameters:

  • mode: Repeat mode.
  • successCallback [optional] [nullable]: The method to invoke when repeat mode was changed.
  • errorCallback [optional] [nullable]: The method to invoke on operation failure.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type UnknownError, if any other error occurs.

Code example:

var mcClient = tizen.mediacontroller.getClient();
var mcServerInfo = mcClient.getLatestServerInfo();

mcServerInfo.sendRepeatMode(false,
    function()
    {
      console.log("Repeat mode changed");
    },
    function(e)
    {
      console.log("Unable to change repeat mode: " + e.message);
    });
sendRepeatState
Allows to change repeat state of media controller server.
void sendRepeatState(MediaControllerRepeatState state, optional SuccessCallback? successCallback,
                     optional ErrorCallback? errorCallback);

Since: 5.5

Parameters:

  • state: Repeat state to be set.
  • successCallback [optional] [nullable]: The method to invoke when repeat state was changed.
  • errorCallback [optional] [nullable]: The method to invoke on operation failure.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type UnknownError, if any other error occurs.

Code example:

var mcClient = tizen.mediacontroller.getClient();
var mcServerInfo = mcClient.getLatestServerInfo();

mcServerInfo.sendRepeatState("REPEAT_ALL",
    function()
    {
      console.log("Repeat state changed");
    },
    function(e)
    {
      console.log("Unable to change repeat state: " + e.message);
    });

Output example:

Repeat state changed
sendSearchRequest
Sends a search request to the media controller server.
void sendSearchRequest(SearchFilter[] request, MediaControllerSearchRequestReplyCallback replyCallback,
                       optional ErrorCallback? errorCallback);

Since: 5.5

The errorCallback may be triggered for one of the following errors:

  • UnknownError: if any error prevents function from successful completion.

Remark: Search request handler should be specified on the server using setSearchRequestListener() method.

Parameters:

  • request: A collection of between 1 and 20 SearchFilter objects.
  • replyCallback: Function to be invoked when server reply is received.
  • errorCallback [optional] [nullable]: Function to be invoked if server reports failure.

Exceptions:

  • WebAPIException
    • with error type InvalidValuesError, if request has invalid number of filters.

    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type UnknownError, if any other error occurs.

Code example:

/* Server-side code */
var mcServer = tizen.mediacontroller.createServer();
function searchRequestListener(clientName, request)
{
  console.log("search command received");
  return new tizen.mediacontroller.RequestReply(new tizen.Bundle({"key": "value"}), 5);
}
mcServer.setSearchRequestListener(searchRequestListener);
mcServer.updatePlaybackState("PLAY");

/* Client-side code */
var mcClient = tizen.mediacontroller.getClient();
var mcServerInfo = mcClient.getLatestServerInfo();

var query = [
  new tizen.mediacontroller.SearchFilter("MUSIC", "GENRE", "rock"),
  new tizen.mediacontroller.SearchFilter(
      "MUSIC", "GENRE", "pop", new tizen.Bundle({"releasedAfter": "1993"}))
];

mcServerInfo.sendSearchRequest(query, function(reply)
{
  console.log("reply status: " + reply.code);
  console.log("reply data: " + reply.data);
});

Output example:

search command received
reply status: 5
reply data: {"key": "value"}
sendCommand
Allows to send custom command to media controller server.
void sendCommand(DOMString command, Bundle? data, MediaControllerSendCommandSuccessCallback successCallback,
                 optional ErrorCallback? errorCallback);

Since: 5.0

Remark: See addCommandListener() method to check how to receive and respond to custom commands.

Parameters:

  • command: Custom command name which is handled on server side.
  • data [nullable]: Additional data for custom command which is send to server.
  • successCallback: The method to invoke when server responded to custom command.
  • errorCallback [optional] [nullable]: The method to invoke on operation failure.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type UnknownError, if any other error occurs.

Code example:

var mcClient = tizen.mediacontroller.getClient();
var mcServerInfo = mcClient.getLatestServerInfo();

var exampleCustomCommandData = new tizen.Bundle({myFilter: "rock"});
mcServerInfo.sendCommand("myPlaylistFilter", exampleCustomCommandData,
    function(data, code)
    {
      console.log(
          "Server replied with return data: " + JSON.stringify(data) + " and code: " + code);
    },
    function(e)
    {
      console.log("Error executing command: " + e.message);
    });
addServerStatusChangeListener
Adds the listener for a media controller server status change.
long addServerStatusChangeListener(MediaControllerServerStatusChangeCallback listener);

Since: 5.0

Parameters:

  • listener: Status change listener to add.

Return value:

    long: The identifier used to clear the watch subscription.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type UnknownError, if any other error occurs.

Code example:

var watcherId = 0;  /* Watcher identifier. */
var mcClient = tizen.mediacontroller.getClient();
var mcServerInfo = mcClient.getLatestServerInfo();

/* Registers to be notified when server status changes. */
watcherId = mcServerInfo.addServerStatusChangeListener(function(status)
{
  console.log(mcServerInfo.name + " server status changed to " + status);
});
removeServerStatusChangeListener
Removes the listener, so stop receiving notifications about media controller server status.
void removeServerStatusChangeListener(long watchId);

Since: 5.0

Calling this function has no effect if there is no listener with given id.

Parameters:

  • watchId: Subscription identifier.

Exceptions:

  • WebAPIException
    • with error type UnknownError, if any error occurs.

Code example:

var watcherId = 0;  /* Watcher identifier. */
var mcClient = tizen.mediacontroller.getClient();
var mcServerInfo = mcClient.getLatestServerInfo();

/* Registers to be notified when server status changes. */
watcherId = mcServerInfo.addServerStatusChangeListener(function(status)
{
  console.log(mcServerInfo.name + " server status changed to " + status);
});

/* Cancels the watch operation. */
mcServerInfo.removeServerStatusChangeListener(watcherId);
addPlaybackInfoChangeListener
Adds the listener for a media playback info changes.
long addPlaybackInfoChangeListener(MediaControllerPlaybackInfoChangeCallback listener);

Since: 5.0

Parameters:

  • listener: Status change listener to add.

Return value:

    long: The identifier used to clear the watch subscription.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type UnknownError, if any other error occurs.

Code example:

var watcherId = 0;  /* Watcher identifier. */
var mcClient = tizen.mediacontroller.getClient();
var mcServerInfo = mcClient.getLatestServerInfo();

var playbackListener =
{
  onplaybackchanged: function(state, position)
  {
    console.log("Current playback state: " + state);
    console.log("Current playback position: " + position);
  },
  onshufflemodechanged: function(mode)
  {
    console.log("Shuffle mode changed to: " + mode);
  },
  onrepeatstatechanged: function(state)
  {
    console.log("Repeat state changed to: " + state);
  },
  onmetadatachanged: function(metadata)
  {
    console.log("Playback metadata changed: " + JSON.stringify(metadata));
  }
};

/* Registers to be notified when playback state changes. */
watcherId = mcServerInfo.addPlaybackInfoChangeListener(playbackListener);
removePlaybackInfoChangeListener
Removes the listener, so stop receiving notifications about media playback info changes.
void removePlaybackInfoChangeListener(long watchId);

Since: 5.0

Calling this function has no effect if there is no listener with given id.

Parameters:

  • watchId: Subscription identifier.

Exceptions:

  • WebAPIException
    • with error type UnknownError, if any error occurs.

Code example:

var watcherId = 0;  /* Watcher identifier. */
var mcClient = tizen.mediacontroller.getClient();
var mcServerInfo = mcClient.getLatestServerInfo();

/* receives playback state changes. */
var playbackListener =
{
  onplaybackchanged: function(state, position)
  {
    console.log("Current playback state: " + state);
    console.log("Current playback position: " + position);
  },
  onshufflemodechanged: function(mode)
  {
    console.log("Shuffle mode changed to: " + mode);
  },
  onrepeatstatechanged: function(state)
  {
    console.log("Repeat state changed to: " + state);
  },
  onmetadatachanged: function(metadata)
  {
    console.log("Playback metadata changed: " + JSON.stringify(metadata));
  }
};

/* Registers to be notified when playback state changes. */
watcherId = mcServerInfo.addPlaybackInfoChangeListener(playbackListener);

/* Cancels the watch operation. */
mcServerInfo.removePlaybackInfoChangeListener(watcherId);
getAllPlaylists
Retrieves all playlists saved in local database.
void getAllPlaylists(MediaControllerGetAllPlaylistsSuccessCallback successCallback, optional ErrorCallback? errorCallback);

Since: 5.5

The errorCallback may be triggered for one of the following errors:

  • UnknownError: if any other error prevents function from successful completion.

Parameters:

  • successCallback: Function to be called upon success.
  • errorCallback [optional] [nullable]: Function to be called upon failure.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any parameter has invalid type.

    • with error type UnknownError, if any other error occurs.

Code example:

var mcServer = tizen.mediacontroller.createServer();
var mcClient = tizen.mediacontroller.getClient();
var mcServerInfo = mcClient.getLatestServerInfo();
var playlist = mcServer.createPlaylist("testPlaylist");

function saveSuccess()
{
  console.log("savePlaylist successful");
  function successCallback(playlists)
  {
    playlists.forEach(function(playlist)
    {
      console.log("Playlist name: " + playlist.name);
    });
  }
  function errorCallback(error)
  {
    console.log("getAllPlaylists failed with error: " + error);
  }
  mcServerInfo.getAllPlaylists(successCallback, errorCallback);
}

function saveError(error)
{
  console.log("savePlaylist failed with error: " + error);
}

mcServer.savePlaylist(playlist, saveSuccess, saveError);

Output example:

savePlaylist successful
Playlist name: testPlaylist
sendPlaybackItem
Requests setting new playback item to server.
void sendPlaybackItem(DOMString playlistName, DOMString index, MediaControllerPlaybackState state, unsigned long long position);

Since: 5.5

Remark: PlaybackInfoChangeListener should be invoked, if registered.

Parameters:

  • playlistName: Name of playlist to be set.
  • index: Index of item on playlist to be set.
  • state: Playback state.
  • position: Playback position.

Exceptions:

  • WebAPIException
    • with error type UnknownError, if any error occurs.

Code example:

var mcClient = tizen.mediacontroller.getClient();
var mcServerInfo = mcClient.getLatestServerInfo();
mcServerInfo.sendPlaybackItem("testPlaylist", "1", "PLAY", 0);
addPlaylistUpdatedListener
Adds listener to be invoked when playlist is updated by server.
long addPlaylistUpdatedListener(MediaControllerPlaylistUpdatedCallback listener);

Since: 5.5

Parameters:

  • listener: Listener for adding, updating or deleting of any playlist.

Return value:

    long: The identifier used to clear the watch subscription.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type UnknownError, if any other error occurs.

Code example:

var mcClient = tizen.mediacontroller.getClient();
var mcServerInfo = mcClient.getLatestServerInfo();

var listener =
{
  onplaylistupdated: function(serverName, playlist)
  {
    console.log("updated playlist " + playlist);
  },
  onplaylistdeleted: function(serverName, playlistName)
  {
    console.log("deleted playlist " + playlistName);
  }
};
var listenerId = mcServerInfo.addPlaylistUpdatedListener(listener);
removePlaylistUpdatedListener
Stops listening for playlist updates and removals.
void removePlaylistUpdatedListener(long listenerId);

Since: 5.5

Remark: This function has no effect, if there is no listener for given id.

Parameters:

  • listenerId: Listener ID returned by addPlaylistUpdatedListener.

Exceptions:

  • WebAPIException
    • with error type UnknownError, if any error occurs.

Code example:

var mcClient = tizen.mediacontroller.getClient();
var mcServerInfo = mcClient.getLatestServerInfo();

var listener =
{
  onplaylistupdated: function(serverName, playlist) {},
  onplaylistdeleted: function(serverName, playlistName) {}
};
var listenerId = mcServerInfo.addPlaylistUpdatedListener(listener);
mcServerInfo.removePlaylistUpdatedListener(listenerId);

2.6. MediaControllerPlaybackInfo

Current playback info.
  [NoInterfaceObject] interface MediaControllerPlaybackInfo {
    readonly attribute MediaControllerPlaybackState state;
    readonly attribute unsigned long long position;
    readonly attribute MediaControllerContentAgeRating ageRating;
    readonly attribute MediaControllerContentType contentType;
    readonly attribute boolean shuffleMode;
    readonly attribute boolean repeatMode;
    readonly attribute MediaControllerRepeatState repeatState;
    readonly attribute MediaControllerMetadata metadata;
    readonly attribute DOMString? index;
    readonly attribute DOMString? playlistName;
  };

Since: 5.0

Attributes

  • readonly MediaControllerPlaybackState state
    Current playback state.

    Since: 5.0

  • readonly unsigned long long position
    Current playback position.

    Since: 5.0

  • readonly MediaControllerContentAgeRating ageRating
    Current playback age rating.

    Since: 5.5

  • readonly MediaControllerContentType contentType
    Current playback content type.

    Default value is UNDECIDED.

    Since: 5.5

  • readonly boolean shuffleMode
    Current shuffle mode.

    Since: 5.0

  • readonly boolean repeatMode
    Current repeat mode.

    Deprecated. Deprecated since 5.5. Instead, use repeatState.

    Any change in value of repeatMode will also change the value of repeatState.

    The repeatMode equal to true is equivalent to repeatState equal to REPEAT_ALL and repeatMode equal to false is equivalent to repeatState equal to REPEAT_OFF.

    Since: 5.0

  • readonly MediaControllerRepeatState repeatState
    Current repeat state.

    Any change in value of repeatState will also change the value of repeatMode, except the REPEAT_ONE value. In this case the repeatMode value will not change.

    The repeatState equals to REPEAT_ALL is equivalent to repeatMode equals to true and repeatState equals to REPEAT_OFF is equivalent to repeatMode equals to false.

    Default value is REPEAT_ALL.

    Since: 5.5

  • readonly MediaControllerMetadata metadata
    Current playback metadata.

    Since: 5.0

  • readonly DOMString index [nullable]
    Current item index.

    Since: 5.5

    Remark: Null if no item currently in playback.

  • readonly DOMString playlistName [nullable]
    Current playlist name.

    Since: 5.5

    Remark: Null if no item currently in playback.

2.7. MediaControllerAbilities

Server-side object representing abilities of the media controller server.
  [NoInterfaceObject] interface MediaControllerAbilities {
    readonly attribute MediaControllerPlaybackAbilities playback;
    readonly attribute MediaControllerDisplayModeAbilities displayMode;
    readonly attribute MediaControllerDisplayRotationAbilities displayRotation;
    attribute MediaControllerAbilitySupport playbackPosition raises(WebAPIException);
    attribute MediaControllerAbilitySupport shuffle raises(WebAPIException);
    attribute MediaControllerAbilitySupport repeat raises(WebAPIException);
    attribute MediaControllerAbilitySupport playlist raises(WebAPIException);
    attribute MediaControllerAbilitySupport clientCustom raises(WebAPIException);
    attribute MediaControllerAbilitySupport search raises(WebAPIException);
    attribute MediaControllerAbilitySupport subtitles raises(WebAPIException);
    attribute MediaControllerAbilitySupport mode360 raises(WebAPIException);
  };

Since: 5.5

Attributes

  • readonly MediaControllerPlaybackAbilities playback
    Represents abilities of server's playback actions.

    Since: 5.5

  • readonly MediaControllerDisplayModeAbilities displayMode
    Represents abilities of server's display modes.

    Since: 5.5

  • readonly MediaControllerDisplayRotationAbilities displayRotation
    Represents display orientations supported by the media controller server.

    Since: 5.5

  • MediaControllerAbilitySupport playbackPosition
    Represents server's ability to change playback position.

    Default value is UNDECIDED.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.

      • with error type InvalidValuesError, if set value will be "UNDECIDED".

      • with error type UnknownError, if any other error occurs.

  • MediaControllerAbilitySupport shuffle
    Represents server's ability to change shuffle mode.

    Default value is UNDECIDED.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.

      • with error type InvalidValuesError, if set value will be "UNDECIDED".

      • with error type UnknownError, if any other error occurs.

  • MediaControllerAbilitySupport repeat
    Represents server's ability to change repeat state.

    Default value is UNDECIDED.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.

      • with error type InvalidValuesError, if set value will be "UNDECIDED".

      • with error type UnknownError, if any other error occurs.

  • MediaControllerAbilitySupport playlist
    Represents server's ability to add/change/remove playlists.

    Default value is UNDECIDED.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.

      • with error type InvalidValuesError, if set value will be "UNDECIDED".

      • with error type UnknownError, if any other error occurs.

  • MediaControllerAbilitySupport clientCustom
    Represents server's ability to receive custom commands from the media controller client.

    Default value is UNDECIDED.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.

      • with error type InvalidValuesError, if set value will be "UNDECIDED".

      • with error type UnknownError, if any other error occurs.

  • MediaControllerAbilitySupport search
    Represents server's ability to receive search requests from the media controller client.

    Default value is UNDECIDED.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.

      • with error type InvalidValuesError, if set value will be "UNDECIDED".

      • with error type UnknownError, if any other error occurs.

  • MediaControllerAbilitySupport subtitles
    Represents server's ability to receive requests for subtitles mode change from the media controller client.

    Default value is NO.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.

      • with error type InvalidValuesError, if set value will be "UNDECIDED".

      • with error type UnknownError, if any other error occurs.

  • MediaControllerAbilitySupport mode360
    Represents server's ability to receive requests for spherical (360°) mode change from the media controller client.

    Default value is NO.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.

      • with error type InvalidValuesError, if set value will be "UNDECIDED".

      • with error type UnknownError, if any other error occurs.

2.8. MediaControllerPlaybackAbilities

Server-side object representing playback abilities of the media controller server.
  [NoInterfaceObject] interface MediaControllerPlaybackAbilities {
    attribute MediaControllerAbilitySupport play raises(WebAPIException);
    attribute MediaControllerAbilitySupport pause raises(WebAPIException);
    attribute MediaControllerAbilitySupport stop raises(WebAPIException);
    attribute MediaControllerAbilitySupport next raises(WebAPIException);
    attribute MediaControllerAbilitySupport prev raises(WebAPIException);
    attribute MediaControllerAbilitySupport forward raises(WebAPIException);
    attribute MediaControllerAbilitySupport rewind raises(WebAPIException);
    attribute MediaControllerAbilitySupport togglePlayPause raises(WebAPIException);
    void saveAbilities() raises(WebAPIException);
  };

Since: 5.5

Remark: Calling saveAbilities() is required to update playback abilities on the media controller server.

Attributes

  • MediaControllerAbilitySupport play
    Represents server's ability to perform PLAY action.

    Default value is UNDECIDED.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.

      • with error type InvalidValuesError, if set value will be "UNDECIDED".

      • with error type UnknownError, if any other error occurs.

  • MediaControllerAbilitySupport pause
    Represents server's ability to perform PAUSE action.

    Default value is UNDECIDED.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.

      • with error type InvalidValuesError, if set value will be "UNDECIDED".

      • with error type UnknownError, if any other error occurs.

  • MediaControllerAbilitySupport stop
    Represents server's ability to perform STOP action.

    Default value is UNDECIDED.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.

      • with error type InvalidValuesError, if set value will be "UNDECIDED".

      • with error type UnknownError, if any other error occurs.

  • MediaControllerAbilitySupport next
    Represents server's ability to perform NEXT action.

    Default value is UNDECIDED.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.

      • with error type InvalidValuesError, if set value will be "UNDECIDED".

      • with error type UnknownError, if any other error occurs.

  • MediaControllerAbilitySupport prev
    Represents server's ability to perform PREV action.

    Default value is UNDECIDED.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.

      • with error type InvalidValuesError, if set value will be "UNDECIDED".

      • with error type UnknownError, if any other error occurs.

  • MediaControllerAbilitySupport forward
    Represents server's ability to perform FORWARD action.

    Default value is UNDECIDED.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.

      • with error type InvalidValuesError, if set value will be "UNDECIDED".

      • with error type UnknownError, if any other error occurs.

  • MediaControllerAbilitySupport rewind
    Represents server's ability to perform REWIND action.

    Default value is UNDECIDED.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.

      • with error type InvalidValuesError, if set value will be "UNDECIDED".

      • with error type UnknownError, if any other error occurs.

  • MediaControllerAbilitySupport togglePlayPause
    Represents server's ability to perform TOGGLE_PLAY_PAUSE action.

    Default value is UNDECIDED.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.

      • with error type InvalidValuesError, if set value will be "UNDECIDED".

      • with error type UnknownError, if any other error occurs.

Methods

saveAbilities
Saves the current state of playback abilities to the database.
void saveAbilities();

Since: 5.5

Remark: Using this function is required to save changes of playback abilities into database, otherwise changes will have no effect on the device and clients will not be notified about an update.

Exceptions:

  • WebAPIException
    • with error type UnknownError, if any error occurs.

Code example:

/* Server-side code */
var mcServer = tizen.mediacontroller.createServer();
mcServer.updatePlaybackState("PLAY");

mcServer.abilities.playback.next = "YES";
mcServer.abilities.playback.prev = "YES";
mcServer.abilities.playback.rewind = "NO";
mcServer.abilities.playback.forward = "NO";

/* Client-side code */
var mcClient = tizen.mediacontroller.getClient();
var mcServerInfo = mcClient.getLatestServerInfo();
console.log("Before save:");
console.log("ability NEXT: " + mcServerInfo.abilities.playback.next);
console.log("ability PREV: " + mcServerInfo.abilities.playback.prev);
console.log("ability REWIND: " + mcServerInfo.abilities.playback.rewind);
console.log("ability FORWARD: " + mcServerInfo.abilities.playback.forward);

/* Server-side code */
mcServer.abilities.playback.saveAbilities();

/* Client-side code */
mcServerInfo = mcClient.getLatestServerInfo();
console.log("After save:");
console.log("ability NEXT: " + mcServerInfo.abilities.playback.next);
console.log("ability PREV: " + mcServerInfo.abilities.playback.prev);
console.log("ability REWIND: " + mcServerInfo.abilities.playback.rewind);
console.log("ability FORWARD: " + mcServerInfo.abilities.playback.forward);

Output example:

Before save:
ability NEXT: UNDECIDED
ability PREV: UNDECIDED
ability REWIND: UNDECIDED
ability FORWARD: UNDECIDED
After save:
ability NEXT: YES
ability PREV: YES
ability REWIND: NO
ability FORWARD: NO

2.9. MediaControllerDisplayModeAbilities

Server-side object representing display mode abilities of the media controller server.
  [NoInterfaceObject] interface MediaControllerDisplayModeAbilities {
    attribute MediaControllerAbilitySupport letterBox raises(WebAPIException);
    attribute MediaControllerAbilitySupport originSize raises(WebAPIException);
    attribute MediaControllerAbilitySupport fullScreen raises(WebAPIException);
    attribute MediaControllerAbilitySupport croppedFull raises(WebAPIException);
  };

Since: 5.5

Attributes

  • MediaControllerAbilitySupport letterBox
    Represents server's ability to set letterBox mode.

    Default value is NO.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.

      • with error type InvalidValuesError, if set value will be "UNDECIDED".

      • with error type UnknownError, if any other error occurs.

  • MediaControllerAbilitySupport originSize
    Represents server's ability to set originSize mode.

    Default value is NO.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.

      • with error type InvalidValuesError, if set value will be "UNDECIDED".

      • with error type UnknownError, if any other error occurs.

  • MediaControllerAbilitySupport fullScreen
    Represents server's ability to set fullScreen mode.

    Default value is NO.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.

      • with error type InvalidValuesError, if set value will be "UNDECIDED".

      • with error type UnknownError, if any other error occurs.

  • MediaControllerAbilitySupport croppedFull
    Represents server's ability to set croppedFull mode.

    Default value is NO.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.

      • with error type InvalidValuesError, if set value will be "UNDECIDED".

      • with error type UnknownError, if any other error occurs.

2.10. MediaControllerDisplayRotationAbilities

The server-side object representing display rotation abilities of the media controller server.
  [NoInterfaceObject] interface MediaControllerDisplayRotationAbilities {
    attribute MediaControllerAbilitySupport rotationNone raises(WebAPIException);
    attribute MediaControllerAbilitySupport rotation90 raises(WebAPIException);
    attribute MediaControllerAbilitySupport rotation180 raises(WebAPIException);
    attribute MediaControllerAbilitySupport rotation270 raises(WebAPIException);
  };

Since: 5.5

Attributes

  • MediaControllerAbilitySupport rotationNone
    Represents the server's ability to set 0° display orientation.

    Default value is NO.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.

      • with error type InvalidValuesError, if set value will be "UNDECIDED".

      • with error type UnknownError, if any other error occurs.

  • MediaControllerAbilitySupport rotation90
    Represents the server's ability to set 90° display orientation.

    Default value is NO.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.

      • with error type InvalidValuesError, if set value will be "UNDECIDED".

      • with error type UnknownError, if any other error occurs.

  • MediaControllerAbilitySupport rotation180
    Represents the server's ability to set 180° display orientation.

    Default value is NO.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.

      • with error type InvalidValuesError, if set value will be "UNDECIDED".

      • with error type UnknownError, if any other error occurs.

  • MediaControllerAbilitySupport rotation270
    Represents the server's ability to set 270° display orientation.

    Default value is NO.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type TypeMismatchError, if set value will not be compatible with MediaControllerAbilitySupport enum.

      • with error type InvalidValuesError, if set value will be "UNDECIDED".

      • with error type UnknownError, if any other error occurs.

2.11. MediaControllerAbilitiesInfo

Client-side object representing abilities of the media controller server.
  [NoInterfaceObject] interface MediaControllerAbilitiesInfo {
    readonly attribute MediaControllerPlaybackAbilitiesInfo playback;
    readonly attribute MediaControllerDisplayModeAbilitiesInfo displayMode;
    readonly attribute MediaControllerDisplayRotationAbilitiesInfo displayRotation;
    readonly attribute MediaControllerAbilitySupport playbackPosition raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport shuffle raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport repeat raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport playlist raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport clientCustom raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport search raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport subtitles raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport mode360 raises(WebAPIException);
    void subscribe() raises(WebAPIException);
    void unsubscribe() raises(WebAPIException);
  };

Since: 5.5

Attributes

  • readonly MediaControllerPlaybackAbilitiesInfo playback
    Represents abilities of server's playback actions.

    Since: 5.5

  • readonly MediaControllerDisplayModeAbilitiesInfo displayMode
    Represents abilities of server's display modes.

    Since: 5.5

  • readonly MediaControllerDisplayRotationAbilitiesInfo displayRotation
    Represents server abilities of setting display orientations.

    Since: 5.5

  • readonly MediaControllerAbilitySupport playbackPosition
    Represents server's ability to change playback position.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type UnknownError, if any error occurs.

  • readonly MediaControllerAbilitySupport shuffle
    Represents server's ability to change shuffle mode.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type UnknownError, if any error occurs.

  • readonly MediaControllerAbilitySupport repeat
    Represents server's ability to change repeat state.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type UnknownError, if any error occurs.

  • readonly MediaControllerAbilitySupport playlist
    Represents server's ability to add/change/remove playlists.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type UnknownError, if any error occurs.

  • readonly MediaControllerAbilitySupport clientCustom
    Represents server's ability to receive custom commands from media controller client.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type UnknownError, if any error occurs.

  • readonly MediaControllerAbilitySupport search
    Represents server's ability to receive search requests from media controller client.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type UnknownError, if any error occurs.

  • readonly MediaControllerAbilitySupport subtitles
    Represents server's ability to receive requests for subtitles mode change from media controller client.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type UnknownError, if any error occurs.

  • readonly MediaControllerAbilitySupport mode360
    Represents server's ability to receive requests for spherical (360°) mode change from media controller client.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type UnknownError, if any error occurs.

Methods

subscribe
Adds a subscription for monitoring status of all abilities of server represented by this object.
void subscribe();

Since: 5.5

Remark: Function addAbilityChangeListener() must be called before current method. For code example see unsubscribe().

Exceptions:

  • WebAPIException
    • with error type InvalidStateError, if addAbilityChangeListener() is not set.

    • with error type UnknownError, if any other error occurs.

unsubscribe
Removes a subscription for monitoring status of all abilities of server represented by this object.
void unsubscribe();

Since: 5.5

Exceptions:

  • WebAPIException
    • with error type UnknownError, if any error occurs.

Code example:

/* Code example uses two applications: */
/* XX8qUW5iDD.FirstMCServer - both server and client app */
/* GC8qUW5iQf.SecondMCServer - only server app */

/* APP XX8qUW5iDD.FirstMCServer */
var mcServer = tizen.mediacontroller.createServer();
mcServer.updatePlaybackState("PLAY");
var mcClient = tizen.mediacontroller.getClient();
var mcServerInfo = mcClient.getLatestServerInfo();

var listener =
{
  onsimpleabilitychanged: function(server, type, ability)
  {
    console.log(type + " ability changed, server name: " + server.name + ", ability: " + ability);
  }
};

var watchId = mcClient.addAbilityChangeListener(listener);
console.log("#### All events would be handled by listener ####");
mcServer.abilities.shuffle = "YES";  /* triggers listener */

/* APP GC8qUW5iQf.SecondMCServer */
var server2 = tizen.mediacontroller.createServer();
server2.abilities.repeat = "NO";  /* triggers listener */

/* APP XX8qUW5iDD.FirstMCServer */
console.log("#### Subscribe only changes from XX8qUW5iDD.FirstMCServer ####");
mcServerInfo.abilities.subscribe();
mcServer.abilities.shuffle = "NO";  /* triggers listener */

/* APP GC8qUW5iQf.SecondMCServer */
server2.abilities.repeat = "YES";  /* does NOT trigger listener */

/* APP XX8qUW5iDD.FirstMCServer */
console.log("#### Handle all events again ####");
mcServerInfo.abilities.unsubscribe();
mcServer.abilities.shuffle = "YES";  /* triggers listener */

/* APP GC8qUW5iQf.SecondMCServer */
server2.abilities.repeat = "NO";  /* triggers listener */

Output example:

#### All events would be handled by listener ####
SHUFFLE ability changed, server name: XX8qUW5iDD.FirstMCServer, ability: "YES"
REPEAT ability changed, server name: GC8qUW5iQf.SecondMCServer, ability: "NO"
#### Subscribe only changes from XX8qUW5iDD.FirstMCServer ####
SHUFFLE ability changed, server name: XX8qUW5iDD.FirstMCServer, ability: "NO"
#### Handle all events again ####
SHUFFLE ability changed, server name: XX8qUW5iDD.FirstMCServer, ability: "YES"
REPEAT ability changed, server name: GC8qUW5iQf.SecondMCServer, ability: "NO"

2.12. MediaControllerPlaybackAbilitiesInfo

Client-side object representing playback abilities of the media controller server.
  [NoInterfaceObject] interface MediaControllerPlaybackAbilitiesInfo {
    readonly attribute MediaControllerAbilitySupport play raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport pause raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport stop raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport next raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport prev raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport forward raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport rewind raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport togglePlayPause raises(WebAPIException);
  };

Since: 5.5

Attributes

  • readonly MediaControllerAbilitySupport play
    Represents server's ability to perform PLAY action.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type UnknownError, if any error occurs.

  • readonly MediaControllerAbilitySupport pause
    Represents server's ability to perform PAUSE action.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type UnknownError, if any error occurs.

  • readonly MediaControllerAbilitySupport stop
    Represents server's ability to perform STOP action.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type UnknownError, if any error occurs.

  • readonly MediaControllerAbilitySupport next
    Represents server's ability to perform NEXT action.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type UnknownError, if any error occurs.

  • readonly MediaControllerAbilitySupport prev
    Represents server's ability to perform PREV action.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type UnknownError, if any error occurs.

  • readonly MediaControllerAbilitySupport forward
    Represents server's ability to perform FORWARD action.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type UnknownError, if any error occurs.

  • readonly MediaControllerAbilitySupport rewind
    Represents server's ability to perform REWIND action.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type UnknownError, if any error occurs.

  • readonly MediaControllerAbilitySupport togglePlayPause
    Represents server's ability to perform TOGGLE_PLAY_PAUSE action.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type UnknownError, if any error occurs.

2.13. MediaControllerDisplayModeAbilitiesInfo

Client-side object representing display mode abilities of the media controller server.
  [NoInterfaceObject] interface MediaControllerDisplayModeAbilitiesInfo {
    readonly attribute MediaControllerAbilitySupport letterBox raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport originSize raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport fullScreen raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport croppedFull raises(WebAPIException);
  };

Since: 5.5

Attributes

  • readonly MediaControllerAbilitySupport letterBox
    Represents server's ability to set letterBox mode.

    Default value is NO.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type UnknownError, if any other error occurs.

  • readonly MediaControllerAbilitySupport originSize
    Represents server's ability to set originSize mode.

    Default value is NO.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type UnknownError, if any other error occurs.

  • readonly MediaControllerAbilitySupport fullScreen
    Represents server's ability to set fullScreen mode.

    Default value is NO.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type UnknownError, if any other error occurs.

  • readonly MediaControllerAbilitySupport croppedFull
    Represents server's ability to set croppedFull mode.

    Default value is NO.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type UnknownError, if any other error occurs.

2.14. MediaControllerDisplayRotationAbilitiesInfo

The client-side object representing display rotation abilities of the media controller server.
  [NoInterfaceObject] interface MediaControllerDisplayRotationAbilitiesInfo {
    readonly attribute MediaControllerAbilitySupport rotationNone raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport rotation90 raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport rotation180 raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport rotation270 raises(WebAPIException);
  };

Since: 5.5

Attributes

  • readonly MediaControllerAbilitySupport rotationNone
    Represents the server's ability to set 0° display orientation.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type UnknownError, if any error occurs.

  • readonly MediaControllerAbilitySupport rotation90
    Represents the server's ability to set 90° display orientation.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type UnknownError, if any error occurs.

  • readonly MediaControllerAbilitySupport rotation180
    Represents the server's ability to set 180° display orientation.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type UnknownError, if any error occurs.

  • readonly MediaControllerAbilitySupport rotation270
    Represents the server's ability to set 270° display orientation.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type UnknownError, if any error occurs.

2.15. MediaControllerSubtitles

Server-side object representing subtitles mode of a media controller server.
  [NoInterfaceObject] interface MediaControllerSubtitles {
    attribute boolean enabled raises(WebAPIException);
    long addChangeRequestListener(MediaControllerEnabledChangeRequestCallback listener) raises(WebAPIException);
    void removeChangeRequestListener(long watchId) raises(WebAPIException);
  };

Since: 5.5

Attributes

  • boolean enabled
    State of subtitles mode on the server. Default value for a newly created server is false.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type UnknownError, if any error occurs.

Methods

addChangeRequestListener
Adds the listener for change requests of a media controller subtitles mode.
long addChangeRequestListener(MediaControllerEnabledChangeRequestCallback listener);

Since: 5.5

Remark: Remember to set corresponding server's MediaControllerAbilities.subtitles ability to "YES" to let clients send change requests to the server.

Parameters:

  • listener: Change request listener to add.

Return value:

    long: The identifier used to remove the listener.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type UnknownError, if any other error occurs.

Code example:

var watcherId = 0;  /* Watcher identifier. */
var mcServer = tizen.mediacontroller.createServer();

var changeListener = function(clientName, enabled)
{
  console.log("Subtitles mode change requested to: " + enabled + " by " + clientName);
  var result = false;
  /* do some action here and return according to the result */
  if (!result)
  {
    return new tizen.mediacontroller.RequestReply(
        new tizen.Bundle({"message": "Error - Not allowed"}), 13);
  }
  return new tizen.mediacontroller.RequestReply(new tizen.Bundle({"message": "Success"}), 0);
};

/* Registers to subtitles mode change requests from client. */
watcherId = mcServer.subtitles.addChangeRequestListener(changeListener);
removeChangeRequestListener
Removes the listener and stops receiving change requests of media controller subtitles mode.
void removeChangeRequestListener(long watchId);

Since: 5.5

Calling this function has no effect if there is no listener with given id.

Parameters:

  • watchId: Watcher identifier.

Exceptions:

  • WebAPIException
    • with error type UnknownError, if any error occurs.

Code example:

var watcherId = 0;  /* Watcher identifier. */
var mcServer = tizen.mediacontroller.createServer();

var changeListener = function(clientName, enabled)
{
  console.log("Subtitles mode change requested to: " + enabled + " by " + clientName);
  return new tizen.mediacontroller.RequestReply(new tizen.Bundle({"message": "Success"}), 0);
};

/* Registers to receive subtitles mode change requests from clients. */
watcherId = mcServer.subtitles.addChangeRequestListener(changeListener);

/* Cancels the watch operation. */
mcServer.subtitles.removeChangeRequestListener(watcherId);

2.16. MediaControllerSubtitlesInfo

Client-side object representing subtitles mode of a media controller server.
  [NoInterfaceObject] interface MediaControllerSubtitlesInfo {
    readonly attribute boolean enabled raises(WebAPIException);
    void sendRequest(boolean enabled, MediaControllerSendCommandSuccessCallback replyCallback) raises(WebAPIException);
    long addModeChangeListener(MediaControllerEnabledChangeCallback listener) raises(WebAPIException);
    void removeModeChangeListener(long watchId) raises(WebAPIException);
  };

Since: 5.5

Attributes

  • readonly boolean enabled
    State of subtitles mode on the server represented by this object.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type UnknownError, if any error occurs.

Methods

sendRequest
Allows to send change requests for subtitles mode to media controller server.
void sendRequest(boolean enabled, MediaControllerSendCommandSuccessCallback replyCallback);

Since: 5.5

Remark: See addChangeRequestListener() method to check how to receive and respond to commands.

Parameters:

  • enabled: State which is requested by a media controller client.
  • replyCallback: The method to invoke when server responded to change request.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type NotSupportedError, if related ability is not supported by the media controller server.

    • with error type UnknownError, if any other error occurs.

Code example:

var mcClient = tizen.mediacontroller.getClient();
var mcServerInfo = mcClient.getLatestServerInfo();

var enabled = true;
mcServerInfo.subtitles.sendRequest(enabled, function(data, code)
{
  console.log("Server replied with return data: " + JSON.stringify(data) + " and code: " + code);
});
addModeChangeListener
Adds the listener for changes of a media controller subtitles mode of a media controller server.
long addModeChangeListener(MediaControllerEnabledChangeCallback listener);

Since: 5.5

Parameters:

  • listener: Subtitles mode change listener to add.

Return value:

    long: The identifier used to clear the watch subscription.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type UnknownError, if any other error occurs.

Code example:

var watcherId = 0;  /* Watcher identifier. */
var mcClient = tizen.mediacontroller.getClient();
var mcServerInfo = mcClient.getLatestServerInfo();

/* Registers to be notified when subtitles mode changes. */
watcherId = mcServerInfo.subtitles.addModeChangeListener(function(enabled)
{
  console.log(mcServerInfo.name + " server subtitles mode changed to " + enabled);
});
removeModeChangeListener
Removes the listener, so stop receiving notifications about media controller server subtitles mode changes.
void removeModeChangeListener(long watchId);

Since: 5.5

Calling this function has no effect if there is no listener with given id.

Parameters:

  • watchId: Watcher identifier.

Exceptions:

  • WebAPIException
    • with error type UnknownError, if any error occurs.

Code example:

var watcherId = 0;  /* Watcher identifier. */
var mcClient = tizen.mediacontroller.getClient();
var mcServerInfo = mcClient.getLatestServerInfo();

/* Registers to be notified when subtitles mode changes. */
watcherId = mcServerInfo.subtitles.addModeChangeListener(function(enabled)
{
  console.log(mcServerInfo.name + " server subtitles mode changed to " + enabled);
});

/* Cancels the watch operation. */
mcServerInfo.subtitles.removeModeChangeListener(watcherId);

2.17. MediaControllerMode360

Server-side object representing spherical (360°) mode of a media controller server.
  [NoInterfaceObject] interface MediaControllerMode360 {
    attribute boolean enabled raises(WebAPIException);
    long addChangeRequestListener(MediaControllerEnabledChangeRequestCallback listener) raises(WebAPIException);
    void removeChangeRequestListener(long watchId) raises(WebAPIException);
  };

Since: 5.5

Attributes

  • boolean enabled
    State of spherical (360°) mode on the server. Default value for a newly created server is false.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type UnknownError, if any error occurs.

Methods

addChangeRequestListener
Adds the listener for change requests of a media controller spherical (360°) mode.
long addChangeRequestListener(MediaControllerEnabledChangeRequestCallback listener);

Since: 5.5

Remark: Remember to set corresponding server's MediaControllerAbilities.mode360 ability to "YES" to let clients send change requests to the server.

Parameters:

  • listener: Change request listener to add.

Return value:

    long: The identifier used to remove the listener.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type UnknownError, if any other error occurs.

Code example:

var watcherId = 0;  /* Watcher identifier. */
var mcServer = tizen.mediacontroller.createServer();

var changeListener = function(clientName, enabled)
{
  console.log("Spherical mode change requested to: " + enabled + " by " + clientName);
  var result = false;
  /* do some action here and return according to the result */
  if (!result)
  {
    return new tizen.mediacontroller.RequestReply(
        new tizen.Bundle({"message": "Error - Not allowed"}), 13);
  }
  return new tizen.mediacontroller.RequestReply(new tizen.Bundle({"message": "Success"}), 0);
};

/* Registers to receive spherical mode change requests from clients. */
watcherId = mcServer.mode360.addChangeRequestListener(changeListener);
removeChangeRequestListener
Removes the listener and stops receiving change requests of media controller spherical (360°) mode.
void removeChangeRequestListener(long watchId);

Since: 5.5

Calling this function has no effect if there is no listener with given id.

Parameters:

  • watchId: Watcher identifier.

Exceptions:

  • WebAPIException
    • with error type UnknownError, if any error occurs.

Code example:

var watcherId = 0;  /* Watcher identifier. */
var mcServer = tizen.mediacontroller.createServer();

var changeListener = function(clientName, enabled)
{
  console.log("Spherical mode change requested to: " + enabled + " by " + clientName);
  return new tizen.mediacontroller.RequestReply(new tizen.Bundle({"message": "Success"}), 0);
};

/* Registers to receive spherical mode change requests from clients. */
watcherId = mcServer.mode360.addChangeRequestListener(changeListener);

/* Cancels the watch operation. */
mcServer.mode360.removeChangeRequestListener(watcherId);

2.18. MediaControllerMode360Info

Client-side object representing spherical (360°) mode of a media controller server.
  [NoInterfaceObject] interface MediaControllerMode360Info {
    readonly attribute boolean enabled raises(WebAPIException);
    void sendRequest(boolean enabled, MediaControllerSendCommandSuccessCallback replyCallback) raises(WebAPIException);
    long addModeChangeListener(MediaControllerEnabledChangeCallback listener) raises(WebAPIException);
    void removeModeChangeListener(long watchId) raises(WebAPIException);
  };

Since: 5.5

Attributes

  • readonly boolean enabled
    State of spherical (360°) mode on the server represented by this object.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type UnknownError, if any error occurs.

Methods

sendRequest
Allows to send change requests for spherical (360°) mode to media controller server.
void sendRequest(boolean enabled, MediaControllerSendCommandSuccessCallback replyCallback);

Since: 5.5

Remark: See addChangeRequestListener() method to check how to receive and respond to commands.

Parameters:

  • enabled: State which is requested by a media controller client.
  • replyCallback: The method to invoke when server responded to change request.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type NotSupportedError, if related ability is not supported by the media controller server.

    • with error type UnknownError, if any other error occurs.

Code example:

var mcClient = tizen.mediacontroller.getClient();
var mcServerInfo = mcClient.getLatestServerInfo();

var enabled = true;
mcServerInfo.mode360.sendRequest(enabled, function(data, code)
{
  console.log("Server replied with return data: " + JSON.stringify(data) + " and code: " + code);
});
addModeChangeListener
Adds the listener for changes of a media controller spherical (360°) mode of a media controller server.
long addModeChangeListener(MediaControllerEnabledChangeCallback listener);

Since: 5.5

Parameters:

  • listener: Spherical (360°) mode change listener to add.

Return value:

    long: The identifier used to clear the watch subscription.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type UnknownError, if any other error occurs.

Code example:

var watcherId = 0;  /* Watcher identifier. */
var mcClient = tizen.mediacontroller.getClient();
var mcServerInfo = mcClient.getLatestServerInfo();

/* Registers to be notified when spherical mode changes. */
watcherId = mcServerInfo.mode360.addModeChangeListener(function(enabled)
{
  console.log(mcServerInfo.name + " server spherical mode changed to " + enabled);
});
removeModeChangeListener
Removes the listener, so stop receiving notifications about media controller server spherical (360°) mode changes.
void removeModeChangeListener(long watchId);

Since: 5.5

Calling this function has no effect if there is no listener with given id.

Parameters:

  • watchId: Watcher identifier.

Exceptions:

  • WebAPIException
    • with error type UnknownError, if any error occurs.

Code example:

var watcherId = 0;  /* Watcher identifier. */
var mcClient = tizen.mediacontroller.getClient();
var mcServerInfo = mcClient.getLatestServerInfo();

/* Registers to be notified when spherical mode changes. */
watcherId = mcServerInfo.mode360.addModeChangeListener(function(enabled)
{
  console.log(mcServerInfo.name + " server spherical mode changed to " + enabled);
});

/* Cancels the watch operation. */
mcServerInfo.mode360.removeModeChangeListener(watcherId);

2.19. MediaControllerDisplayMode

Server-side object representing display mode of a media controller server.
  [NoInterfaceObject] interface MediaControllerDisplayMode {
    attribute MediaControllerDisplayModeType type raises(WebAPIException);
    long addChangeRequestListener(MediaControllerDisplayModeChangeRequestCallback listener) raises(WebAPIException);
    void removeChangeRequestListener(long watchId) raises(WebAPIException);
  };

Since: 5.5

Attributes

  • MediaControllerDisplayModeType type
    Type of display mode on the server. Default value for a newly created server is "FULL_SCREEN".

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type TypeMismatchError, if an input parameter is not compatible with the expected type for that parameter.

      • with error type UnknownError, if any other error occurs.

Methods

addChangeRequestListener
Adds the listener for change requests of the media controller display mode.
long addChangeRequestListener(MediaControllerDisplayModeChangeRequestCallback listener);

Since: 5.5

Remark: Remember to set corresponding server's display mode ability to "YES" to let clients send change requests to the server.

Parameters:

  • listener: Change request listener to add.

Return value:

    long: The identifier used to remove the listener.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type UnknownError, if any other error occurs.

Code example:

var watcherId = 0;  /* Watcher identifier. */
var mcServer = tizen.mediacontroller.createServer();

var changeListener = function(clientName, type)
{
  console.log("Display mode change requested to: " + type + " by " + clientName);
  var result = false;
  /* do some action here and return according to the result */
  if (!result)
  {
    return new tizen.mediacontroller.RequestReply(
        new tizen.Bundle({"message": "Error - Not allowed"}), 13);
  }
  return new tizen.mediacontroller.RequestReply(new tizen.Bundle({"message": "Success"}), 0);
};

/* Registers to receive display mode change requests from clients. */
watcherId = mcServer.displayMode.addChangeRequestListener(changeListener);
removeChangeRequestListener
Removes the listener and stops receiving change requests of media controller display mode.
void removeChangeRequestListener(long watchId);

Since: 5.5

Calling this function has no effect if there is no listener with given id.

Parameters:

  • watchId: Watcher identifier.

Exceptions:

  • WebAPIException
    • with error type UnknownError, if any error occurs.

Code example:

var watcherId = 0;  /* Watcher identifier. */
var mcServer = tizen.mediacontroller.createServer();

var changeListener = function(clientName, type)
{
  console.log("Display mode change requested to: " + type + " by " + clientName);
};

/* Registers to receive display mode change requests from clients. */
watcherId = mcServer.displayMode.addChangeRequestListener(changeListener);

/* Cancels the watch operation. */
mcServer.displayMode.removeChangeRequestListener(watcherId);

2.20. MediaControllerDisplayModeInfo

Client-side object representing display mode of a media controller server.
  [NoInterfaceObject] interface MediaControllerDisplayModeInfo {
    readonly attribute MediaControllerDisplayModeType type raises(WebAPIException);
    void sendRequest(MediaControllerDisplayModeType type, MediaControllerSendCommandSuccessCallback replyCallback)
                     raises(WebAPIException);
    long addModeChangeListener(MediaControllerDisplayModeChangeCallback listener) raises(WebAPIException);
    void removeModeChangeListener(long watchId) raises(WebAPIException);
  };

Since: 5.5

Attributes

  • readonly MediaControllerDisplayModeType type
    Type of display mode on the server represented by this object.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type UnknownError, if any error occurs.

Methods

sendRequest
Allows to send change requests for display mode to media controller server.

Since: 5.5

Remark: See addChangeRequestListener() method to check how to receive and respond to commands.

Parameters:

  • type: Type of display mode, which is requested by a media controller client.
  • replyCallback: The method to invoke when server responded to change request.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type NotSupportedError, if related ability is not supported by the media controller server.

    • with error type UnknownError, if any other error occurs.

Code example:

var mcClient = tizen.mediacontroller.getClient();
var mcServerInfo = mcClient.getLatestServerInfo();

var type = "CROPPED_FULL";
mcServerInfo.displayMode.sendRequest(type, function(data, code)
{
  console.log("Server replied with return data: " + JSON.stringify(data) + " and code: " + code);
});
addModeChangeListener
Adds the listener for changes of a media controller display mode of a media controller server.
long addModeChangeListener(MediaControllerDisplayModeChangeCallback listener);

Since: 5.5

Parameters:

  • listener: Display mode change listener to add.

Return value:

    long: The identifier used to clear the watch subscription.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type UnknownError, if any other error occurs.

Code example:

var watcherId = 0;  /* Watcher identifier. */
var mcClient = tizen.mediacontroller.getClient();
var mcServerInfo = mcClient.getLatestServerInfo();

/* Registers to be notified when display mode changes. */
watcherId = mcServerInfo.displayMode.addModeChangeListener(function(mode)
{
  console.log(mcServerInfo.name + " server display mode changed to " + mode);
});
removeModeChangeListener
Removes the listener, so stop receiving notifications about media controller server display mode changes.
void removeModeChangeListener(long watchId);

Since: 5.5

Calling this function has no effect if there is no listener with given id.

Parameters:

  • watchId: Watcher identifier.

Exceptions:

  • WebAPIException
    • with error type UnknownError, if any error occurs.

Code example:

var watcherId = 0;  /* Watcher identifier. */
var mcClient = tizen.mediacontroller.getClient();
var mcServerInfo = mcClient.getLatestServerInfo();

/* Registers to be notified when display mode changes. */
watcherId = mcServerInfo.displayMode.addModeChangeListener(function(mode)
{
  console.log(mcServerInfo.name + " server display mode changed to " + mode);
});

/* Cancels the watch operation. */
mcServerInfo.displayMode.removeModeChangeListener(watcherId);

2.21. MediaControllerDisplayRotation

Server-side object representing display rotation of a media controller server.
  [NoInterfaceObject] interface MediaControllerDisplayRotation {
    attribute MediaControllerDisplayRotationType displayRotation raises(WebAPIException);
    long addChangeRequestListener(MediaControllerDisplayRotationChangeRequestCallback listener) raises(WebAPIException);
    void removeChangeRequestListener(long watchId) raises(WebAPIException);
  };

Since: 5.5

Attributes

  • MediaControllerDisplayRotationType displayRotation
    State of display rotation on the server. Default value for a newly created server is "ROTATION_NONE".

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type TypeMismatchError, if an input parameter is not compatible with the expected type for that parameter.

      • with error type UnknownError, if any other error occurs.

Methods

addChangeRequestListener
Adds the listener for change requests of a media controller display rotation.
long addChangeRequestListener(MediaControllerDisplayRotationChangeRequestCallback listener);

Since: 5.5

Remark: Remember to set corresponding server's display rotation ability to "YES" to let clients send change requests to the server.

Parameters:

  • listener: Change request listener to add.

Return value:

    long: The identifier used to remove the listener.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type UnknownError, if any other error occurs.

Code example:

var watcherId = 0;  /* Watcher identifier. */
var mcServer = tizen.mediacontroller.createServer();

var changeListener = function(clientName, rotation)
{
  console.log("Display rotation change requested to: " + rotation + " by " + clientName);
  var result = false;
  /* do some action here and return according to the result */
  if (!result)
  {
    return new tizen.mediacontroller.RequestReply(
        new tizen.Bundle({"message": "Error - Not allowed"}), 13);
  }
  return new tizen.mediacontroller.RequestReply(new tizen.Bundle({"message": "Success"}), 0);
};

/* Registers to receive display rotation change requests from clients. */
watcherId = mcServer.displayRotation.addChangeRequestListener(changeListener);
removeChangeRequestListener
Removes the listener and stops receiving change requests of media controller display rotation.
void removeChangeRequestListener(long watchId);

Since: 5.5

Calling this function has no effect if there is no listener with given id.

Parameters:

  • watchId: Watcher identifier.

Exceptions:

  • WebAPIException
    • with error type UnknownError, if any error occurs.

Code example:

var watcherId = 0;  /* Watcher identifier. */
var mcServer = tizen.mediacontroller.createServer();

var changeListener = function(clientName, rotation)
{
  console.log("Display rotation change requested to: " + rotation + " by " + clientName);
  return new tizen.mediacontroller.RequestReply(new tizen.Bundle({"message": "Success"}), 0);
};

/* Registers to receive display rotation change requests from clients. */
watcherId = mcServer.displayRotation.addChangeRequestListener(changeListener);

/* Cancels the watch operation. */
mcServer.displayRotation.removeChangeRequestListener(watcherId);

2.22. MediaControllerClientInfo

This interface provides communication methods from the server to the client.
  [NoInterfaceObject] interface MediaControllerClientInfo {
    readonly attribute ApplicationId name;
    void sendEvent(DOMString eventName, Bundle? data, MediaControllerSendCommandSuccessCallback successCallback)
                   raises(WebAPIException);
  };

Since: 5.5

Attributes

  • readonly ApplicationId name
    Id of the client application.

    Since: 5.5

Methods

sendEvent
Sends an event to the client.
void sendEvent(DOMString eventName, Bundle? data, MediaControllerSendCommandSuccessCallback successCallback);

Since: 5.5

Parameters:

  • eventName: Name of the event.
  • data [nullable]: Additional event data.
  • successCallback: Reply handling function.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any argument has invalid type.

    • with error type UnknownError, if any other error occurs.

Code example:

/* CLIENT APPLICATION */
var mcClient = tizen.mediacontroller.getClient();
mcClient.setCustomEventListener(function(serverName, eventName, data)
{
  console.log("Media controller client received an event from the server:");
  console.log("  name: " + eventName);
  console.log("  data: " + JSON.stringify(data));
  mcClient.unsetCustomEventListener();
  return new tizen.mediacontroller.RequestReply({response: "response data"}, 123);
});

/* SERVER APPLICATION */
var mcServer = tizen.mediacontroller.createServer();
mcServer.updatePlaybackState("PLAY");

var mcClientsInfoAll = mcServer.getAllClientsInfo();
if (mcClientsInfoAll.length < 1)
{
  console.log("Server has no active clients.");
}
else
{
  mcClientsInfoAll[0].sendEvent(
      "test", new tizen.Bundle({param1: "value1", param2: "value2"}), function(response)
      {
        console.log("Media controller server received a reply to the event:");
        console.log("  response: " + JSON.stringify(response));
      });
}

Output example:

Media controller client received an event from the server:
  name: test
  data: '{param1: "value1", param2: "value2"}'
Media controller server received a reply to the event:
  response: '{data: {response: "response data"}, code: 123}'

2.23. MediaControllerDisplayRotationInfo

Client-side object representing display rotation of a media controller server.
  [NoInterfaceObject] interface MediaControllerDisplayRotationInfo {
    readonly attribute MediaControllerDisplayRotationType displayRotation raises(WebAPIException);
    void sendRequest(MediaControllerDisplayRotationType displayRotation, MediaControllerSendCommandSuccessCallback replyCallback)
                     raises(WebAPIException);
    long addDisplayRotationChangeListener(MediaControllerDisplayRotationChangeCallback listener) raises(WebAPIException);
    void removeDisplayRotationChangeListener(long watchId) raises(WebAPIException);
  };

Since: 5.5

Attributes

  • readonly MediaControllerDisplayRotationType displayRotation
    State of display rotation on the server represented by this object.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type UnknownError, if any error occurs.

Methods

sendRequest
Allows to send change requests for display rotation change to a media controller server.
void sendRequest(MediaControllerDisplayRotationType displayRotation, MediaControllerSendCommandSuccessCallback replyCallback);

Since: 5.5

Remark: See addChangeRequestListener() method to check how to receive and respond to commands.

Parameters:

  • displayRotation: Display rotation, which is requested by client.
  • replyCallback: The method to invoke when server responded to change request.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type NotSupportedError, if related ability is not supported by server.

    • with error type UnknownError, if any other error occurs.

Code example:

var mcClient = tizen.mediacontroller.getClient();
var mcServerInfo = mcClient.getLatestServerInfo();

var rotation = "ROTATION_180";
mcServerInfo.displayRotation.sendRequest(rotation, function(data, code)
{
  console.log("Server replied with return data: " + JSON.stringify(data) + " and code: " + code);
});
addDisplayRotationChangeListener
Adds the listener for changes of a display rotation of a media controller server.
long addDisplayRotationChangeListener(MediaControllerDisplayRotationChangeCallback listener);

Since: 5.5

Parameters:

  • listener: Display rotation change listener to add.

Return value:

    long: The identifier used to clear the watch subscription.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type UnknownError, if any other error occurs.

Code example:

var watcherId = 0;  /* Watcher identifier. */
var mcClient = tizen.mediacontroller.getClient();
var mcServerInfo = mcClient.getLatestServerInfo();

/* Registers to be notified when display rotation changes. */
watcherId = mcServerInfo.displayRotation.addDisplayRotationChangeListener(function(rotation)
{
  console.log(mcServerInfo.name + " server display rotation changed to " + rotation);
});
removeDisplayRotationChangeListener
Removes the listener, so stop receiving notifications about media controller server display rotation changes.
void removeDisplayRotationChangeListener(long watchId);

Since: 5.5

Calling this function has no effect if there is no listener with given id.

Parameters:

  • watchId: Watcher identifier.

Exceptions:

  • WebAPIException
    • with error type UnknownError, if any error occurs.

Code example:

var watcherId = 0;  /* Watcher identifier. */
var mcClient = tizen.mediacontroller.getClient();
var mcServerInfo = mcClient.getLatestServerInfo();

/* Registers to be notified when display rotation changes. */
watcherId = mcServerInfo.displayRotation.addDisplayRotationChangeListener(function(rotation)
{
  console.log(mcServerInfo.name + " server display rotation changed to " + rotation);
});

/* Cancels the watch operation. */
mcServerInfo.displayRotation.removeDisplayRotationChangeListener(watcherId);

2.24. MediaControllerMetadata

Playback metadata.
  [NoInterfaceObject] interface MediaControllerMetadata {
    attribute DOMString title;
    attribute DOMString artist;
    attribute DOMString album;
    attribute DOMString author;
    attribute DOMString genre;
    attribute DOMString duration;
    attribute DOMString date;
    attribute DOMString copyright;
    attribute DOMString description;
    attribute DOMString trackNum;
    attribute DOMString picture;
    attribute long seasonNumber;
    attribute DOMString? seasonTitle;
    attribute long episodeNumber;
    attribute DOMString? episodeTitle;
    attribute long resolutionWidth;
    attribute long resolutionHeight;
  };

Since: 5.0

Attributes

  • DOMString title
    Media title.

    Since: 5.0

  • DOMString artist
    Media artist.

    Since: 5.0

  • DOMString album
    Media album.

    Since: 5.0

  • DOMString author
    Media author.

    Since: 5.0

  • DOMString genre
    Media genre.

    Since: 5.0

  • DOMString duration
    Media duration.

    Since: 5.0

  • DOMString date
    Media date.

    Since: 5.0

  • DOMString copyright
    Media copyright.

    Since: 5.0

  • DOMString description
    Media description.

    Since: 5.0

  • DOMString trackNum
    Media track number.

    Since: 5.0

  • DOMString picture
    Media picture.

    Since: 5.0

  • long seasonNumber
    Season number. Default value is 0.

    Since: 5.5

  • DOMString seasonTitle [nullable]
    Season title. Default value is null.

    Since: 5.5

  • long episodeNumber
    Episode number. Default value is 0.

    Since: 5.5

  • DOMString episodeTitle [nullable]
    Episode title. Default value is null.

    Since: 5.5

  • long resolutionWidth
    Resolution width. Default value is 0. It cannot be changed to less than 0. Setting inappropriate values has no effect on the attribute.

    Since: 5.5

  • long resolutionHeight
    Resolution height. Default value is 0. It cannot be changed to less than 0. Setting inappropriate values has no effect on the attribute.

    Since: 5.5

2.25. MediaControllerPlaylistItem

Object represents single playlist item.
  [NoInterfaceObject] interface MediaControllerPlaylistItem {
    readonly attribute DOMString index;
    readonly attribute MediaControllerMetadata metadata;
  };

Since: 5.5

Attributes

  • readonly DOMString index
    Index of playlist's item. Should be unique within playlist.

    Since: 5.5

  • readonly MediaControllerMetadata metadata
    Metadata associated with item.

    Since: 5.5

2.26. MediaControllerMetadataInit

The MediaControllerMetadataInit dictionary defines the properties of a MediaControllerMetadata to add in addItem method.
  dictionary MediaControllerMetadataInit {
    DOMString title;
    DOMString artist;
    DOMString album;
    DOMString author;
    DOMString genre;
    DOMString duration;
    DOMString date;
    DOMString copyright;
    DOMString description;
    DOMString trackNum;
    DOMString picture;
    long seasonNumber;
    DOMString seasonTitle;
    long episodeNumber;
    DOMString episodeTitle;
    long resolutionWidth;
    long resolutionHeight;
  };

Since: 5.5

See MediaControllerMetadata interface for more information about the members.

2.27. MediaControllerPlaylist

Object represents single playlist (collection of items).
  [NoInterfaceObject] interface MediaControllerPlaylist {
    readonly attribute DOMString name;
    void addItem(DOMString index, MediaControllerMetadataInit metadata) raises(WebAPIException);
    void getItems(MediaControllerGetItemsSuccessCallback successCallback, optional ErrorCallback? errorCallback)
                  raises(WebAPIException);
  };

Since: 5.5

Attributes

  • readonly DOMString name
    Name of this playlist.

    Since: 5.5

Methods

addItem
Adds new item to the playlist.
void addItem(DOMString index, MediaControllerMetadataInit metadata);

Since: 5.5

Parameters:

  • index: Index for new item, should be unique within playlist.
  • metadata: Metadata to be associated with new item.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type UnknownError, if any other error occurs.

Code example:

var mcServer = tizen.mediacontroller.createServer();
var playlist = mcServer.createPlaylist("testPlaylist");
var metadata =
{
  title: "testTitle",
  artist: "testArtist",
  album: "testAlbum",
  author: "testAuthor",
  genre: "testGenre",
  duration: "testDuration",
  date: "testDate",
  copyright: "testCopyright",
  description: "testDescription",
  trackNum: "testTrackNum",
  picture: "testPicture",
  seasonNumber: 1,
  seasonTitle: "testSeasonTitle",
  episodeNumber: 1,
  episodeTitle: "testEpisodeTitle",
  resolutionWidth: 1600,
  resolutionHeight: 900
};

playlist.addItem("index1", metadata);
console.log("Item added.");
function successCallback()
{
  console.log("savePlaylist successful.");
}
function errorCallback(error)
{
  console.log("savePlaylist failed with error: " + error);
}
mcServer.savePlaylist(playlist, successCallback, errorCallback);

Output example:

Item added.
savePlaylist successful.
getItems
Gets all items from playlist.
void getItems(MediaControllerGetItemsSuccessCallback successCallback, optional ErrorCallback? errorCallback);

Since: 5.5

The errorCallback may be triggered for one of the following errors:

  • UnknownError: if any error prevents function from successful completion.

Remark: Note that getItems() method return only those items from playlist which been saved by savePlaylist() method.

Parameters:

  • successCallback: Function to be called when getItems is finished without error.
  • errorCallback [optional] [nullable]: Function to be called when getItems fails.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if any input parameter is not compatible with the expected type for that parameter.

    • with error type UnknownError, if any other error occurs.

Code example:

/* Assumes that code example from addItem was executed before */
function successCallback(items)
{
  items.forEach(function(item)
  {
    console.log("Index: " + item.index + " Title: " + item.metadata.title);
  });
}
function errorCallback(error)
{
  console.log("getItems failed with error: " + error);
}

playlist.getItems(successCallback, errorCallback);

Output example:

Index: index1 Title: testTitle