Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

howler with HTMLMediaElement.src #1239

Open
Racheli86 opened this issue Oct 23, 2019 · 1 comment
Open

howler with HTMLMediaElement.src #1239

Racheli86 opened this issue Oct 23, 2019 · 1 comment

Comments

@Racheli86
Copy link

I'm trying to play audio which is not a file such as --> src: ['sound.webm', 'sound.mp3'] (as far as I understand).
The audio is HTMLMediaElement.src type.
It's not working at the moment and I would really appreciate some help here :)
Thanks.

Here is part of the code:
playSong(response, volume){
const blob = new Blob([response as any], { type: 'audio/mpeg' });
const objectUrl = URL.createObjectURL(blob);
const audio = new Audio();
audio.src = objectUrl;
let read = new Howl ({
src:['audio.src' ],
html5: true,
//volume: this.scan_volume ,//this.scan_volume, //default
});
console.log("i'm in!")
read.volume(volume);
read.play();
}

@suterma
Copy link

suterma commented Dec 28, 2021

Why are you creating the Audio object? You could just use the objectUrl, in conjunction with the format option. See

#436 (comment)

Does this help? The documentation about this is lacking, but I can confirm that using objectUrl's do work with the correct format option.

@goldfire I suggest to close this, and improve the doc, as also suggested by #1485 (comment) for example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants