Giter VIP home page Giter VIP logo

Comments (10)

otoinsa avatar otoinsa commented on July 28, 2024 5

chrome://flags/
does have an "Autoplay policy" flag actually, so far it works. :)

from sound.

bigtimebuddy avatar bigtimebuddy commented on July 28, 2024

Thanks for the compliments.

I don’t think you can avoid this. We are heading to a world where all audio and video media requires an interaction. I’m not a huge fan either. You can design around it by creating a start button?

from sound.

otoinsa avatar otoinsa commented on July 28, 2024

It's a good idea, but one of the target devices (arcade box) will only have button controls connected to it (directional joystick, 5 action buttons), currently a keypress is not resuming the audio context. :(

I guess I can build with an older version of Chromium for now until the Chrome devs implement some none pointer-device way or resuming audio context...

from sound.

bigtimebuddy avatar bigtimebuddy commented on July 28, 2024

I wonder if there is there a flag in Chrome to prevent this behavior?

from sound.

bigtimebuddy avatar bigtimebuddy commented on July 28, 2024

Follow-up article: https://www.bleepingcomputer.com/news/google/google-fixes-issue-that-broke-millions-of-web-based-games-in-chrome/

Looks like they temporarily reverting the change until more developers can integrated interaction-to-play audio. I might add a note about this in the readme because it's an important design consideration.

from sound.

OptimusPi avatar OptimusPi commented on July 28, 2024

Sorry to bump an old post--

I added a "start" button that then plays the main menu state and starts the audio. Yet, I still get this warning:

The Web Audio autoplay policy will be re-enabled in Chrome 70 (October 2018). Please check that your website is compatible with it. https://goo.gl/7K7WLu

Is that warning something that always pops up? OR is it telling me my current implementation simply doesn't work correctly? Thanks!

from sound.

OptimusPi avatar OptimusPi commented on July 28, 2024

How do we resume the audio context after user interaction?

from sound.

chipbell4 avatar chipbell4 commented on July 28, 2024

Based on this setter @OptimusPi I believe you should be able to set paused = false, ala

PIXI.sound.context.paused = false;

from sound.

useless-stuff avatar useless-stuff commented on July 28, 2024

maybe it could be useful for someone, it took me a while sorting out those annoying warnings.

You can load dynamically 'pixi-sound' after a user click/swipe and store it in a lazy loader var.

if (!this.pixiSound) {
  this.pixiSound = await import('pixi-sound')
}

then, in order to use it:

  this.pixiSound.default

from sound.

connorjclark avatar connorjclark commented on July 28, 2024

Building off the previous comment, this work well for me:

document.addEventListener('click', async () => {
  globalThis.PIXI.sound = (await import('pixi-sound')).default;
}, { once: true });

from sound.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.