From 7251c37c08ce776496c0abe2d770648bebf60e9b Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Thu, 4 Dec 2014 10:48:50 -0800 Subject: [PATCH] video: load flashembed dynamically only when there are videos --- pywb/static/vidrw.js | 16 ++++++++++++++-- pywb/ui/head_insert.html | 5 +---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/pywb/static/vidrw.js b/pywb/static/vidrw.js index 23b174c3..edd5e829 100644 --- a/pywb/static/vidrw.js +++ b/pywb/static/vidrw.js @@ -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() { diff --git a/pywb/ui/head_insert.html b/pywb/ui/head_insert.html index 5200cdf8..bf21e762 100644 --- a/pywb/ui/head_insert.html +++ b/pywb/ui/head_insert.html @@ -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 }}"; - - - -