From: Dawid Juszczak Date: Wed, 13 Nov 2019 09:43:36 +0000 (+0100) Subject: [mediacontroller] deleting useless lines X-Git-Tag: accepted/tizen/unified/20191212.123659~2^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F02%2F217702%2F4;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [mediacontroller] deleting useless lines [description] this commit deletes unused attribute names (in js file) and special cases for TOGGLE_PLAY_PAUSE [verification] tct-mediacontroller-tizen-tests 100% PASS Change-Id: I723c1cc525a35c48eb9ae854bd154b5cd3c9b2df Signed-off-by: Dawid Juszczak --- diff --git a/src/mediacontroller/mediacontroller_api.js b/src/mediacontroller/mediacontroller_api.js index fcefe3f..e5d1177 100755 --- a/src/mediacontroller/mediacontroller_api.js +++ b/src/mediacontroller/mediacontroller_api.js @@ -1269,35 +1269,38 @@ var MediaControllerPlaybackAbilitiesInfo = function(serverName) { Object.defineProperties(this, { play: { get: function() { - return getPlaybackAbility(serverName, MediaControllerPlaybackState.PLAY); + return getPlaybackAbility(serverName, MediaControllerPlaybackAction.PLAY); }, set: function() {}, enumerable: true }, pause: { get: function() { - return getPlaybackAbility(serverName, MediaControllerPlaybackState.PAUSE); + return getPlaybackAbility( + serverName, + MediaControllerPlaybackAction.PAUSE + ); }, set: function() {}, enumerable: true }, stop: { get: function() { - return getPlaybackAbility(serverName, MediaControllerPlaybackState.STOP); + return getPlaybackAbility(serverName, MediaControllerPlaybackAction.STOP); }, set: function() {}, enumerable: true }, next: { get: function() { - return getPlaybackAbility(serverName, MediaControllerPlaybackState.NEXT); + return getPlaybackAbility(serverName, MediaControllerPlaybackAction.NEXT); }, set: function() {}, enumerable: true }, prev: { get: function() { - return getPlaybackAbility(serverName, MediaControllerPlaybackState.PREV); + return getPlaybackAbility(serverName, MediaControllerPlaybackAction.PREV); }, set: function() {}, enumerable: true @@ -1306,7 +1309,7 @@ var MediaControllerPlaybackAbilitiesInfo = function(serverName) { get: function() { return getPlaybackAbility( serverName, - MediaControllerPlaybackState.FORWARD + MediaControllerPlaybackAction.FORWARD ); }, set: function() {}, @@ -1316,7 +1319,7 @@ var MediaControllerPlaybackAbilitiesInfo = function(serverName) { get: function() { return getPlaybackAbility( serverName, - MediaControllerPlaybackState.REWIND + MediaControllerPlaybackAction.REWIND ); }, set: function() {}, @@ -1324,7 +1327,10 @@ var MediaControllerPlaybackAbilitiesInfo = function(serverName) { }, togglePlayPause: { get: function() { - return getPlaybackAbility(serverName, 'TOGGLE_PLAY_PAUSE'); + return getPlaybackAbility( + serverName, + MediaControllerPlaybackAction.TOGGLE_PLAY_PAUSE + ); }, set: function() {}, enumerable: true @@ -1500,7 +1506,7 @@ MediaControllerSubtitles.prototype.addChangeRequestListener = function() { return MediaControllerSubtitlesListener.addListener(args.listener); }; -MediaControllerSubtitles.prototype.removeChangeRequestListener = function(watchId) { +MediaControllerSubtitles.prototype.removeChangeRequestListener = function() { var args = validator_.validateArgs(arguments, [ { name: 'watchId', type: types_.LONG } ]); @@ -1580,7 +1586,7 @@ var MediaControllerSubtitlesInfo = function(name) { ReplyCommandListener.requestIdToListenerId[replyListenerId] = result.requestId; }; - this.addModeChangeListener = function(listener) { + this.addModeChangeListener = function() { var args = validator_.validateArgs(arguments, [ { name: 'listener', type: types_.FUNCTION } ]); @@ -1599,7 +1605,7 @@ var MediaControllerSubtitlesInfo = function(name) { return SubtitlesChangeListener.addServerInfoListener(args.listener, _serverName); }; - this.removeModeChangeListener = function(watchId) { + this.removeModeChangeListener = function() { var args = validator_.validateArgs(arguments, [ { name: 'watchId', type: types_.LONG } ]); @@ -1692,7 +1698,7 @@ MediaControllerMode360.prototype.addChangeRequestListener = function() { return MediaControllerMode360Listener.addListener(args.listener); }; -MediaControllerMode360.prototype.removeChangeRequestListener = function(watchId) { +MediaControllerMode360.prototype.removeChangeRequestListener = function() { var args = validator_.validateArgs(arguments, [ { name: 'watchId', type: types_.LONG } ]); @@ -1772,7 +1778,7 @@ var MediaControllerMode360Info = function(name) { ReplyCommandListener.requestIdToListenerId[replyListenerId] = result.requestId; }; - this.addModeChangeListener = function(listener) { + this.addModeChangeListener = function() { var args = validator_.validateArgs(arguments, [ { name: 'listener', type: types_.FUNCTION } ]); @@ -1791,7 +1797,7 @@ var MediaControllerMode360Info = function(name) { return Mode360ChangeListener.addServerInfoListener(args.listener, _serverName); }; - this.removeModeChangeListener = function(watchId) { + this.removeModeChangeListener = function() { var args = validator_.validateArgs(arguments, [ { name: 'watchId', type: types_.LONG } ]); @@ -1818,7 +1824,7 @@ var MediaControllerDisplayMode = function() { get: function() { return _type; }, - set: function(v) { + set: function() { var args = validator_.validateArgs(arguments, [ { name: 'type', @@ -1891,7 +1897,7 @@ MediaControllerDisplayMode.prototype.addChangeRequestListener = function() { return MediaControllerDisplayModeListener.addListener(args.listener); }; -MediaControllerDisplayMode.prototype.removeChangeRequestListener = function(watchId) { +MediaControllerDisplayMode.prototype.removeChangeRequestListener = function() { var args = validator_.validateArgs(arguments, [ { name: 'watchId', type: types_.LONG } ]); @@ -1972,7 +1978,7 @@ var MediaControllerDisplayModeInfo = function(name) { ReplyCommandListener.requestIdToListenerId[replyListenerId] = result.requestId; }; - this.addModeChangeListener = function(listener) { + this.addModeChangeListener = function() { var args = validator_.validateArgs(arguments, [ { name: 'listener', type: types_.FUNCTION } ]); @@ -1993,7 +1999,7 @@ var MediaControllerDisplayModeInfo = function(name) { _serverName ); }; - this.removeModeChangeListener = function(watchId) { + this.removeModeChangeListener = function() { var args = validator_.validateArgs(arguments, [ { name: 'watchId', type: types_.LONG } ]); @@ -2020,7 +2026,7 @@ var MediaControllerDisplayRotation = function() { get: function() { return _displayRotation; }, - set: function(v) { + set: function() { var args = validator_.validateArgs(arguments, [ { name: 'displayRotation', @@ -2091,7 +2097,7 @@ MediaControllerDisplayRotation.prototype.addChangeRequestListener = function() { return MediaControllerDisplayRotationListener.addListener(args.listener); }; -MediaControllerDisplayRotation.prototype.removeChangeRequestListener = function(watchId) { +MediaControllerDisplayRotation.prototype.removeChangeRequestListener = function() { var args = validator_.validateArgs(arguments, [ { name: 'watchId', type: types_.LONG } ]); @@ -2174,7 +2180,7 @@ var MediaControllerDisplayRotationInfo = function(name) { ReplyCommandListener.requestIdToListenerId[replyListenerId] = result.requestId; }; - this.addDisplayRotationChangeListener = function(listener) { + this.addDisplayRotationChangeListener = function() { var args = validator_.validateArgs(arguments, [ { name: 'listener', type: types_.FUNCTION } ]); @@ -2196,7 +2202,7 @@ var MediaControllerDisplayRotationInfo = function(name) { ); }; - this.removeDisplayRotationChangeListener = function(watchId) { + this.removeDisplayRotationChangeListener = function() { var args = validator_.validateArgs(arguments, [ { name: 'watchId', type: types_.LONG } ]); @@ -2279,7 +2285,7 @@ MediaControllerServer.prototype.updatePlaybackState = function(state) { this.playback.state = state; }; -var updatePlaybackState = function(state) { +var updatePlaybackState = function() { var args = validator_.validateArgs(arguments, [ { name: 'state', @@ -2304,7 +2310,7 @@ MediaControllerServer.prototype.updateIconURI = function(iconURI) { updateIconURI(iconURI); }; -var updateIconURI = function(iconURI) { +var updateIconURI = function() { var args = validator_.validateArgs(arguments, [ { name: 'iconURI', type: types_.STRING, nullable: true } ]); @@ -2322,7 +2328,7 @@ var updateIconURI = function(iconURI) { } }; -MediaControllerServer.prototype.updatePlaybackPosition = function(position) { +MediaControllerServer.prototype.updatePlaybackPosition = function() { utils_.printDeprecationWarningFor('updatePlaybackPosition()'); var args = validator_.validateArgs(arguments, [ { name: 'position', type: types_.UNSIGNED_LONG_LONG } @@ -2358,7 +2364,7 @@ MediaControllerServer.prototype.updatePlaybackAgeRating = function(rating) { this.playback.ageRating = rating; }; -var updatePlaybackAgeRating = function(rating) { +var updatePlaybackAgeRating = function() { var args = validator_.validateArgs(arguments, [ { name: 'rating', @@ -2382,7 +2388,7 @@ MediaControllerServer.prototype.updatePlaybackContentType = function(contentType this.playback.contentType = contentType; }; -var updatePlaybackContentType = function(contentType) { +var updatePlaybackContentType = function() { var args = validator_.validateArgs(arguments, [ { name: 'contentType', @@ -2422,7 +2428,7 @@ var updateShuffleMode = function() { } }; -MediaControllerServer.prototype.updateRepeatMode = function(mode) { +MediaControllerServer.prototype.updateRepeatMode = function() { utils_.printDeprecationWarningFor('updateRepeatMode()', 'updateRepeatState()'); var args = validator_.validateArgs(arguments, [ { name: 'mode', type: types_.BOOLEAN } @@ -2451,7 +2457,7 @@ MediaControllerServer.prototype.updateRepeatState = function(state) { this.playback.repeatState = state; }; -var updateRepeatState = function(state) { +var updateRepeatState = function() { var args = validator_.validateArgs(arguments, [ { name: 'state', @@ -2471,7 +2477,7 @@ var updateRepeatState = function(state) { } }; -MediaControllerServer.prototype.updateMetadata = function(metadata) { +MediaControllerServer.prototype.updateMetadata = function() { utils_.printDeprecationWarningFor( 'updateMetadata()', 'MediaControllerMetadata.save()' @@ -2489,9 +2495,7 @@ MediaControllerServer.prototype.updateMetadata = function(metadata) { this.playback.metadata.save(); }; -MediaControllerServer.prototype.addChangeRequestPlaybackInfoListener = function( - listener -) { +MediaControllerServer.prototype.addChangeRequestPlaybackInfoListener = function() { utils_.printDeprecationWarningFor( 'MediaControllerServer.addChangeRequestPlaybackInfoListener()', 'MediaControllerServerPlaybackInfo.addChangeRequestListener()' @@ -2538,7 +2542,7 @@ MediaControllerServer.prototype.removeChangeRequestPlaybackInfoListener = functi removeChangeRequestPlaybackInfoListener(watchId); }; -var removeChangeRequestPlaybackInfoListener = function(watchId) { +var removeChangeRequestPlaybackInfoListener = function() { var args = validator_.validateArgs(arguments, [ { name: 'watchId', type: types_.LONG } ]); @@ -2550,7 +2554,7 @@ var removeChangeRequestPlaybackInfoListener = function(watchId) { } }; -MediaControllerServer.prototype.addCommandListener = function(listener) { +MediaControllerServer.prototype.addCommandListener = function() { var args = validator_.validateArgs(arguments, [ { name: 'listener', type: types_.FUNCTION } ]); @@ -2567,7 +2571,7 @@ MediaControllerServer.prototype.addCommandListener = function(listener) { return ServerCommandListener.addListener(args.listener); }; -MediaControllerServer.prototype.removeCommandListener = function(watchId) { +MediaControllerServer.prototype.removeCommandListener = function() { var args = validator_.validateArgs(arguments, [ { name: 'watchId', type: types_.LONG } ]); @@ -2605,11 +2609,7 @@ var createPlaylist = function() { return new MediaControllerPlaylist(native_.getResultObject(result)); }; -MediaControllerServer.prototype.savePlaylist = function( - playlist, - successCallback, - errorCallback -) { +MediaControllerServer.prototype.savePlaylist = function() { utils_.printDeprecationWarningFor( 'MediaControllerServer.savePlaylist()', 'MediaControllerPlaylists.savePlaylist()' @@ -2617,7 +2617,7 @@ MediaControllerServer.prototype.savePlaylist = function( savePlaylist.apply(this, arguments); }; -var savePlaylist = function(playlist, successCallback, errorCallback) { +var savePlaylist = function() { var args = validator_.validateArgs(arguments, [ { name: 'playlist', @@ -2652,11 +2652,7 @@ var savePlaylist = function(playlist, successCallback, errorCallback) { } }; -MediaControllerServer.prototype.deletePlaylist = function( - playlistName, - successCallback, - errorCallback -) { +MediaControllerServer.prototype.deletePlaylist = function() { utils_.printDeprecationWarningFor( 'MediaControllerServer.deletePlaylist()', 'MediaControllerPlaylists.deletePlaylist()' @@ -2664,7 +2660,7 @@ MediaControllerServer.prototype.deletePlaylist = function( deletePlaylist.apply(this, arguments); }; -var deletePlaylist = function(playlistName, successCallback, errorCallback) { +var deletePlaylist = function() { var args = validator_.validateArgs(arguments, [ { name: 'playlistName', type: types_.STRING }, { @@ -2707,7 +2703,7 @@ MediaControllerServer.prototype.updatePlaybackItem = function(playlistName, inde edit_.disallow(); }; -var updatePlaybackItem = function(playlistName, index) { +var updatePlaybackItem = function() { var args = validator_.validateArgs(arguments, [ { name: 'playlistName', type: types_.STRING }, { name: 'index', type: types_.STRING } @@ -2725,10 +2721,7 @@ var updatePlaybackItem = function(playlistName, index) { } }; -MediaControllerServer.prototype.getAllPlaylists = function( - successCallback, - errorCallback -) { +MediaControllerServer.prototype.getAllPlaylists = function() { utils_.printDeprecationWarningFor( 'MediaControllerServer.getAllPlaylists()', 'MediaControllerPlaylists.getAllPlaylists()' @@ -2736,7 +2729,7 @@ MediaControllerServer.prototype.getAllPlaylists = function( serverGetAllPlaylists.apply(this, arguments); }; -var serverGetAllPlaylists = function(successCallback, errorCallback) { +var serverGetAllPlaylists = function() { var args = validator_.validateArgs(arguments, [ { name: 'successCallback', @@ -2774,7 +2767,7 @@ function RequestReply(data, code) { this.data = xwalk.utils.type.isNullOrUndefined(data) ? null : new tizen.Bundle(data); } -MediaControllerServer.prototype.setSearchRequestListener = function(listener) { +MediaControllerServer.prototype.setSearchRequestListener = function() { var args = validator_.validateArgs(arguments, [ { name: 'listener', type: types_.FUNCTION } ]); @@ -2856,7 +2849,7 @@ var getSimpleAbility = function(name, type) { return ability.value; }; -var setSimpleAbility = function(abilityType, support) { +var setSimpleAbility = function() { var args = validator_.validateArgs(arguments, [ { name: 'abilityType', @@ -2889,7 +2882,7 @@ var setSimpleAbility = function(abilityType, support) { } }; -var checkSupportValue = function(support) { +var checkSupportValue = function() { var args = validator_.validateArgs(arguments, [ { name: 'support', @@ -2990,7 +2983,7 @@ function MediaControllerClientInfo(data) { }); } -MediaControllerClientInfo.prototype.sendEvent = function(event, data, callback) { +MediaControllerClientInfo.prototype.sendEvent = function() { var args = validator_.validateArgs(arguments, [ { name: 'eventName', type: types_.STRING }, { name: 'eventData', type: types_.DICTIONARY, nullable: true }, @@ -3050,7 +3043,7 @@ var EventReceivedCallback = function(msg, listener) { } }; -MediaControllerClient.prototype.setCustomEventListener = function(listener) { +MediaControllerClient.prototype.setCustomEventListener = function() { var args = validator_.validateArgs(arguments, [ { name: 'listener', type: types_.FUNCTION } ]); @@ -3079,7 +3072,7 @@ MediaControllerClient.prototype.unsetCustomEventListener = function() { } }; -MediaControllerClient.prototype.findServers = function(successCallback, errorCallback) { +MediaControllerClient.prototype.findServers = function() { var args = validator_.validateArgs(arguments, [ { name: 'successCallback', type: types_.FUNCTION }, { name: 'errorCallback', type: types_.FUNCTION, optional: true, nullable: true } @@ -3166,7 +3159,7 @@ function SearchFilter(contentType, category, keyword, extraData) { get: function() { return contentType_; }, - set: function(newContentType) { + set: function() { var args = validator_.validateArgs(arguments, [ { name: 'newContentType', @@ -3182,7 +3175,7 @@ function SearchFilter(contentType, category, keyword, extraData) { get: function() { return category_; }, - set: function(newCategory) { + set: function() { var args = validator_.validateArgs(arguments, [ { name: 'newCategory', @@ -3207,7 +3200,7 @@ function SearchFilter(contentType, category, keyword, extraData) { get: function() { return keyword_; }, - set: function(newKeyword) { + set: function() { var args = validator_.validateArgs(arguments, [ { name: 'newKeyword', @@ -3244,7 +3237,7 @@ function SearchFilter(contentType, category, keyword, extraData) { }); } -MediaControllerClient.prototype.addAbilityChangeListener = function(callback) { +MediaControllerClient.prototype.addAbilityChangeListener = function() { var args = validator_.validateArgs(arguments, [ { name: 'callback', @@ -3274,7 +3267,7 @@ MediaControllerClient.prototype.addAbilityChangeListener = function(callback) { return ClientAbilityChangeListener.addListener(args.callback); }; -MediaControllerClient.prototype.removeAbilityChangeListener = function(callbackId) { +MediaControllerClient.prototype.removeAbilityChangeListener = function() { var args = validator_.validateArgs(arguments, [ { name: 'callbackId', @@ -3292,10 +3285,7 @@ MediaControllerClient.prototype.removeAbilityChangeListener = function(callbackI } }; -MediaControllerClient.prototype.findSubscribedServers = function( - successCallback, - errorCallback -) { +MediaControllerClient.prototype.findSubscribedServers = function() { var args = validator_.validateArgs(arguments, [ { name: 'successCallback', @@ -3414,11 +3404,7 @@ function MediaControllerServerInfo(data) { }); } -MediaControllerServerInfo.prototype.sendPlaybackState = function( - state, - successCallback, - errorCallback -) { +MediaControllerServerInfo.prototype.sendPlaybackState = function() { utils_.printDeprecationWarningFor( 'MediaControllerServerInfo.sendPlaybackState()', 'MediaControllerServerInfoPlaybackInfo.sendPlaybackAction()' @@ -3455,11 +3441,7 @@ MediaControllerServerInfo.prototype.sendPlaybackState = function( native_.call('MediaControllerServerInfoSendPlaybackState', data, callback); }; -MediaControllerServerInfo.prototype.sendPlaybackPosition = function( - position, - successCallback, - errorCallback -) { +MediaControllerServerInfo.prototype.sendPlaybackPosition = function() { utils_.printDeprecationWarningFor( 'MediaControllerServerInfo.sendPlaybackPosition()', 'MediaControllerServerInfoPlaybackInfo.sendPlaybackPosition()' @@ -3495,11 +3477,7 @@ MediaControllerServerInfo.prototype.sendPlaybackPosition = function( native_.call('MediaControllerServerInfoSendPlaybackPosition', data, callback); }; -MediaControllerServerInfo.prototype.sendShuffleMode = function( - mode, - successCallback, - errorCallback -) { +MediaControllerServerInfo.prototype.sendShuffleMode = function() { utils_.printDeprecationWarningFor( 'MediaControllerServerInfo.sendShuffleMode()', 'MediaControllerServerInfoPlaybackInfo.sendShuffleMode()' @@ -3530,11 +3508,7 @@ MediaControllerServerInfo.prototype.sendShuffleMode = function( native_.call('MediaControllerServerInfoSendShuffleMode', data, callback); }; -MediaControllerServerInfo.prototype.sendRepeatMode = function( - mode, - successCallback, - errorCallback -) { +MediaControllerServerInfo.prototype.sendRepeatMode = function() { utils_.printDeprecationWarningFor('sendRepeatMode()', 'sendRepeatState()'); var args = validator_.validateArgs(arguments, [ { name: 'mode', type: types_.BOOLEAN }, @@ -3562,11 +3536,7 @@ MediaControllerServerInfo.prototype.sendRepeatMode = function( native_.call('MediaControllerServerInfoSendRepeatMode', data, callback); }; -MediaControllerServerInfo.prototype.sendRepeatState = function( - state, - successCallback, - errorCallback -) { +MediaControllerServerInfo.prototype.sendRepeatState = function() { utils_.printDeprecationWarningFor( 'MediaControllerServerInfo.sendRepeatState()', 'MediaControllerServerInfoPlaybackInfo.sendRepeatState()' @@ -3601,12 +3571,7 @@ MediaControllerServerInfo.prototype.sendRepeatState = function( native_.call('MediaControllerServerInfoSendRepeatState', data, callback); }; -MediaControllerServerInfo.prototype.sendCommand = function( - command, - data, - successCallback, - errorCallback -) { +MediaControllerServerInfo.prototype.sendCommand = function() { var args = validator_.validateArgs(arguments, [ { name: 'command', type: types_.STRING }, { name: 'data', type: types_.DICTIONARY, nullable: true }, @@ -3642,11 +3607,7 @@ MediaControllerServerInfo.prototype.sendCommand = function( ReplyCommandListener.requestIdToListenerId[replyListenerId] = result.requestId; }; -MediaControllerServerInfo.prototype.sendSearchRequest = function( - request, - successCallback, - errorCallback -) { +MediaControllerServerInfo.prototype.sendSearchRequest = function() { var args = validator_.validateArgs(arguments, [ { name: 'request', type: types_.ARRAY, values: SearchFilter }, { name: 'successCallback', type: types_.FUNCTION }, @@ -3688,7 +3649,7 @@ MediaControllerServerInfo.prototype.sendSearchRequest = function( ReplyCommandListener.requestIdToListenerId[replyListenerId] = result.requestId; }; -MediaControllerServerInfo.prototype.addServerStatusChangeListener = function(listener) { +MediaControllerServerInfo.prototype.addServerStatusChangeListener = function() { var args = validator_.validateArgs(arguments, [ { name: 'listener', type: types_.FUNCTION } ]); @@ -3707,7 +3668,7 @@ MediaControllerServerInfo.prototype.addServerStatusChangeListener = function(lis return ServerInfoStatusListener.addServerInfoListener(args.listener, this.name); }; -MediaControllerServerInfo.prototype.removeServerStatusChangeListener = function(watchId) { +MediaControllerServerInfo.prototype.removeServerStatusChangeListener = function() { var args = validator_.validateArgs(arguments, [ { name: 'watchId', type: types_.LONG } ]); @@ -3728,7 +3689,7 @@ MediaControllerServerInfo.prototype.addPlaybackInfoChangeListener = function(lis return addPlaybackInfoChangeListener.apply(this, args); }; -var addPlaybackInfoChangeListener = function(serverName, listener) { +var addPlaybackInfoChangeListener = function() { var args = validator_.validateArgs(arguments, [ { name: 'serverName', @@ -3773,7 +3734,7 @@ MediaControllerServerInfo.prototype.removePlaybackInfoChangeListener = function( removePlaybackInfoChangeListener(watchId); }; -var removePlaybackInfoChangeListener = function(watchId) { +var removePlaybackInfoChangeListener = function() { var args = validator_.validateArgs(arguments, [ { name: 'watchId', type: types_.LONG } ]); @@ -3785,10 +3746,7 @@ var removePlaybackInfoChangeListener = function(watchId) { } }; -MediaControllerServerInfo.prototype.getAllPlaylists = function( - successCallback, - errorCallback -) { +MediaControllerServerInfo.prototype.getAllPlaylists = function() { utils_.printDeprecationWarningFor( 'MediaControllerServerInfo.getAllPlaylists', 'MediaControllerPlaylistsInfo.getAllPlaylists' @@ -3797,7 +3755,7 @@ MediaControllerServerInfo.prototype.getAllPlaylists = function( serverInfoGetAllPlaylists.apply(this, args); }; -var serverInfoGetAllPlaylists = function(serverName, successCallback, errorCallback) { +var serverInfoGetAllPlaylists = function() { var args = validator_.validateArgs(arguments, [ { name: 'serverName', @@ -3829,7 +3787,7 @@ var serverInfoGetAllPlaylists = function(serverName, successCallback, errorCallb var result = native_.call( 'MediaControllerServerInfoGetAllPlaylists', - { name: args.serverName }, + { serverName: args.serverName }, callback ); @@ -3838,12 +3796,7 @@ var serverInfoGetAllPlaylists = function(serverName, successCallback, errorCallb } }; -MediaControllerServerInfo.prototype.sendPlaybackItem = function( - playlistName, - index, - state, - position -) { +MediaControllerServerInfo.prototype.sendPlaybackItem = function() { utils_.printDeprecationWarningFor( 'MediaControllerServerInfo.sendPlaybackItem()', 'MediaControllerPlaylistsInfo.sendPlaybackItem()' @@ -3874,7 +3827,7 @@ MediaControllerServerInfo.prototype.sendPlaybackItem = function( } }; -MediaControllerServerInfo.prototype.addPlaylistUpdatedListener = function(listener) { +MediaControllerServerInfo.prototype.addPlaylistUpdatedListener = function() { utils_.printDeprecationWarningFor( 'MediaControllerServerInfo.addPlaylistUpdatedListener()', 'MediaControllerPlaylistsInfo.addPlaylistUpdateListener()' @@ -3883,7 +3836,7 @@ MediaControllerServerInfo.prototype.addPlaylistUpdatedListener = function(listen return addPlaylistUpdateListener.apply(this, args); }; -var addPlaylistUpdateListener = function(serverName, listener) { +var addPlaylistUpdateListener = function() { var args = validator_.validateArgs(arguments, [ { name: 'serverName', @@ -3919,7 +3872,7 @@ MediaControllerServerInfo.prototype.removePlaylistUpdatedListener = function(wat removePlaylistUpdateListener(watchId); }; -var removePlaylistUpdateListener = function(watchId) { +var removePlaylistUpdateListener = function() { var args = validator_.validateArgs(arguments, [ { name: 'watchId', type: types_.LONG } ]); @@ -3997,7 +3950,7 @@ function MediaControllerPlaylist(data) { edit_.disallow(); } -MediaControllerPlaylist.prototype.addItem = function(index, metadata) { +MediaControllerPlaylist.prototype.addItem = function() { var args = validator_.validateArgs(arguments, [ { name: 'index', type: types_.STRING }, { name: 'metadata', type: types_.DICTIONARY } @@ -4016,7 +3969,7 @@ MediaControllerPlaylist.prototype.addItem = function(index, metadata) { } }; -MediaControllerPlaylist.prototype.getItems = function(successCallback, errorCallback) { +MediaControllerPlaylist.prototype.getItems = function() { var args = validator_.validateArgs(arguments, [ { name: 'successCallback', @@ -4202,9 +4155,7 @@ MediaControllerServerPlaybackInfo.prototype.updatePlaybackItem = function( edit_.disallow(); }; -MediaControllerServerPlaybackInfo.prototype.addChangeRequestListener = function( - listener -) { +MediaControllerServerPlaybackInfo.prototype.addChangeRequestListener = function() { var args = validator_.validateArgs(arguments, [ { name: 'listener', @@ -4404,48 +4355,31 @@ var sendRequestWithReply = function( var MediaControllerPlaylists = function() {}; -MediaControllerPlaylists.prototype.createPlaylist = function(name) { +MediaControllerPlaylists.prototype.createPlaylist = function() { return createPlaylist.apply(this, arguments); }; -MediaControllerPlaylists.prototype.savePlaylist = function( - playlist, - successCallback, - errorCallback -) { +MediaControllerPlaylists.prototype.savePlaylist = function() { savePlaylist.apply(this, arguments); }; -MediaControllerPlaylists.prototype.deletePlaylist = function( - playlistName, - successCallback, - errorCallback -) { +MediaControllerPlaylists.prototype.deletePlaylist = function() { deletePlaylist.apply(this, arguments); }; -MediaControllerPlaylists.prototype.getAllPlaylists = function( - successCallback, - errorCallback -) { +MediaControllerPlaylists.prototype.getAllPlaylists = function() { serverGetAllPlaylists.apply(this, arguments); }; var MediaControllerPlaylistsInfo = function(serverName) { var _serverName = serverName; - this.getAllPlaylists = function(successCallback, errorCallback) { + this.getAllPlaylists = function() { var args = [_serverName].concat(Array.prototype.slice.call(arguments)); serverInfoGetAllPlaylists.apply(this, args); }; - this.sendPlaybackItem = function( - playlistName, - index, - action, - position, - replyCallback - ) { + this.sendPlaybackItem = function() { var args = validator_.validateArgs(arguments, [ { name: 'playlistName', type: types_.STRING }, { name: 'index', type: types_.STRING }, @@ -4493,7 +4427,7 @@ var MediaControllerPlaylistsInfo = function(serverName) { ReplyCommandListener.requestIdToListenerId[replyListenerId] = result.requestId; }; - this.addPlaylistUpdateListener = function(listener) { + this.addPlaylistUpdateListener = function() { var args = [_serverName].concat(Array.prototype.slice.call(arguments)); return addPlaylistUpdateListener.apply(this, args); }; diff --git a/src/mediacontroller/mediacontroller_instance.cc b/src/mediacontroller/mediacontroller_instance.cc index 2b97ad4..6ae35ed 100644 --- a/src/mediacontroller/mediacontroller_instance.cc +++ b/src/mediacontroller/mediacontroller_instance.cc @@ -743,7 +743,6 @@ void MediaControllerInstance::MediaControllerServerSavePlaybackAbilities( for (auto e : types::MediaControllerPlaybackActionEnum) { CHECK_ARGS(args, e.first, std::string, out); } - CHECK_ARGS(args, "TOGGLE_PLAY_PAUSE", std::string, out) const PlatformResult& result = server_->SavePlaybackAbilities(args); if (!result) { @@ -1618,7 +1617,7 @@ void MediaControllerInstance::MediaControllerServerInfoGetAllPlaylists(const pic picojson::object& out) { ScopeLogger(); - CHECK_ARGS(args, kName, std::string, out) + CHECK_ARGS(args, kServerName, std::string, out) auto get = [this, args]() -> void { picojson::value response = picojson::value(picojson::object()); @@ -1628,7 +1627,7 @@ void MediaControllerInstance::MediaControllerServerInfoGetAllPlaylists(const pic picojson::value playlists{picojson::array{}}; - auto result = utils::GetAllPlaylists(args.get(kName).get(), + auto result = utils::GetAllPlaylists(args.get(kServerName).get(), &playlists.get()); if (!result) { diff --git a/src/mediacontroller/mediacontroller_server.cc b/src/mediacontroller/mediacontroller_server.cc index 50ef65c..2d6e961 100644 --- a/src/mediacontroller/mediacontroller_server.cc +++ b/src/mediacontroller/mediacontroller_server.cc @@ -713,17 +713,11 @@ PlatformResult MediaControllerServer::SetPlaybackAbility(const std::string& acti } mc_playback_action_e action_e; - // Currently MediaControllerPlaybackActionEnum does not have member "TOGGLE_PLAY_PAUSE". - // It should be fixed in the future. - if ("TOGGLE_PLAY_PAUSE" == action) { - action_e = MC_PLAYBACK_ACTION_TOGGLE_PLAY_PAUSE; - } else { - result = types::MediaControllerPlaybackActionEnum.getValue(action, &action_e); - if (!result) { - return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "Error getting value of playback action", - ("MediaControllerPlaybackActionEnum.getValue() failed, error: %s", - result.message().c_str())); - } + result = types::MediaControllerPlaybackActionEnum.getValue(action, &action_e); + if (!result) { + return LogAndCreateResult(ErrorCode::UNKNOWN_ERR, "Error getting value of playback action", + ("MediaControllerPlaybackActionEnum.getValue() failed, error: %s", + result.message().c_str())); } mc_ability_support_e support; @@ -756,13 +750,8 @@ PlatformResult MediaControllerServer::SetPlaybackAbility(const std::string& acti PlatformResult MediaControllerServer::SavePlaybackAbilities(const picojson::value& abilities) { ScopeLogger(); bool is_changed = false; - // Currently MediaControllerPlaybackActionEnum does not have member "TOGGLE_PLAY_PAUSE". - // It should be fixed in the future. - PlatformResult result = SetPlaybackAbility( - "TOGGLE_PLAY_PAUSE", abilities.get("TOGGLE_PLAY_PAUSE").get(), &is_changed); - if (!result) { - return result; - } + PlatformResult result = PlatformResult(ErrorCode::NO_ERROR); + for (auto action : types::MediaControllerPlaybackActionEnum) { const std::string& action_str = action.first.c_str(); const std::string& support_str = abilities.get(action_str).get(); diff --git a/src/mediacontroller/mediacontroller_utils.cc b/src/mediacontroller/mediacontroller_utils.cc index 1bad105..6615a75 100644 --- a/src/mediacontroller/mediacontroller_utils.cc +++ b/src/mediacontroller/mediacontroller_utils.cc @@ -317,17 +317,12 @@ PlatformResult ConvertPlaybackAbility(mc_playback_ability_h ability_h, const std mc_ability_support_e ability_e; mc_playback_action_e action_e; - PlatformResult result = PlatformResult(ErrorCode::NO_ERROR); - - if ("TOGGLE_PLAY_PAUSE" == action) { - action_e = MC_PLAYBACK_ACTION_TOGGLE_PLAY_PAUSE; - } else { - result = MediaControllerPlaybackActionEnum.getValue(action, &action_e); - if (!result) { - LoggerE("MediaControllerPlaybackActionEnum.getValue() failed, error: %s", - result.message().c_str()); - return result; - } + + PlatformResult result = MediaControllerPlaybackActionEnum.getValue(action, &action_e); + if (!result) { + LoggerE("MediaControllerPlaybackActionEnum.getValue() failed, error: %s", + result.message().c_str()); + return result; } int ret = mc_playback_action_is_supported(ability_h, action_e, &ability_e);