web: Small improvement in player.js

This commit is contained in:
relrelb 2021-04-16 00:17:33 +03:00 committed by Mike Welsh
parent 2fd0bb0183
commit 9021da874d
1 changed files with 8 additions and 9 deletions

View File

@ -1,6 +1,13 @@
import { PublicAPI, SourceAPI, publicPath } from "ruffle-core";
let ruffle;
window.RufflePlayer = PublicAPI.negotiate(
window.RufflePlayer,
"local",
new SourceAPI("local")
);
__webpack_public_path__ = publicPath(window.RufflePlayer.config, "local");
const ruffle = window.RufflePlayer.newest();
let player;
// Default config used by the player.
@ -9,13 +16,6 @@ const config = {
logLevel: "warn",
};
window.RufflePlayer = PublicAPI.negotiate(
window.RufflePlayer,
"local",
new SourceAPI("local")
);
__webpack_public_path__ = publicPath(window.RufflePlayer.config, "local");
window.addEventListener("DOMContentLoaded", () => {
const url = new URL(window.location);
const swfUrl = url.searchParams.get("url");
@ -23,7 +23,6 @@ window.addEventListener("DOMContentLoaded", () => {
return;
}
ruffle = window.RufflePlayer.newest();
player = ruffle.createPlayer();
player.id = "player";
document.getElementById("main").append(player);