Open sombraguerrero opened 3 years ago
Onda-specific code:
<script>
/* Interaction functions javascript <-> flash */
function pantalla_flash(n, m) {
switch(typeof n) {
case "number":
console.log("pantalla_flash: n is a number!");
if(n > 0) {
if($("#the-media", parent.document.body)[0].paused&& $("#the-media", parent.document.body)[0].played.length < 0) {
if(isNOE()) {
console.log("isNOE returns true!");
$("#the-media")[0].load();
$("#the-media")[0].play();
} else {
console.log("isNOE returns false!");
$("#the-media", parent.document.body)[0].currentTime = 0;
$("#the-media", parent.document.body)[0].play();
}
} else if($("#the-media", parent.document.body)[0].paused) {
console.log("Media is paused!");
$("#the-media", parent.document.body)[0].play();
}
}
if(typeof m == "undefined") {
parent.current_cue = n-1;
console.log("m is undefined and current queue value is " + parent.current_cue);
} else {
parent.current_cue = m-1;
console.log("m is defined and current queue value is " + parent.current_cue);
}
if(parent.current_cue >= 0) {
parent.cue(parent.subs[parent.current_cue]);
parent.at_cue_change();
console.log("Queue change!");
}
break;
case "string":
console.log("pantalla_flash: n is a string!");
parent.cue(n);
break;
}
}
function cambia_audio(n) {
parent.weare_loading();
console.log("I make it in here to change audio!");
$("#the-media", parent.document.body)
.parent()
.html(
'<audio id="the-media" data-channels="'+parent.media_info["streamsound "+n]["channel-layout"]+'" data-fps="'+parent.media_info["streamsound "+n]["fps"]+'" data-duration="'+parent.media_info["streamsound "+n]["duration"]+'" data-activity="'+("streamsound "+n)+'">'+
' <source type="<?= $mime_audio ?>" src="<?= $path ?>swf-source/'+parent.activity+'/streamsound '+n+'<?= $ext_audio ?>">'+
'</audio>'
);
$("#the-media", parent.document.body)[0].play();
parent.start_osciloscope();
parent.weve_loaded()();
}
function comunicacion_flash_video(s, n) {
parent.weare_loading();
console.log("Made it inside the communication function!");
function set_subtitle() {
switch(typeof n) {
case "undefined":
console.log("comunicacion_flash_video: n is NOT defined!");
parent.cue(parent.media_info[s]["title"]);
break;
case "number":
console.log("comunicacion_flash_video: n is a number!");
parent.cue(parent.subs[n]);
break;
case "string":
console.log("comunicacion_flash_video: n is a string!");
parent.cue(n);
break;
}
}
if(typeof parent.subtitles2video[s.toLowerCase()] == "undefined")
set_subtitle();
else
parent.cue(parent.subtitles2video[s.toLowerCase()]);
s = s.toLowerCase();
if(parent.image_mode) {
$("#osciloscope",parent.document.body).hide();
} else {
$("#osciloscope",parent.document.body).show();
}
$("#the-media", parent.document.body)
.parent()
.html(
'<video id="the-media" data-channels="'+parent.media_info[s]["channel-layout"]+'" data-fps="'+parent.media_info[s]["fps"]+'" data-duration="'+parent.media_info[s]["duration"]+'" data-activity="'+s+'">'+
' <source type="<?= $mime_video ?>" src="<?= $path ?>swf-source/'+parent.activity+'/'+s+'<?= $ext_video ?>">'+
' <track srclang="es" kind="subtitles" src="<?= $path ?>swf-source/'+parent.activity+'/'+s+'.vtt'+(isNOE() ? "" : "?ver=<?= $version ?>")+'" default>'+
'</video>'
).css({
width: "100%",
height: "100%"
});
$("#the-media", parent.document.body)
.unbind("loadeddata")
.bind("loadeddata", function () {
if(typeof $("#the-media", parent.document.body)[0].textTracks[0] != "undefined")
$("#the-media", parent.document.body)[0].textTracks[0].mode = "hidden"; // To hide subtitles in Edge
parent.maskin();
parent.start_osciloscope();
parent.you_can_play_pause();
parent.weve_loaded();
parent.reMask();
});
if(isNOE()) {
$("#the-media", parent.document.body)
.css({
visibility: "hidden"
})
.unbind("playing")
.bind("playing", function () {
$(this).css("visibility", "visible");
});
}
$("#the-media", parent.document.body)
.unbind("ended")
.bind("ended", function(e) {
parent.maskout();
$(this)
.html("")
.hide();
$("#osciloscope", parent.document.body).hide();
parent.you_cannot_play_pause();
set_subtitle();
/*$("#the-media", parent.document.body)
.parent()
.css({
width: "0",
height: "0"
});*/
$("#the-media", parent.document.body)
.parent()
.html("<div id='the-media'><video></video></div>")
.css({
width: "0",
height: "0"
});
if(isFirefox()) { /* Fix for firefox */
$("#flashContent")
.css({
"width": "100%",
"height": "100%"
});
$(window).trigger("resize");
}
})
.css({
width: "100%",
height: "100%"
})
.show();
$("#the-media", parent.document.body)[0].textTracks[0].oncuechange = function () {
if(typeof $("#the-media", parent.document.body)[0].textTracks[0].activeCues != "undefined")
parent.cue($("#the-media", parent.document.body)[0].textTracks[0].activeCues[0].text);
};
$("#the-media", parent.document.body)[0].load();
$("#the-media", parent.document.body)[0].play();
parent.maskout();
}
Describe the bug The Sedea application within the Onda platform heavily utilizes Flash's longstanding ability to treat SWFs as Javascript DOM objects. Without that support, much of the Flash content in Sedea will not play, although the surrounding SVG elements, sound oscillations, and so forth will proceed without it, bringing the application to a halt as it reaches points where the frames were supposed to advance.
Expected behavior The Javascript API needs a way to support, Play, Pause, and Rewind at the DOM level so that Onda's existing code can continue to function as it previously did.
501.zip
What platform are you using? Firefox and Chromium based browsers. Windows 10 4/2 Extension, Self-Host, and Desktop Application