Skip to content
Snippets Groups Projects
Commit 4b18143e authored by srosse's avatar srosse
Browse files

OO-4665: muse / pause / remove videos before DOM replacement

parent 9fdc257b
No related branches found
No related tags found
No related merge requests found
......@@ -93,20 +93,6 @@
$r.openNoResponseJavaScriptCommand("timeupdate"), 'currentTime', mediaElement.currentTime, 'src', $mediaSrc, 'duration', mediaElement.duration);
}
#end
if(jQuery('#$r.getId("o_vid")').length == 0) {
## // try a second time to prevent destroying after a reload
setTimeout(function() {
if(jQuery('#$r.getId("o_vid")').length == 0) {
try {
player.setMuted(true);
player.pause();
player.remove();
} catch(e) {
if(window.console) console.log(e);
}
}
}, 500);
}
}, false);
## listen to end events, fired when movie is finished
......
......@@ -581,6 +581,11 @@ function o_ainvoke(r) {
}
}
var videos = jQuery('div.o_video_run video', newc);
if(videos.length > 0) {
destroyRunningVideos(videos);
}
if(civis) { // needed only for ie 6/7 bug where an empty div requires space on screen
newc.css('display','');//.style.display="";//reset?
} else {
......@@ -1578,7 +1583,7 @@ function o_onXHRError(jqXHR, textStatus, errorThrown) {
var msg = o_info.oo_noresponse.replace("reload.html", window.document.location.href);
showMessageBox('error', o_info.oo_noresponse_title, msg, undefined);
} else if(window.console) {
console.log('Error status 2', textStatus, errorThrown, jqXHR.responseText);
console.log('Error status 2', jqXHR.status, textStatus, errorThrown, jqXHR.responseText);
console.log(jqXHR);
}
}
......@@ -1649,6 +1654,28 @@ function checkDrakes() {
}
}
function destroyRunningVideos(videos) {
try {
if(videos !== "undefined" && videos != null && videos.length > 0) {
videos.each(function() {
try {
if(this.player) {
this.player.setMuted(true);
this.player.pause();
this.player.remove();
} else {
console.log('Not found');
}
} catch(e) {
if(window.console) console.log(e);
}
});
}
} catch(e) {
if(window.console) console.log(e);
}
}
//try to mimic the FileUtils.normalizeFilename method
function o_normalizeFilename(filename) {
filename = filename.replace(/\s/g, "_")
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment