Fix demo site regressions.

This commit is contained in:
David Wendt 2019-09-03 18:38:05 -04:00
parent 9dd01494f3
commit f59d62516e
3 changed files with 11 additions and 13 deletions

View File

@ -79,10 +79,7 @@
</div>
</div>
<div id="main">
<!--<object id="player" type="application/x-shockwave-flash">
<param name="movie" value="test.swf">
</object>-->
<embed type="application/x-shockwave-flash" src="test.swf">
<embed id="player" type="application/x-shockwave-flash" src="test.swf">
</div>
<script src="./index.js"></script>
</body>

View File

@ -52,5 +52,5 @@ let timestamp = 0;
let animationHandler;
function playSwf(swfData) {
document.getElementById("player").play_swf(swfData);
document.getElementById("player").play_swf_data(swfData);
}

View File

@ -10,15 +10,16 @@
* download.
*/
async function fetch_ruffle() {
let ruffle_bindings_url = "ruffle_web.js";
let ruffle_wasm_url = "ruffle_web_bg.wasm";
//Detect if we are executiong in a webextension context.
//If so, download Ruffle from the URL the browser gives us.
if (runtime_path) {
ruffle_bindings_url = runtime_path + "dist/ruffle_web.js";
ruffle_wasm_url = runtime_path + "dist/ruffle_web_bg.wasm";
if (!window.runtime_path) {
//Executing on the demo site (which is fully webpack) so we can just use
//webpack to get the Ruffle chunk.
let ruffle_module = await import("../pkg/ruffle");
return ruffle_module.Ruffle;
}
//Download Ruffle from the URL the browser gives us.
let ruffle_bindings_url = window.runtime_path + "dist/ruffle_web.js";
let ruffle_wasm_url = window.runtime_path + "dist/ruffle_web_bg.wasm";
//We load the wasm package early so that both requests are parallelized.
//This won't be awaited by us at all.