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> </div>
<div id="main"> <div id="main">
<!--<object id="player" type="application/x-shockwave-flash"> <embed id="player" type="application/x-shockwave-flash" src="test.swf">
<param name="movie" value="test.swf">
</object>-->
<embed type="application/x-shockwave-flash" src="test.swf">
</div> </div>
<script src="./index.js"></script> <script src="./index.js"></script>
</body> </body>

View File

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

View File

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