[Mediacontroller] added display mode feature
[ACR] http://suprem.sec.samsung.net/jira/browse/TWDAPI-231
[Verification] Code compiles without errors.
Basic test in chrome console works properly.
/// 1. adding command listener
var mcServer = tizen.mediacontroller.createServer();
mcServer.updatePlaybackState("PLAY");
var changeListener = function(type, clientName)
{
console.log("Display mode change requested to: " + type + " by " + clientName);
return new tizen.mediacontroller.RequestReply(new tizen.Bundle({"message": "Not allowed"}), 13);
};
watcherId = mcServer.displayMode.addChangeRequestListener(changeListener);
/// 2. checking NotSupportedError when sending without enabled ability
var mcClient = tizen.mediacontroller.getClient();
var mcServerInfo = mcClient.getLatestServerInfo()
var type = "ORIGIN_SIZE";
mcServerInfo.displayMode.sendRequest(type,
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);
});
/// 3. register listener for mode changes (client side)
watcherId = mcServerInfo.displayMode.addModeChangeListener(function(type)
{
console.log(mcServerInfo.name + " server display mode changed to " + type);
});
/// 4. change the value of display mode (should trigger listener from point 3)
mcServer.displayMode.type = "FULL_SCREEN"
/// 4. enable ability of server
// TODO support: mcServer.abilities.displayMode.originSize = "YES"
/// sendRequest again (should trigger listener from point 1)
mcServerInfo.displayMode.sendRequest(type,
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);
});
Change-Id: Icbc98513372d8da8e111a44d873c6559dede89e9