ruffle-rs / ruffle

A Flash Player emulator written in Rust
https://ruffle.rs
Other
15.79k stars 822 forks source link

Unable to create `AudioContext` with [S] Cascade #13522

Closed MolassesLover closed 1 year ago

MolassesLover commented 1 year ago

Describe the bug

Creating a simple Ruffle player, and playing the attached .swf file results in playback without audio. This can be reproduced by loading the .swf without ever interacting with a Ruffle player prior to loading it. For instance, by not clicking on the Ruffle logo in the demo, and then loading the .swf.

A method that's likely easier to replicate is by creating a simple Ruffle player, like this:

    <script src="/js/table-of-contents.js"></script>
    <script type="module">
      window.RufflePlayer = window.RufflePlayer || {};

      window.addEventListener("load", (event) => {
        const ruffle = window.RufflePlayer.newest();
        const player = ruffle.createPlayer();
        const container = document.getElementById("container");

        container.appendChild(player);

        player.load({
            url: "/ass/cascade/cascade_segment1_hq.swf",
            autoplay: "on",
            contextMenu: "off",
            splashScreen: false,
            unmuteOverlay: "hidden"
        });
      });
    </script>

After running, a warning like this should appear in the console:

An AudioContext was prevented from starting automatically. It must be created or resumed after a user gesture on the page.

cascade_segment1.zip

Expected behavior

Interacting with the attached Ruffle player after loading the attached .swf file should load the audio.

Affected platform

Online demo

Operating system

Fedora Linux 38

Browser

Mozilla Firefox 118, Librewolf 118

Additional information

The conversation on Discord might provide useful context.

MolassesLover commented 1 year ago

Seems like it was a broken .swf. I mixed two versions of them up. In my issue I attached the HQ version, which seems to have broken audio. The standard quality version works fine.

Thank you @adrian17!