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

streaming music #378

Closed
ray007 opened this issue Oct 29, 2015 · 8 comments
Closed

streaming music #378

ray007 opened this issue Oct 29, 2015 · 8 comments
Milestone

Comments

@ray007
Copy link

ray007 commented Oct 29, 2015

I was so far successful using howler to play either local or remote files, but didn't manage to play music from a streaming source, i.e. internet radio.
Is this not supported or could I get to see a working example for that?

@thomasduenser
Copy link

Same question, is it possible to stream music with howler?

@goldfire goldfire added this to the 2.0 milestone Oct 30, 2015
@goldfire
Copy link
Owner

goldfire commented Nov 6, 2015

You should be able to do it like this:

var stream = new Howl({
    src: ['...'],
    ext: ['mp3'],
    autoplay: true,
    html5: true
});

Note that you must use HTML5 Audio to stream, it isn't possible with Web Audio since the full audio must be loaded and decoded first.

@goldfire goldfire closed this as completed Nov 6, 2015
@ray007
Copy link
Author

ray007 commented Nov 10, 2015

Thank you, that worked.
But what do I do if I don't know the stream is in mp3 format? In my case the target url is customer data and may or may not be streaming data...

Edit: stopping the sound apparently doesn't work for streams started playing with the html5 option set to true

@goldfire
Copy link
Owner

Thanks, the stopping issue has been fixed in bb903a6. As for knowing the format, there's no way I'm aware of getting that on the client. There's certainly ways to determine that on the server side though.

@oms36
Copy link

oms36 commented Apr 19, 2017

Friend, I have an icecast server, how can I use your Howler.js to create a small radio station in my workplace?

@Ivan8R
Copy link

Ivan8R commented Jun 25, 2017

goldfire, please, can you show to us working example of streaming?
var stream = new Howl({ src: ['...'], ext: ['mp3'], autoplay: true, html5: true });

I'm write understand that we need to upload data to <audio></audio>, in src: getelementbyId ?

@Fredbam
Copy link

Fredbam commented Jan 22, 2019

@goldfire Is it possible to call a pls file to stream radio stations ?

@mblackritter
Copy link

mblackritter commented Dec 15, 2020

@Fredbam, ah yeah, this works well, at least with the current version, #OhHellboyYeah! 😻 I was also pleasingly surprised, as I was already worried I'd to parse that myself, but I think that's just HTML5-Audio supporting .pls! 😹💦

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

No branches or pull requests

7 participants