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

MediaControllerClient getClient ()

MediaControllerServer createServer ()

MediaControllerServer

MediaControllerClientInfo[] getAllClientsInfo ()

void updatePlaybackState (MediaControllerPlaybackState state)

void updateIconURI (DOMString? iconURI)

void updatePlaybackPosition (unsigned long long position)

void updatePlaybackAgeRating (MediaControllerContentAgeRating rating)

void updatePlaybackContentType (MediaControllerContentType type)

void updateShuffleMode (boolean mode)

void updateRepeatState (MediaControllerRepeatState state)

void updateMetadata (MediaControllerMetadata metadata)

long addChangeRequestPlaybackInfoListener (MediaControllerChangeRequestPlaybackInfoCallback listener)

void removeChangeRequestPlaybackInfoListener (long watchId)

void setSearchRequestListener (MediaControllerSearchRequestCallback listener)

void unsetSearchRequestListener ()

long addCommandListener (MediaControllerReceiveCommandCallback listener)

void removeCommandListener (long watchId)

MediaControllerPlaylist createPlaylist (DOMString name)

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)

MediaControllerServerInfo? getLatestServerInfo ()

long addAbilityChangeListener (MediaControllerAbilityChangeCallback listener)

void removeAbilityChangeListener (long watchId)

void findSubscribedServers (MediaControllerServerInfoArraySuccessCallback successCallback, optional ErrorCallback? errorCallback)

void setCustomEventListener (MediaControllerReceiveCommandCallback listener)

void unsetCustomEventListener ()

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)

long addServerStatusChangeListener (MediaControllerServerStatusChangeCallback listener)

void removeServerStatusChangeListener (long watchId)

long addPlaybackInfoChangeListener (MediaControllerPlaybackInfoChangeCallback listener)

void removePlaybackInfoChangeListener (long watchId)

void getAllPlaylists (MediaControllerGetAllPlaylistsSuccessCallback successCallback, optional ErrorCallback? errorCallback)

void sendPlaybackItem (DOMString playlistName, DOMString index, MediaControllerPlaybackState state, unsigned long long position)

long addPlaylistUpdatedListener (MediaControllerPlaylistUpdatedCallback listener)

void removePlaylistUpdatedListener (long listenerId)

MediaControllerPlaybackInfo

MediaControllerAbilities

MediaControllerPlaybackAbilities

void saveAbilities ()

MediaControllerDisplayModeAbilities

MediaControllerDisplayRotationAbilities

MediaControllerAbilitiesInfo

void subscribe ()

void unsubscribe ()

MediaControllerPlaybackAbilitiesInfo

MediaControllerDisplayModeAbilitiesInfo

MediaControllerDisplayRotationAbilitiesInfo

MediaControllerSubtitles

long addChangeRequestListener (MediaControllerEnabledChangeRequestCallback listener)

void removeChangeRequestListener (long watchId)

MediaControllerSubtitlesInfo

void sendRequest (boolean enabled, MediaControllerSendCommandSuccessCallback replyCallback)

long addModeChangeListener (MediaControllerEnabledChangeCallback listener)

void removeModeChangeListener (long watchId)

MediaControllerMode360

long addChangeRequestListener (MediaControllerEnabledChangeRequestCallback listener)

void removeChangeRequestListener (long watchId)

MediaControllerMode360Info

void sendRequest (boolean enabled, MediaControllerSendCommandSuccessCallback replyCallback)

long addModeChangeListener (MediaControllerEnabledChangeCallback listener)

void removeModeChangeListener (long watchId)

MediaControllerDisplayMode

long addChangeRequestListener (MediaControllerDisplayModeChangeRequestCallback listener)

void removeChangeRequestListener (long watchId)

MediaControllerDisplayModeInfo

void sendRequest (MediaControllerDisplayModeType type, MediaControllerSendCommandSuccessCallback replyCallback)

long addModeChangeListener (MediaControllerDisplayModeChangeCallback listener)

void removeModeChangeListener (long watchId)

MediaControllerDisplayRotation

long addChangeRequestListener (MediaControllerDisplayRotationChangeRequestCallback listener)

void removeChangeRequestListener (long watchId)

MediaControllerClientInfo

void sendEvent (DOMString eventName, Bundle? data, MediaControllerSendCommandSuccessCallback successCallback)

MediaControllerDisplayRotationInfo

void sendRequest (MediaControllerDisplayRotationType displayRotation, MediaControllerSendCommandSuccessCallback replyCallback)

long addDisplayRotationChangeListener (MediaControllerDisplayRotationChangeCallback listener)

void removeDisplayRotationChangeListener (long watchId)

MediaControllerMetadata

MediaControllerPlaylistItem

MediaControllerMetadataInit

MediaControllerPlaylist

void addItem (DOMString index, MediaControllerMetadataInit metadata)

void getItems (MediaControllerGetItemsSuccessCallback successCallback, optional ErrorCallback? errorCallback)

SearchFilter

MediaControllerServerInfoArraySuccessCallback

void onsuccess (MediaControllerServerInfo[] servers)

MediaControllerSendCommandSuccessCallback

void onsuccess (object? data, optional long code)

RequestReply

MediaControllerSearchRequestReplyCallback

void onreply (RequestReply? reply)

MediaControllerSearchRequestCallback

RequestReply? onrequest (ApplicationId clientName, SearchFilter[] request)

MediaControllerReceiveCommandCallback

RequestReply? onsuccess (ApplicationId senderAppName, DOMString command, object data)

MediaControllerEnabledChangeRequestCallback

RequestReply? onreply (ApplicationId clientName, boolean enabled)

MediaControllerEnabledChangeCallback

void onchange (boolean enabled)

MediaControllerDisplayModeChangeRequestCallback

RequestReply? onreply (ApplicationId clientName, MediaControllerDisplayModeType mode)

MediaControllerDisplayModeChangeCallback

void onchange (MediaControllerDisplayModeType mode)

MediaControllerDisplayRotationChangeRequestCallback

RequestReply? onreply (ApplicationId clientName, MediaControllerDisplayRotationType displayRotation)

MediaControllerDisplayRotationChangeCallback

void onchange (MediaControllerDisplayRotationType displayRotation)

MediaControllerServerStatusChangeCallback

void onsuccess (MediaControllerServerState status)

MediaControllerPlaybackInfoChangeCallback

void onplaybackchanged (MediaControllerPlaybackState state, unsigned long long position)

