Karl Sadler
Karl Sadler

Reputation: 13

How do I create a simple solution to get around sound not autoplaying?

I am a complete noob, first question on here, so please be gentle! I'm following a basic Javascript for Sound Artists book, but the initial Hello Sound example, seems to not work due to a new need for a gesture input otherwise disabling autoplaying of sound. As I'm going to be exploring and experimenting predominantly with sound, I was wondering if anyone could please advise on a suitable and simple solution to get around this disabled sound issue? Thanks.

var osc = audioContext.createOscillator();
osc.type = "sine";
osc.connect (audioContext.destination);
osc.start (audioContext.currentTime);


Upvotes: 1

Views: 937

Answers (1)

guest271314
guest271314

Reputation: 1

I'm going to be exploring and experimenting predominantly with sound, I was wondering if anyone could please advise on a suitable and simple solution to get around this disabled sound issue?

You can create a separate launcher for Chromium or Chrome browsers with the appropriate flag or policy set to disable the default browser policy of disabling autoplay until user gesture.

For example

--ignore-autoplay-restrictions

  • Ignores all autoplay restrictions. It will ignore the current autoplay policy and all restrictions such as playback in a background tab. It should only be enabled for testing.

See Autoplay Policy Changes

Upvotes: 1

Related Questions