'_ServerPlaybackInfoListener',
function(msg, listener) {
if (msg.action === 'onplaybackstaterequest') {
+ utils_.printDeprecationWarningFor(
+ 'onplaybackstaterequest',
+ 'onplaybackactionrequest'
+ );
+ native_.callIfPossible(listener[msg.action], msg.state, msg.clientName);
+ }
+ if (msg.action === 'onplaybackactionrequest') {
native_.callIfPossible(listener[msg.action], msg.state, msg.clientName);
}
if (msg.action === 'onplaybackpositionrequest') {
REWIND: 'REWIND'
};
+var MediaControllerPlaybackAction = {
+ PLAY: 'PLAY',
+ PAUSE: 'PAUSE',
+ STOP: 'STOP',
+ NEXT: 'NEXT',
+ PREV: 'PREV',
+ FORWARD: 'FORWARD',
+ REWIND: 'REWIND',
+ TOGGLE_PLAY_PAUSE: 'TOGGLE_PLAY_PAUSE'
+};
+
var MediaControllerRepeatState = {
REPEAT_OFF: 'REPEAT_OFF',
REPEAT_ONE: 'REPEAT_ONE',
return _iconURI;
},
set: function(v) {
- _iconURI = edit_.isAllowed ? (v ? v : null) : _iconURI;
+ updateIconURI(v);
+ _iconURI = v;
},
enumerable: true
},
};
MediaControllerServer.prototype.updateIconURI = function(iconURI) {
+ utils_.printDeprecationWarningFor('updateIconURI()');
+ updateIconURI(iconURI);
+};
+
+var updateIconURI = function(iconURI) {
var args = validator_.validateArgs(arguments, [
{ name: 'iconURI', type: types_.STRING, nullable: true }
]);
native_.getErrorObject(result).message
);
}
-
- edit_.allow();
- this.iconURI = args.iconURI;
- edit_.disallow();
};
MediaControllerServer.prototype.updatePlaybackPosition = function(position) {
MediaControllerServer.prototype.addChangeRequestPlaybackInfoListener = function(
listener
) {
+ utils_.printDeprecationWarningFor(
+ 'MediaControllerServer.addChangeRequestPlaybackInfoListener()',
+ 'MediaControllerServerPlaybackInfo.addChangeRequestListener()'
+ );
+
var args = validator_.validateArgs(arguments, [
{
name: 'listener',
type: types_.LISTENER,
values: [
'onplaybackstaterequest',
+ 'onplaybackactionrequest',
'onplaybackpositionrequest',
'onshufflemoderequest',
'onrepeatmoderequest',
MediaControllerServer.prototype.removeChangeRequestPlaybackInfoListener = function(
watchId
) {
+ utils_.printDeprecationWarningFor(
+ 'MediaControllerServer.removeChangeRequestPlaybackInfoListener()',
+ 'MediaControllerServerPlaybackInfo.removeChangeRequestListener()'
+ );
+ removeChangeRequestPlaybackInfoListener(watchId);
+};
+
+var removeChangeRequestPlaybackInfoListener = function(watchId) {
var args = validator_.validateArgs(arguments, [
{ name: 'watchId', type: types_.LONG }
]);
edit_.disallow();
};
+MediaControllerServerPlaybackInfo.prototype.addChangeRequestListener = function(
+ listener
+) {
+ var args = validator_.validateArgs(arguments, [
+ {
+ name: 'listener',
+ type: types_.LISTENER,
+ values: [
+ 'onplaybackstaterequest',
+ 'onplaybackactionrequest',
+ 'onplaybackpositionrequest',
+ 'onshufflemoderequest',
+ 'onrepeatmoderequest',
+ 'onrepeatstaterequest',
+ 'onplaybackitemrequest'
+ ]
+ }
+ ]);
+
+ if (type_.isEmptyObject(ServerPlaybackInfoListener.listeners)) {
+ var result = native_.callSync(
+ 'MediaControllerServerAddChangeRequestPlaybackInfoListener',
+ {
+ listenerId: ServerPlaybackInfoListener.listenerName
+ }
+ );
+ if (native_.isFailure(result)) {
+ throw native_.getErrorObject(result);
+ }
+ }
+
+ return ServerPlaybackInfoListener.addListener(args.listener);
+};
+
+MediaControllerServerPlaybackInfo.prototype.removeChangeRequestListener = function(
+ watchId
+) {
+ removeChangeRequestPlaybackInfoListener(watchId);
+};
+
function MediaControllerServerInfoPlaybackInfo(serverName, data) {
var _serverName = serverName; // this variable will be used in the future
MediaControllerServer* server = static_cast<MediaControllerServer*>(user_data);
- // Here, we need to convert mc_playback_action_e enum to mc_playback_states_e enum.
std::string action_str;
PlatformResult result = types::MediaControllerPlaybackActionEnum.getName(action, &action_str);
if (!result) {
picojson::value data = picojson::value(picojson::object());
picojson::object& data_o = data.get<picojson::object>();
- data_o[kAction] = picojson::value(std::string("onplaybackstaterequest"));
+ data_o[kAction] = picojson::value(std::string("onplaybackactionrequest"));
data_o[kState] = picojson::value(action_str);
data_o[kClientName] = picojson::value(client_name);
+ data_o[kRequestId] = request_id ? picojson::value(std::string(request_id)) : picojson::value();
server->change_request_playback_info_listener_(&data);
+
+ if ("TOGGLE_PLAY_PAUSE" != action_str) {
+ data_o[kAction] = picojson::value(std::string("onplaybackstaterequest"));
+ server->change_request_playback_info_listener_(&data);
+ }
}
void MediaControllerServer::OnPlaybackPositionCommand(const char* client_name,
{"REWIND", MC_PLAYBACK_STATE_REWINDING}};
const common::PlatformEnum<mc_playback_action_e> MediaControllerPlaybackActionEnum{
- {"PLAY", MC_PLAYBACK_ACTION_PLAY}, {"PAUSE", MC_PLAYBACK_ACTION_PAUSE},
- {"STOP", MC_PLAYBACK_ACTION_STOP}, {"NEXT", MC_PLAYBACK_ACTION_NEXT},
- {"PREV", MC_PLAYBACK_ACTION_PREV}, {"FORWARD", MC_PLAYBACK_ACTION_FAST_FORWARD},
- {"REWIND", MC_PLAYBACK_ACTION_REWIND}};
+ {"PLAY", MC_PLAYBACK_ACTION_PLAY},
+ {"PAUSE", MC_PLAYBACK_ACTION_PAUSE},
+ {"STOP", MC_PLAYBACK_ACTION_STOP},
+ {"NEXT", MC_PLAYBACK_ACTION_NEXT},
+ {"PREV", MC_PLAYBACK_ACTION_PREV},
+ {"FORWARD", MC_PLAYBACK_ACTION_FAST_FORWARD},
+ {"REWIND", MC_PLAYBACK_ACTION_REWIND},
+ {"TOGGLE_PLAY_PAUSE", MC_PLAYBACK_ACTION_TOGGLE_PLAY_PAUSE}};
const common::PlatformEnum<mc_meta_e> MediaControllerMetadataAttributeEnum{
{"title", MC_META_MEDIA_TITLE},