void onshufflemodechanged (boolean mode)

void onrepeatstatechanged (MediaControllerRepeatState state)

void onmetadatachanged (MediaControllerMetadata metadata)

MediaControllerChangeRequestPlaybackInfoCallback

void onplaybackstaterequest (MediaControllerPlaybackState state, ApplicationId clientName)

void onplaybackpositionrequest (unsigned long long position, ApplicationId clientName)

void onshufflemoderequest (boolean mode, ApplicationId clientName)

void onrepeatstaterequest (MediaControllerRepeatState state, ApplicationId clientName)

void onplaybackitemrequest (DOMString playlistName, DOMString index, MediaControllerPlaybackState state, unsigned long long position, ApplicationId clientName)

MediaControllerGetAllPlaylistsSuccessCallback

void onsuccess (MediaControllerPlaylist[] playlists)

MediaControllerPlaylistUpdatedCallback

void onplaylistupdated (DOMString serverName, MediaControllerPlaylist playlist)

void onplaylistdeleted (DOMString serverName, DOMString playlistName)

MediaControllerGetItemsSuccessCallback

void onsuccess (MediaControllerPlaylistItem[] items)

MediaControllerAbilityChangeCallback

void onplaybackabilitychanged (MediaControllerServerInfo server, MediaControllerPlaybackAbilitiesInfo abilities)

void ondisplaymodeabilitychanged (MediaControllerServerInfo server, MediaControllerDisplayModeAbilitiesInfo abilities)

void ondisplayrotationabilitychanged (MediaControllerServerInfo server, MediaControllerDisplayRotationAbilitiesInfo abilities)

void onsimpleabilitychanged (MediaControllerServerInfo server, MediaControllerSimpleAbility type, MediaControllerAbilitySupport support)

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;
};

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.

MediaControllerClient getClient();

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 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);
<span class="nocode deprecated">    void sendRepeatMode(boolean mode, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback)
                        raises(WebAPIException);
