Skip to content

Commit 8bffb3b

Browse files
committed
implemented "embedded_player" remote media action;
1 parent 7756eec commit 8bffb3b

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

www/scripts/sepiaFW.webSocket.js

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2276,11 +2276,10 @@ function sepiaFW_build_webSocket_client(sepiaSessionId){
22762276
}else{
22772277
//handle
22782278
if (action.type == "audio_stream"){
2279-
//TODO: this works for internal player stream URLs ... what about embedded media player? Check supported URLs? Add flag?
22802279
if (action.streamURL){
22812280
//wait for opportunity and execute
22822281
SepiaFW.assistant.waitForOpportunitySayLocalTextAndRunAction(
2283-
SepiaFW.local.g('remote_action_audio_stream'),
2282+
SepiaFW.account.getUserName() + ", " + SepiaFW.local.g('remote_action_audio_stream'),
22842283
function(){
22852284
SepiaFW.ui.showInfo(SepiaFW.local.g('remote_action') + " - Media Audio Stream: " + (action.name || action.streamURL), false);
22862285
//SepiaFW.ui.showCustomChatMessage(msg);
@@ -2294,12 +2293,29 @@ function sepiaFW_build_webSocket_client(sepiaSessionId){
22942293
}
22952294
}else if (action.type == "control"){
22962295
//control audio (stop, pause, resume, next, ...)
2297-
if (SepiaFW.client.controls && action.controlAction){
2296+
if (action.controlAction){
22982297
SepiaFW.ui.showInfo(SepiaFW.local.g('remote_action') + " - Media Control: " + action.controlAction, false);
22992298
SepiaFW.client.controls.media({
23002299
action: action.controlAction
23012300
});
23022301
}
2302+
}else if (action.type == "embedded_player"){
2303+
//embedded media-player
2304+
if (action.playerData){
2305+
if (!action.playerData.data) action.playerData.data = {};
2306+
//wait for opportunity and execute
2307+
SepiaFW.assistant.waitForOpportunitySayLocalTextAndRunAction(
2308+
SepiaFW.account.getUserName() + ", " + SepiaFW.local.g('remote_action_media_player'),
2309+
function(){
2310+
SepiaFW.ui.showInfo(SepiaFW.local.g('remote_action') + " - Media Player: "
2311+
+ (action.playerData.data && action.playerData.data.title || action.playerData.url), false);
2312+
var isSafeSource = true; //it comes from own account
2313+
action.playerData.data.autoplay = true; //it doesn't really make sense without ;-)
2314+
SepiaFW.ui.cards.addEmbeddedPlayer("chat", action.playerData, isSafeSource);
2315+
},
2316+
undefined, 10000
2317+
);
2318+
}
23032319
}else{
23042320
SepiaFW.debug.error("remoteAction - type: media - no support yet for action type: " + action.type);
23052321
}

0 commit comments

Comments
 (0)