Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

play() function doesn't work

Hello everyone,

I recently encountered an issue while trying to play audio in OSWeb Version >=2. I was attempting to use the `play()` method on an audio object, but I kept getting the error "play() is not a function". With OSWeb Version <=2 it works fine!

audio = runner._pool[audioname].data
audio.play()

I also tried, with the same error "TypeError: pool[audioname].play is not a function":

pool[audioname].play();

After some troubleshooting, I found a solution that works using direct access to the AudioBuffer. Here's the code that solved the problem:

var audioContext = new (window.AudioContext || window.webkitAudioContext)();
var source = audioContext.createBufferSource();
source.buffer = pool[audioname].data;
source.connect(audioContext.destination);
source.start(0);

Does anyone else have the same problem with the new OSWeb version >=2? How did you solve it?

Regrads, Max

Comments

Sign In or Register to comment.