diff --git a/web/packages/core/src/ruffle-player.js b/web/packages/core/src/ruffle-player.js index 97030cac8..272894c4b 100644 --- a/web/packages/core/src/ruffle-player.js +++ b/web/packages/core/src/ruffle-player.js @@ -172,7 +172,7 @@ exports.RufflePlayer = class RufflePlayer extends HTMLElement { * @param {URLSearchParams|String|Object} [parameters] The parameters (also known as "flashvars") to load the movie with. * If it's a string, it will be decoded into an object. * If it's an object, every key and value must be a String. - * If it's null or undefined, it will attempt to be parsed from the URL. If you explicitly want no flashvars, use {}. + * These parameters will be merged onto any found in the query portion of the swf URL. */ async stream_swf_url(url, parameters) { //TODO: Actually stream files... @@ -181,13 +181,11 @@ exports.RufflePlayer = class RufflePlayer extends HTMLElement { console.log("Loading SWF file " + url); await this.ensure_fresh_instance(); - if ( - (parameters === null || parameters === undefined) && - url.indexOf("?") > -1 - ) { - parameters = url.substring(url.indexOf("?")); - } - this.instance.stream_from(url, sanitize_parameters(parameters)); + parameters = { + ...sanitize_parameters(url.substring(url.indexOf("?"))), + ...sanitize_parameters(parameters), + }; + this.instance.stream_from(url, parameters); if (this.play_button) { this.play_button.style.display = "block"; diff --git a/web/packages/selfhosted/test/polyfill/object_flashvars/expected.html b/web/packages/selfhosted/test/polyfill/object_flashvars/expected.html index cec2c2beb..d034e9b05 100644 --- a/web/packages/selfhosted/test/polyfill/object_flashvars/expected.html +++ b/web/packages/selfhosted/test/polyfill/object_flashvars/expected.html @@ -1,19 +1,20 @@ - - - - + + + + + \ No newline at end of file diff --git a/web/packages/selfhosted/test/polyfill/object_flashvars/index.html b/web/packages/selfhosted/test/polyfill/object_flashvars/index.html index b1943a5ae..c37d73359 100644 --- a/web/packages/selfhosted/test/polyfill/object_flashvars/index.html +++ b/web/packages/selfhosted/test/polyfill/object_flashvars/index.html @@ -14,11 +14,12 @@ height="400" codebase="http://fpdownload.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" > - + + - - - - - + + + + \ No newline at end of file diff --git a/web/packages/selfhosted/test/polyfill/object_flashvars_in_url/index.html b/web/packages/selfhosted/test/polyfill/object_flashvars_in_url/index.html index 2606a0c40..b1943a5ae 100644 --- a/web/packages/selfhosted/test/polyfill/object_flashvars_in_url/index.html +++ b/web/packages/selfhosted/test/polyfill/object_flashvars_in_url/index.html @@ -14,12 +14,11 @@ height="400" codebase="http://fpdownload.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" > - + -