</span>    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;
<span class="nocode deprecated">    readonly attribute boolean repeatMode;
</span>    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

  • DOMString 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.

  • DOMString 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.

  • DOMString 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.

  • DOMString 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.

  • DOMString 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.

  • DOMString 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.

  • DOMString 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.

  • DOMString 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

  • DOMString 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.

  • DOMString 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.

  • DOMString 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.

  • DOMString 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.

  • DOMString 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.

  • DOMString 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.

  • DOMString 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.

  • DOMString 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

  • DOMString 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.

  • DOMString 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.

  • DOMString 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.

  • DOMString 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

  • DOMString 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.

  • DOMString 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.

  • DOMString 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.

  • DOMString 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](#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.

void sendRequest(MediaControllerDisplayModeType type, MediaControllerSendCommandSuccessCallback replyCallback);

Since: 5.5

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

Parameters:

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

Exceptions:

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

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

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

Code example:


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

var type = "CROPPED_FULL";
mcServerInfo.displayMode.sendRequest(type, function(data, code)
{
  console.log("Server replied with return data: " + JSON.stringify(data) + " and code: " + code);
});

addModeChangeListener

Adds the listener for changes of a media controller display mode of a media controller server.

long addModeChangeListener(MediaControllerDisplayModeChangeCallback listener);

Since: 5.5

Parameters:

  • listener: Display mode change listener to add.

Return value:

long: The identifier used to clear the watch subscription.

Exceptions:

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

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

Code example:


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

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

removeModeChangeListener

Removes the listener, so stop receiving notifications about media controller server display mode changes.

void removeModeChangeListener(long watchId);

Since: 5.5

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

Parameters:

  • watchId: Watcher identifier.

Exceptions:

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

Code example:


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

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

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

2.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

2.28. SearchFilter

Search filter representation.

  [Constructor(MediaControllerContentType contentType, optional MediaControllerSearchCategory category = "NO_CATEGORY", optional DOMString? keyword = null, optional Bundle? extraData = null)]
  interface SearchFilter {
    attribute MediaControllerContentType contentType raises(WebAPIException);
    attribute MediaControllerSearchCategory category raises(WebAPIException);
    attribute DOMString? keyword raises(WebAPIException);
    attribute Bundle? extraData;
  };

Since: 5.5

Remark: throws WebAPIException with error type TypeMismatchError, if constructor is called with invalid argument types.

Remark: throws WebAPIException with error type InvalidValuesError, if constructor is called with null keyword and category different than NO_CATEGORY.

Constructors

Constructor (MediaControllerContentType, MediaControllerSearchCategory, DOMString?, Bundle?)

SearchFilter(MediaControllerContentType contentType, optional MediaControllerSearchCategory category = "NO_CATEGORY", optional DOMString? keyword = null, optional Bundle? extraData = null);

Attributes

  • MediaControllerContentType contentType

    Specifies filter's content type parameter.

    Since: 5.5

    Exceptions:

    • WebAPIException
      • with error type TypeMismatchError, if the input parameter is not compatible with the expected type.
  • MediaControllerSearchCategory category

    Specifies filter's search category parameter.

    Since: 5.5

    Exceptions:

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

      • with error type InvalidValuesError, if keyword is null and new category value is not NO_CATEGORY.

  • DOMString keyword [nullable]

    Specifies filter's search keyword parameter.

    Since: 5.5

    Remark: Keyword can only be null or empty if the category is set to NO_CATEGORY.

    Exceptions:

    • WebAPIException
      • with error type InvalidValuesError, if the category is not NO_CATEGORY and the keyword is null.
  • Bundle extraData [nullable]

    Additional application-dependent search parameters.

    Since: 5.5

2.29. MediaControllerServerInfoArraySuccessCallback

The MediaControllerServerInfoArraySuccessCallback interface that defines the success method for MediaControllerClient.findServers().

  [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerServerInfoArraySuccessCallback {
    void onsuccess(MediaControllerServerInfo[] servers);
  };

Since: 5.0

Methods

onsuccess

void onsuccess(MediaControllerServerInfo[] servers);

Since: 5.0

Parameters:

  • servers: List of registered media controller servers.

2.30. MediaControllerSendCommandSuccessCallback

The MediaControllerSendCommandSuccessCallback interface that defines the success method which is triggered, when the server responds to a command.

  [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerSendCommandSuccessCallback {
    void onsuccess(object? data, optional long code);
  };

Since: 5.0

Interface is used as a success method for:

  • MediaControllerServerInfo.sendCommand()
  • MediaControllerMode360Info.sendRequest()
  • MediaControllerSubtitlesInfo.sendRequest()
  • MediaControllerDisplayMode.sendRequest()
  • MediaControllerDisplayRotationInfo.sendRequest()
  • MediaControllerClientInfo.sendEvent()

Methods

onsuccess

Called when a response to the request is received.

void onsuccess(object? data, optional long code);

Since: 5.0

Parameters:

  • data [nullable]: Response data object sent by the command handler. This object is compatible with Bundle object.
  • code [optional]: Response code.

2.31. RequestReply

Representation of server's response to a request.

  [Constructor(Bundle? data, optional long code = 0)]
  interface RequestReply {
    attribute Bundle? data;
    attribute long code;
  };

Since: 5.5

Constructors

Constructor (Bundle?, long)

RequestReply(Bundle? data, optional long code = 0);

Attributes

  • Bundle data [nullable]

    Response data bundle.

    Since: 5.5

  • long code

    Response status code.

    Since: 5.5

2.32. MediaControllerSearchRequestReplyCallback

The MediaControllerSearchRequestReplyCallback interface defines reply callback for MediaControllerServerInfo.sendSearchRequest().

  [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerSearchRequestReplyCallback {
    void onreply(RequestReply? reply);
  };

Since: 5.5

Methods

onreply

Function called when search request has been processed.

void onreply(RequestReply? reply);

Since: 5.5

Interpretation of status and data parameters depends on the server implementation.

Parameters:

  • reply [nullable]: Reply object returned by request handler.

2.33. MediaControllerSearchRequestCallback

Server search request listener interface.

  [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerSearchRequestCallback {
    RequestReply? onrequest(ApplicationId clientName, SearchFilter[] request);
  };

Since: 5.5

Methods

onrequest

Function called on the server when it receives a search request from a client.

RequestReply? onrequest(ApplicationId clientName, SearchFilter[] request);

Since: 5.5

Parameters:

  • clientName: Request sender name.
  • request: Collection of filters to refine the search results.

Return value:

RequestReply [nullable]: RequestReply object with status code and reply data bundle. It will be passed to the replyCallback of sendSearchRequest().

2.34. MediaControllerReceiveCommandCallback

The MediaControllerReceiveCommandCallback interface that defines the listener for custom communication between server and client.

[Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerReceiveCommandCallback {
  RequestReply? onsuccess(ApplicationId senderAppName, DOMString command, object data);
};

Since: 5.0

Related functions:

Methods

onsuccess

Called when custom command is received by the server or custom event is received by the client.

RequestReply? onsuccess(ApplicationId senderAppName, DOMString command, object data);

Since: 5.0

Parameters:

  • senderAppName: Sender application id.
  • command: Custom command or event.
  • data: Response object. This object is compatible with Bundle.

Return value:

RequestReply [nullable]: RequestReply object which will be returned to the author of the request.

2.35. MediaControllerEnabledChangeRequestCallback

The MediaControllerEnabledChangeRequestCallback interface that defines the listener for change requests for spherical mode in MediaControllerMode360.addChangeRequestListener() and subtitles mode in MediaControllerSubtitles.addChangeRequestListener().

  [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerEnabledChangeRequestCallback {
    RequestReply? onreply(ApplicationId clientName, boolean enabled);
  };

Since: 5.5

Methods

onreply

Called when change request is received from client.

RequestReply? onreply(ApplicationId clientName, boolean enabled);

Since: 5.5

Remark: You can return data object from callback which will be sent in reply to the client. See mode360.addChangeRequestListener() and subtitles.addChangeRequestListener() methods to check how to handle and respond to commands.

Parameters:

  • clientName: The ID of a client application which the request was sent from.
  • enabled: The value requested by a client application.

Return value:

RequestReply [nullable]: RequestReply object which is sent with the reply to the client.

2.36. MediaControllerEnabledChangeCallback

The MediaControllerEnabledChangeCallback interface that defines the listener for a media controller server's attribute changes.

  \[Callback=FunctionOnly, NoInterfaceObject\] interface MediaControllerEnabledChangeCallback {
    void onchange(boolean enabled);
  };

Since: 5.5

Methods

onchange

Called when server's attribute is changed.

void onchange(boolean enabled);

Since: 5.5

Parameters:

  • enabled: Current server's attribute status, which specifies if attribute is enabled or disabled.

2.37. MediaControllerDisplayModeChangeRequestCallback

The MediaControllerDisplayModeChangeRequestCallback interface that defines the listener for change requests for display mode in MediaControllerDisplayMode.addChangeRequestListener().

  [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerDisplayModeChangeRequestCallback {
    RequestReply? onreply(ApplicationId clientName, MediaControllerDisplayModeType mode);
  };

Since: 5.5

Methods

onreply

Called when change request is received from client.

RequestReply? onreply(ApplicationId clientName, MediaControllerDisplayModeType mode);

Since: 5.5

Remark: You can return data object from callback which will be sent in reply to the client. See addChangeRequestListener() method to check how to handle and respond to commands.

Parameters:

  • clientName: An id of a client application which sent the request.
  • mode: The value requested by a client application.

Return value:

RequestReply [nullable]: RequestReply object which is sent with the reply to the client.

2.38. MediaControllerDisplayModeChangeCallback

The MediaControllerDisplayModeChangeCallback interface that defines the listener for display mode changes of the media controller server.

  [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerDisplayModeChangeCallback {
    void onchange(MediaControllerDisplayModeType mode);
  };

Since: 5.5

Methods

onchange

Called when server's display mode is changed.

void onchange(MediaControllerDisplayModeType mode);

Since: 5.5

Parameters:

  • mode: Current server display mode.

2.39. MediaControllerDisplayRotationChangeRequestCallback

The MediaControllerDisplayRotationChangeRequestCallback interface that defines the listener for change requests for display rotation in MediaControllerDisplayRotation.addChangeRequestListener().

  [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerDisplayRotationChangeRequestCallback {
    RequestReply? onreply(ApplicationId clientName, MediaControllerDisplayRotationType displayRotation);
  };

Since: 5.5

Methods

onreply

Called when change request is received from a client.

RequestReply? onreply(ApplicationId clientName, MediaControllerDisplayRotationType displayRotation);

Since: 5.5

Remark: You can return data object from callback which will be sent in reply to the client. See displayRotation.addChangeRequestListener() method to check how to handle and respond to commands.

Parameters:

  • clientName: An id of a client application which sent the request.
  • displayRotation: The value requested by a client application.

Return value:

RequestReply [nullable]: RequestReply object which is sent with the reply to the client.

2.40. MediaControllerDisplayRotationChangeCallback

The MediaControllerDisplayModeChangeCallback interface that defines the listener for changes of a media controller server's display rotation.

  [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerDisplayRotationChangeCallback {
    void onchange(MediaControllerDisplayRotationType displayRotation);
  };

Since: 5.5

Methods

onchange

Called when display rotation is changed.

void onchange([MediaControllerDisplayRotationType](#MediaControllerDisplayRotationType) displayRotation);

Since: 5.5

Parameters:

  • displayRotation: Current server display rotation state.

2.41. MediaControllerServerStatusChangeCallback

The MediaControllerServerStatusChangeCallback interface that defines the listener for media controller server status changes.

  [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerServerStatusChangeCallback {
    void onsuccess(MediaControllerServerState status);
  };

Since: 5.0

Methods

onsuccess

Called when server status changed.

void onsuccess(MediaControllerServerState status);

Since: 5.0

Parameters:

  • status: Current server status.

2.42. MediaControllerPlaybackInfoChangeCallback

The MediaControllerPlaybackInfoChangeCallback interface that defines the listeners object for receiving media controller playback info changes from server.

  [Callback, NoInterfaceObject] interface MediaControllerPlaybackInfoChangeCallback {
    void onplaybackchanged(MediaControllerPlaybackState state, unsigned long long position);
    void onshufflemodechanged(boolean mode);
<span class="nocode deprecated">    void onrepeatmodechanged(boolean mode);
</span>    void onrepeatstatechanged(MediaControllerRepeatState state);
    void onmetadatachanged(MediaControllerMetadata metadata);
  };

Since: 5.0

Methods

onplaybackchanged

Called when playback state or position is changed.

void onplaybackchanged(MediaControllerPlaybackState state, unsigned long long position);

Since: 5.0

Parameters:

  • state: Current playback state.
  • position: Current playback position.

onshufflemodechanged

Called when shuffle mode is changed.

void onshufflemodechanged(boolean mode);


Since: 5.0

Parameters:

  • mode: Current shuffle mode.

onrepeatmodechanged

Called when repeat mode is changed.

Deprecated. Deprecated since 5.5. Instead, use onrepeatstatechanged.

Deprecated. Deprecated since 5.5. Instead, use [onrepeatstatechanged](#MediaControllerPlaybackInfoChangeCallback::onrepeatstatechanged).

Since: 5.0

Remark: The onrepeatmodechanged callback will not be invoked, if the repeatState is changed to REPEAT_ONE.

Parameters:

  • mode: Current repeat mode.

onrepeatstatechanged

Called when repeat state is changed.

void onmetadatachanged(MediaControllerMetadata metadata);

Since: 5.5

It is guaranteed that the onrepeatstatechanged callback will be invoked after the onrepeatmodechanged.

Parameters:

  • state: Current repeat state.

onmetadatachanged

Called when playback metadata is changed.

void onmetadatachanged([MediaControllerMetadata](#MediaControllerMetadata) metadata);


Since: 5.0

Parameters:

  • metadata: Current playback metadata.

2.43. MediaControllerChangeRequestPlaybackInfoCallback

The MediaControllerChangeRequestPlaybackInfoCallback interface that defines the listeners object for receiving playback info change requests from client.

  [Callback, NoInterfaceObject] interface MediaControllerChangeRequestPlaybackInfoCallback {
    void onplaybackstaterequest(MediaControllerPlaybackState state, ApplicationId clientName);
    void onplaybackpositionrequest(unsigned long long position, ApplicationId clientName);
    void onshufflemoderequest(boolean mode, ApplicationId clientName);
<span class="nocode deprecated">    void onrepeatmoderequest(boolean mode, ApplicationId clientName);
</span>    void onrepeatstaterequest(MediaControllerRepeatState state, ApplicationId clientName);
    void onplaybackitemrequest(DOMString playlistName, DOMString index, MediaControllerPlaybackState state,
                               unsigned long long position, ApplicationId clientName);
  };

Since: 5.0

Methods

onplaybackstaterequest

Called when client requested playback state changes.

void onplaybackstaterequest(MediaControllerPlaybackState state, ApplicationId clientName);

Since: 5.0

Remark: Parameter clientName is passed since Tizen 5.5.

Parameters:

  • state: Requested playback state.
  • clientName: Id of client application, which sent a command.

onplaybackpositionrequest

Called when client requested playback position changes.

void onplaybackpositionrequest(unsigned long long position, ApplicationId clientName);

Since: 5.0

Remark: Parameter clientName is passed since Tizen 5.5.

Parameters:

  • position: Requested playback position.
  • clientName: Id of client application, which sent a command.

onshufflemoderequest

Called when client requested shuffle mode changes.

void onshufflemoderequest(boolean mode, ApplicationId clientName);

Since: 5.0

Remark: Parameter clientName is passed since Tizen 5.5.

Parameters:

  • mode: Requested shuffle mode.
  • clientName: Id of client application, which sent a command.

onrepeatmoderequest

Called when client requested repeat mode changes.

Deprecated. Deprecated since 5.5. Instead, use onrepeatstaterequest.

void onrepeatmoderequest(boolean mode, [ApplicationId](application-api.html#ApplicationId) clientName);


Since: 5.0

Remark: The onrepeatmoderequest callback will not be invoked, if the repeatState is requested to be changed to REPEAT_ONE.

Remark: Parameter clientName is passed since Tizen 5.5.

Parameters:

  • mode: Requested repeat mode.
  • clientName: Client application id which sent command.

onrepeatstaterequest

Called when client requested change of repeat state.

void onrepeatstaterequest(MediaControllerRepeatState state, ApplicationId clientName);

Since: 5.5

It is guaranteed that the onrepeatstaterequest callback will be invoked after the onrepeatmoderequest.

Parameters:

  • state: Requested repeat state.
  • clientName: Id of client application, which sent a command.

onplaybackitemrequest

Called when client request change of playback item.

void onplaybackitemrequest(DOMString playlistName, DOMString index, MediaControllerPlaybackState state,
                           unsigned long long position, ApplicationId clientName);

Since: 5.5

Parameters:

  • playlistName: Name of playlist.
  • index: Index of the item to be changed.
  • state: Playback state.
  • position: Playback position.
  • clientName: Id of client application, which sent a command.

2.44. MediaControllerGetAllPlaylistsSuccessCallback

Interface for success callback for getAllPlaylists function.

void onsuccess(MediaControllerPlaylist[] playlists);

Since: 5.5

Methods

onsuccess

Success callback for getAllPlaylists function.

void onsuccess(MediaControllerPlaylist[] playlists);

Since: 5.5

Parameters:

  • playlists: Collection of MediaControllerPlaylist objects.

2.45. MediaControllerPlaylistUpdatedCallback

Interface for specific playlist update events (including deletion).

  [Callback, NoInterfaceObject] interface MediaControllerPlaylistUpdatedCallback {
    void onplaylistupdated(DOMString serverName, MediaControllerPlaylist playlist);
    void onplaylistdeleted(DOMString serverName, DOMString playlistName);
  };

Since: 5.5

Methods

onplaylistupdated

Event triggered when playlist is updated in database.

void onplaylistupdated(DOMString serverName, MediaControllerPlaylist playlist);

Since: 5.5

Parameters:

  • serverName: Name of server which triggered the event.
  • playlist: Playlist for which event was triggered.

onplaylistdeleted

Event triggered when playlist is removed from database.

void onplaylistdeleted(DOMString serverName, DOMString playlistName);

Since: 5.5

Parameters:

  • serverName: Name of server which triggered the event.
  • playlistName: Name of playlist for which the event was triggered.

2.46. MediaControllerGetItemsSuccessCallback

Interface for success callback for getItems function.

  [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerGetItemsSuccessCallback {
    void onsuccess(MediaControllerPlaylistItem[] items);
  };

Since: 5.5

Methods

onsuccess

Success callback for getItems function.

void onsuccess(MediaControllerPlaylistItem[] items);

Since: 5.5

Parameters:

  • items: Collection of MediaControllerPlaylistItem objects.

2.47. MediaControllerAbilityChangeCallback

Interface for handling ability events.

  [Callback, NoInterfaceObject] interface MediaControllerAbilityChangeCallback {
    void onplaybackabilitychanged(MediaControllerServerInfo server, MediaControllerPlaybackAbilitiesInfo abilities);
    void ondisplaymodeabilitychanged(MediaControllerServerInfo server, MediaControllerDisplayModeAbilitiesInfo abilities);
    void ondisplayrotationabilitychanged(MediaControllerServerInfo server, MediaControllerDisplayRotationAbilitiesInfo abilities);
    void onsimpleabilitychanged(MediaControllerServerInfo server, MediaControllerSimpleAbility type,
                                MediaControllerAbilitySupport support);
  };

Since: 5.5

Methods

onplaybackabilitychanged

Event triggered when server's playback ability is updated.

void onplaybackabilitychanged(MediaControllerServerInfo server, MediaControllerPlaybackAbilitiesInfo abilities);

Since: 5.5

Parameters:

  • server: Server which triggered the event.
  • abilities: Object with current state of playback abilities on the media controller server.

ondisplaymodeabilitychanged

Event triggered when server's display mode ability is updated.

void ondisplaymodeabilitychanged(MediaControllerServerInfo server, MediaControllerDisplayModeAbilitiesInfo abilities);

Since: 5.5

Parameters:

  • server: Server which triggered the event.
  • abilities: Object with current state of display mode abilities on the media controller server.

ondisplayrotationabilitychanged

Event triggered when server's display rotation is updated.

void ondisplayrotationabilitychanged([MediaControllerServerInfo](#MediaControllerServerInfo) server, [MediaControllerDisplayRotationAbilitiesInfo](#MediaControllerDisplayRotationAbilitiesInfo) abilities);

Since: 5.5

Parameters:

  • server: Server which triggered the event.
  • abilities: Object with current state of display mode abilities on the media controller server.

onsimpleabilitychanged

Event triggered when server's simple ability is updated.

void onsimpleabilitychanged(MediaControllerServerInfo server, MediaControllerSimpleAbility type,
                            MediaControllerAbilitySupport support);

Since: 5.5

Parameters:

  • server: Server which triggered the event.
  • type: Type of simple ability.
  • support: Ability value which was set on the media controller server.

3. Full WebIDL

module MediaController {
  enum MediaControllerServerState { "ACTIVE", "INACTIVE" };
  enum MediaControllerSearchCategory { "NO_CATEGORY", "TITLE", "ARTIST", "ALBUM", "GENRE", "TPO" };
  enum MediaControllerPlaybackState { "PLAY", "PAUSE", "STOP", "NEXT", "PREV", "FORWARD", "REWIND" };
  enum MediaControllerRepeatState { "REPEAT_OFF", "REPEAT_ONE", "REPEAT_ALL" };
  enum MediaControllerContentType { "IMAGE", "MUSIC", "VIDEO", "OTHER", "UNDECIDED" };
  enum MediaControllerContentAgeRating { "ALL", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13",
    "14", "15", "16", "17", "18", "19" };
  enum MediaControllerAbilitySupport { "YES", "NO", "UNDECIDED" };
  enum MediaControllerSimpleAbility { "PLAYBACK_POSITION", "SHUFFLE", "REPEAT", "PLAYLIST", "CLIENT_CUSTOM", "SEARCH",
    "SUBTITLES", "MODE_360" };
  enum MediaControllerDisplayModeType { "LETTER_BOX", "ORIGIN_SIZE", "FULL_SCREEN", "CROPPED_FULL" };
  enum MediaControllerDisplayRotationType { "ROTATION_NONE", "ROTATION_90", "ROTATION_180", "ROTATION_270" };
  dictionary MediaControllerMetadataInit {
    DOMString title;
    DOMString artist;
    DOMString album;
    DOMString author;
    DOMString genre;
    DOMString duration;
    DOMString date;
    DOMString copyright;
    DOMString description;
    DOMString trackNum;
    DOMString picture;
    long seasonNumber;
    DOMString seasonTitle;
    long episodeNumber;
    DOMString episodeTitle;
    long resolutionWidth;
    long resolutionHeight;
  };
  Tizen implements MediaControllerObject;
  [NoInterfaceObject] interface MediaControllerObject {
    readonly attribute MediaControllerManager mediacontroller;
  };
  [NoInterfaceObject] interface MediaControllerManager {
    MediaControllerClient getClient() raises(WebAPIException);
    MediaControllerServer createServer() raises(WebAPIException);
  };
  [NoInterfaceObject] interface MediaControllerServer {
    readonly attribute MediaControllerPlaybackInfo playbackInfo;
    readonly attribute DOMString? iconURI;
    readonly attribute MediaControllerAbilities abilities;
    readonly attribute MediaControllerSubtitles subtitles;
    readonly attribute MediaControllerMode360 mode360;
    readonly attribute MediaControllerDisplayMode displayMode;
    readonly attribute MediaControllerDisplayRotation displayRotation;
    MediaControllerClientInfo[] getAllClientsInfo() raises(WebAPIException);
    void updatePlaybackState(MediaControllerPlaybackState state) raises(WebAPIException);
    void updateIconURI(DOMString? iconURI) raises(WebAPIException);
    void updatePlaybackPosition(unsigned long long position) raises(WebAPIException);
    void updatePlaybackAgeRating(MediaControllerContentAgeRating rating) raises(WebAPIException);
    void updatePlaybackContentType(MediaControllerContentType type) raises(WebAPIException);
    void updateShuffleMode(boolean mode) raises(WebAPIException);
    void updateRepeatState(MediaControllerRepeatState state) raises(WebAPIException);
    void updateMetadata(MediaControllerMetadata metadata) raises(WebAPIException);
    long addChangeRequestPlaybackInfoListener(MediaControllerChangeRequestPlaybackInfoCallback listener) raises(WebAPIException);
    void removeChangeRequestPlaybackInfoListener(long watchId) raises(WebAPIException);
    void setSearchRequestListener(MediaControllerSearchRequestCallback listener) raises(WebAPIException);
    void unsetSearchRequestListener() raises(WebAPIException);
    long addCommandListener(MediaControllerReceiveCommandCallback listener) raises(WebAPIException);
    void removeCommandListener(long watchId) raises(WebAPIException);
    MediaControllerPlaylist createPlaylist(DOMString name) raises(WebAPIException);
    void savePlaylist(MediaControllerPlaylist playlist, optional SuccessCallback? successCallback,
                      optional ErrorCallback? errorCallback) raises(WebAPIException);
    void deletePlaylist(DOMString playlistName, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback)
                        raises(WebAPIException);
    void updatePlaybackItem(DOMString playlistName, DOMString index) raises(WebAPIException);
    void getAllPlaylists(MediaControllerGetAllPlaylistsSuccessCallback successCallback, optional ErrorCallback? errorCallback)
                         raises(WebAPIException);
  };
  [NoInterfaceObject] interface MediaControllerClient {
    void findServers(MediaControllerServerInfoArraySuccessCallback successCallback, optional ErrorCallback? errorCallback)
                     raises(WebAPIException);
    MediaControllerServerInfo? getLatestServerInfo() raises(WebAPIException);
    long addAbilityChangeListener(MediaControllerAbilityChangeCallback listener) raises(WebAPIException);
    void removeAbilityChangeListener(long watchId) raises(WebAPIException);
    void findSubscribedServers(MediaControllerServerInfoArraySuccessCallback successCallback, optional ErrorCallback? errorCallback)
                               raises(WebAPIException);
    void setCustomEventListener(MediaControllerReceiveCommandCallback listener) raises(WebAPIException);
    void unsetCustomEventListener() raises(WebAPIException);
  };
  [NoInterfaceObject] interface MediaControllerServerInfo {
    readonly attribute ApplicationId name;
    readonly attribute MediaControllerServerState state;
    readonly attribute MediaControllerPlaybackInfo playbackInfo raises(WebAPIException);
    readonly attribute DOMString? iconURI raises(WebAPIException);
    readonly attribute MediaControllerAbilitiesInfo abilities;
    readonly attribute MediaControllerSubtitlesInfo subtitles;
    readonly attribute MediaControllerMode360Info mode360;
    readonly attribute MediaControllerDisplayModeInfo displayMode;
    readonly attribute MediaControllerDisplayRotationInfo displayRotation;
    void sendPlaybackState(MediaControllerPlaybackState state, optional SuccessCallback? successCallback,
                           optional ErrorCallback? errorCallback) raises(WebAPIException);
    void sendPlaybackPosition(unsigned long long position, optional SuccessCallback? successCallback,
                              optional ErrorCallback? errorCallback) raises(WebAPIException);
    void sendShuffleMode(boolean mode, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback)
                         raises(WebAPIException);
    void sendRepeatState(MediaControllerRepeatState state, optional SuccessCallback? successCallback,
                         optional ErrorCallback? errorCallback) raises(WebAPIException);
    void sendSearchRequest(SearchFilter[] request, MediaControllerSearchRequestReplyCallback replyCallback,
                           optional ErrorCallback? errorCallback) raises(WebAPIException);
    void sendCommand(DOMString command, Bundle? data, MediaControllerSendCommandSuccessCallback successCallback,
                     optional ErrorCallback? errorCallback) raises(WebAPIException);
    long addServerStatusChangeListener(MediaControllerServerStatusChangeCallback listener) raises(WebAPIException);
    void removeServerStatusChangeListener(long watchId) raises(WebAPIException);
    long addPlaybackInfoChangeListener(MediaControllerPlaybackInfoChangeCallback listener) raises(WebAPIException);
    void removePlaybackInfoChangeListener(long watchId) raises(WebAPIException);
    void getAllPlaylists(MediaControllerGetAllPlaylistsSuccessCallback successCallback, optional ErrorCallback? errorCallback)
                         raises(WebAPIException);
    void sendPlaybackItem(DOMString playlistName, DOMString index, MediaControllerPlaybackState state, unsigned long long position)
                          raises(WebAPIException);
    long addPlaylistUpdatedListener(MediaControllerPlaylistUpdatedCallback listener) raises(WebAPIException);
    void removePlaylistUpdatedListener(long listenerId) raises(WebAPIException);
  };
  [NoInterfaceObject] interface MediaControllerPlaybackInfo {
    readonly attribute MediaControllerPlaybackState state;
    readonly attribute unsigned long long position;
    readonly attribute MediaControllerContentAgeRating ageRating;
    readonly attribute MediaControllerContentType contentType;
    readonly attribute boolean shuffleMode;
    readonly attribute MediaControllerRepeatState repeatState;
    readonly attribute MediaControllerMetadata metadata;
    readonly attribute DOMString? index;
    readonly attribute DOMString? playlistName;
  };
  [NoInterfaceObject] interface MediaControllerAbilities {
    readonly attribute MediaControllerPlaybackAbilities playback;
    readonly attribute MediaControllerDisplayModeAbilities displayMode;
    readonly attribute MediaControllerDisplayRotationAbilities displayRotation;
    attribute MediaControllerAbilitySupport playbackPosition raises(WebAPIException);
    attribute MediaControllerAbilitySupport shuffle raises(WebAPIException);
    attribute MediaControllerAbilitySupport repeat raises(WebAPIException);
    attribute MediaControllerAbilitySupport playlist raises(WebAPIException);
    attribute MediaControllerAbilitySupport clientCustom raises(WebAPIException);
    attribute MediaControllerAbilitySupport search raises(WebAPIException);
    attribute MediaControllerAbilitySupport subtitles raises(WebAPIException);
    attribute MediaControllerAbilitySupport mode360 raises(WebAPIException);
  };
  [NoInterfaceObject] interface MediaControllerPlaybackAbilities {
    attribute MediaControllerAbilitySupport play raises(WebAPIException);
    attribute MediaControllerAbilitySupport pause raises(WebAPIException);
    attribute MediaControllerAbilitySupport stop raises(WebAPIException);
    attribute MediaControllerAbilitySupport next raises(WebAPIException);
    attribute MediaControllerAbilitySupport prev raises(WebAPIException);
    attribute MediaControllerAbilitySupport forward raises(WebAPIException);
    attribute MediaControllerAbilitySupport rewind raises(WebAPIException);
    attribute MediaControllerAbilitySupport togglePlayPause raises(WebAPIException);
    void saveAbilities() raises(WebAPIException);
  };
  [NoInterfaceObject] interface MediaControllerDisplayModeAbilities {
    attribute MediaControllerAbilitySupport letterBox raises(WebAPIException);
    attribute MediaControllerAbilitySupport originSize raises(WebAPIException);
    attribute MediaControllerAbilitySupport fullScreen raises(WebAPIException);
    attribute MediaControllerAbilitySupport croppedFull raises(WebAPIException);
  };
  [NoInterfaceObject] interface MediaControllerDisplayRotationAbilities {
    attribute MediaControllerAbilitySupport rotationNone raises(WebAPIException);
    attribute MediaControllerAbilitySupport rotation90 raises(WebAPIException);
    attribute MediaControllerAbilitySupport rotation180 raises(WebAPIException);
    attribute MediaControllerAbilitySupport rotation270 raises(WebAPIException);
  };
  [NoInterfaceObject] interface MediaControllerAbilitiesInfo {
    readonly attribute MediaControllerPlaybackAbilitiesInfo playback;
    readonly attribute MediaControllerDisplayModeAbilitiesInfo displayMode;
    readonly attribute MediaControllerDisplayRotationAbilitiesInfo displayRotation;
    readonly attribute MediaControllerAbilitySupport playbackPosition raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport shuffle raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport repeat raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport playlist raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport clientCustom raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport search raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport subtitles raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport mode360 raises(WebAPIException);
    void subscribe() raises(WebAPIException);
    void unsubscribe() raises(WebAPIException);
  };
  [NoInterfaceObject] interface MediaControllerPlaybackAbilitiesInfo {
    readonly attribute MediaControllerAbilitySupport play raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport pause raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport stop raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport next raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport prev raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport forward raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport rewind raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport togglePlayPause raises(WebAPIException);
  };
  [NoInterfaceObject] interface MediaControllerDisplayModeAbilitiesInfo {
    readonly attribute MediaControllerAbilitySupport letterBox raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport originSize raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport fullScreen raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport croppedFull raises(WebAPIException);
  };
  [NoInterfaceObject] interface MediaControllerDisplayRotationAbilitiesInfo {
    readonly attribute MediaControllerAbilitySupport rotationNone raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport rotation90 raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport rotation180 raises(WebAPIException);
    readonly attribute MediaControllerAbilitySupport rotation270 raises(WebAPIException);
  };
  [NoInterfaceObject] interface MediaControllerSubtitles {
    attribute boolean enabled raises(WebAPIException);
    long addChangeRequestListener(MediaControllerEnabledChangeRequestCallback listener) raises(WebAPIException);
    void removeChangeRequestListener(long watchId) raises(WebAPIException);
  };
  [NoInterfaceObject] interface MediaControllerSubtitlesInfo {
    readonly attribute boolean enabled raises(WebAPIException);
    void sendRequest(boolean enabled, MediaControllerSendCommandSuccessCallback replyCallback) raises(WebAPIException);
    long addModeChangeListener(MediaControllerEnabledChangeCallback listener) raises(WebAPIException);
    void removeModeChangeListener(long watchId) raises(WebAPIException);
  };
  [NoInterfaceObject] interface MediaControllerMode360 {
    attribute boolean enabled raises(WebAPIException);
    long addChangeRequestListener(MediaControllerEnabledChangeRequestCallback listener) raises(WebAPIException);
    void removeChangeRequestListener(long watchId) raises(WebAPIException);
  };
  [NoInterfaceObject] interface MediaControllerMode360Info {
    readonly attribute boolean enabled raises(WebAPIException);
    void sendRequest(boolean enabled, MediaControllerSendCommandSuccessCallback replyCallback) raises(WebAPIException);
    long addModeChangeListener(MediaControllerEnabledChangeCallback listener) raises(WebAPIException);
    void removeModeChangeListener(long watchId) raises(WebAPIException);
  };
  [NoInterfaceObject] interface MediaControllerDisplayMode {
    attribute MediaControllerDisplayModeType type raises(WebAPIException);
    long addChangeRequestListener(MediaControllerDisplayModeChangeRequestCallback listener) raises(WebAPIException);
    void removeChangeRequestListener(long watchId) raises(WebAPIException);
  };
  [NoInterfaceObject] interface MediaControllerDisplayModeInfo {
    readonly attribute MediaControllerDisplayModeType type raises(WebAPIException);
    void sendRequest(MediaControllerDisplayModeType type, MediaControllerSendCommandSuccessCallback replyCallback)
                     raises(WebAPIException);
    long addModeChangeListener(MediaControllerDisplayModeChangeCallback listener) raises(WebAPIException);
    void removeModeChangeListener(long watchId) raises(WebAPIException);
  };
  [NoInterfaceObject] interface MediaControllerDisplayRotation {
    attribute MediaControllerDisplayRotationType displayRotation raises(WebAPIException);
    long addChangeRequestListener(MediaControllerDisplayRotationChangeRequestCallback listener) raises(WebAPIException);
    void removeChangeRequestListener(long watchId) raises(WebAPIException);
  };
  [NoInterfaceObject] interface MediaControllerClientInfo {
    readonly attribute ApplicationId name;
    void sendEvent(DOMString eventName, Bundle? data, MediaControllerSendCommandSuccessCallback successCallback)
                   raises(WebAPIException);
  };
  [NoInterfaceObject] interface MediaControllerDisplayRotationInfo {
    readonly attribute MediaControllerDisplayRotationType displayRotation raises(WebAPIException);
    void sendRequest(MediaControllerDisplayRotationType displayRotation, MediaControllerSendCommandSuccessCallback replyCallback)
                     raises(WebAPIException);
    long addDisplayRotationChangeListener(MediaControllerDisplayRotationChangeCallback listener) raises(WebAPIException);
    void removeDisplayRotationChangeListener(long watchId) raises(WebAPIException);
  };
  [NoInterfaceObject] interface MediaControllerMetadata {
    attribute DOMString title;
    attribute DOMString artist;
    attribute DOMString album;
    attribute DOMString author;
    attribute DOMString genre;
    attribute DOMString duration;
    attribute DOMString date;
    attribute DOMString copyright;
    attribute DOMString description;
    attribute DOMString trackNum;
    attribute DOMString picture;
    attribute long seasonNumber;
    attribute DOMString? seasonTitle;
    attribute long episodeNumber;
    attribute DOMString? episodeTitle;
    attribute long resolutionWidth;
    attribute long resolutionHeight;
  };
  [NoInterfaceObject] interface MediaControllerPlaylistItem {
    readonly attribute DOMString index;
    readonly attribute MediaControllerMetadata metadata;
  };
  [NoInterfaceObject] interface MediaControllerPlaylist {
    readonly attribute DOMString name;
    void addItem(DOMString index, MediaControllerMetadataInit metadata) raises(WebAPIException);
    void getItems(MediaControllerGetItemsSuccessCallback successCallback, optional ErrorCallback? errorCallback)
                  raises(WebAPIException);
  };
  [Constructor(MediaControllerContentType contentType, optional MediaControllerSearchCategory category = "NO_CATEGORY", optional DOMString? keyword = null, optional Bundle? extraData = null)]
  interface SearchFilter {
    attribute MediaControllerContentType contentType raises(WebAPIException);
    attribute MediaControllerSearchCategory category raises(WebAPIException);
    attribute DOMString? keyword raises(WebAPIException);
    attribute Bundle? extraData;
  };
  [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerServerInfoArraySuccessCallback {
    void onsuccess(MediaControllerServerInfo[] servers);
  };
  [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerSendCommandSuccessCallback {
    void onsuccess(object? data, optional long code);
  };
  [Constructor(Bundle? data, optional long code = 0)]
  interface RequestReply {
    attribute Bundle? data;
    attribute long code;
  };
  [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerSearchRequestReplyCallback {
    void onreply(RequestReply? reply);
  };
  [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerSearchRequestCallback {
    RequestReply? onrequest(ApplicationId clientName, SearchFilter[] request);
  };
  [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerReceiveCommandCallback {
    RequestReply? onsuccess(ApplicationId senderAppName, DOMString command, object data);
  };
  [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerEnabledChangeRequestCallback {
    RequestReply? onreply(ApplicationId clientName, boolean enabled);
  };
  [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerEnabledChangeCallback {
    void onchange(boolean enabled);
  };
  [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerDisplayModeChangeRequestCallback {
    RequestReply? onreply(ApplicationId clientName, MediaControllerDisplayModeType mode);
  };
  [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerDisplayModeChangeCallback {
    void onchange(MediaControllerDisplayModeType mode);
  };
  [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerDisplayRotationChangeRequestCallback {
    RequestReply? onreply(ApplicationId clientName, MediaControllerDisplayRotationType displayRotation);
  };
  [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerDisplayRotationChangeCallback {
    void onchange(MediaControllerDisplayRotationType displayRotation);
  };
  [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerServerStatusChangeCallback {
    void onsuccess(MediaControllerServerState status);
  };
  [Callback, NoInterfaceObject] interface MediaControllerPlaybackInfoChangeCallback {
    void onplaybackchanged(MediaControllerPlaybackState state, unsigned long long position);
    void onshufflemodechanged(boolean mode);
    void onrepeatstatechanged(MediaControllerRepeatState state);
    void onmetadatachanged(MediaControllerMetadata metadata);
  };
  [Callback, NoInterfaceObject] interface MediaControllerChangeRequestPlaybackInfoCallback {
    void onplaybackstaterequest(MediaControllerPlaybackState state, ApplicationId clientName);
    void onplaybackpositionrequest(unsigned long long position, ApplicationId clientName);
    void onshufflemoderequest(boolean mode, ApplicationId clientName);
    void onrepeatstaterequest(MediaControllerRepeatState state, ApplicationId clientName);
    void onplaybackitemrequest(DOMString playlistName, DOMString index, MediaControllerPlaybackState state,
                               unsigned long long position, ApplicationId clientName);
  };
  [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerGetAllPlaylistsSuccessCallback {
    void onsuccess(MediaControllerPlaylist[] playlists);
  };
  [Callback, NoInterfaceObject] interface MediaControllerPlaylistUpdatedCallback {
    void onplaylistupdated(DOMString serverName, MediaControllerPlaylist playlist);
    void onplaylistdeleted(DOMString serverName, DOMString playlistName);
  };
  [Callback=FunctionOnly, NoInterfaceObject] interface MediaControllerGetItemsSuccessCallback {
    void onsuccess(MediaControllerPlaylistItem[] items);
  };
  [Callback, NoInterfaceObject] interface MediaControllerAbilityChangeCallback {
    void onplaybackabilitychanged(MediaControllerServerInfo server, MediaControllerPlaybackAbilitiesInfo abilities);
    void ondisplaymodeabilitychanged(MediaControllerServerInfo server, MediaControllerDisplayModeAbilitiesInfo abilities);
    void ondisplayrotationabilitychanged(MediaControllerServerInfo server, MediaControllerDisplayRotationAbilitiesInfo abilities);
    void onsimpleabilitychanged(MediaControllerServerInfo server, MediaControllerSimpleAbility type,
                                MediaControllerAbilitySupport support);
  };
};