1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-15 00:03:28 +01:00

video: load flashembed dynamically only when there are videos

This commit is contained in:
Ilya Kreymer 2014-12-04 10:48:50 -08:00
parent cc4df75c0b
commit 7251c37c08
2 changed files with 15 additions and 6 deletions

View File

@ -335,7 +335,7 @@ __wbvidrw = (function() {
function init_flash_player(div_id, width, height, info, thumb_url)
{
var swf = "/static/default/flowplayer/flowplayer-3.2.18.swf";
var swf = wbinfo.static_prefix + "/flowplayer/flowplayer-3.2.18.swf";
var style = 'width: ' + width + 'px; height: ' + height + 'px; display: block';
document.getElementById(div_id).style.cssText += ';' + style;
@ -365,7 +365,19 @@ __wbvidrw = (function() {
onFail: function() { alert("TEST"); }
};
flashembed(div_id, opts, {"config": config});
var do_embed = function() {
window.flashembed(div_id, opts, {"config": config});
};
if (!window.flashembed) {
var script = document.createElement("script");
script._no_rewrite = true;
script.onload = do_embed;
script.setAttribute("src", wbinfo.static_prefix + "/flowplayer/toolbox.flashembed.js");
document.body.appendChild(script);
} else {
do_embed();
}
}
document.addEventListener("DOMContentLoaded", function() {

View File

@ -23,12 +23,9 @@
wbinfo.is_live = {{ "true" if cdx.is_live else "false" }};
wbinfo.coll = "{{ wbrequest.coll }}";
wbinfo.proxy_magic = "{{ wbrequest.env.pywb_proxy_magic }}";
wbinfo.static_prefix = "{{ wbrequest.host_prefix }}/{{ static_path }}";
</script>
<script src='{{ wbrequest.host_prefix }}/{{ static_path }}/flowplayer/toolbox.flashembed.js'> </script>
<script src='{{ wbrequest.host_prefix }}/{{ static_path }}/wb.js'> </script>
<script src='{{ wbrequest.host_prefix }}/{{ static_path }}/vidrw.js'> </script>