I am trying to build a website for an internet radio station. I would like to incorporate a feature that allows visitors to play the live audio stream on the website itself.
What technologies should I be looking at to get started? How is this commonly done? Is there a method that is often considered the best for live streaming?
Can you live stream to a website?
Video embedding means adding a live stream or a video player to your website using an online video platform. For many websites or social media platforms, it is as simple as copy and pasting a link. You can use free tools like YouTube to embed videos on your website.
Depending on the formats you stream to, you have a few options:
- HTML5 Audio objects (codec compatibility varies from browser to browser and I am not aware of any format besides WAV that is cross-compatible; if you have OGG and MP3 you should cover all current browsers supporting HTML5 Audio). This allows you to control audio through Javascript and is very lightweight in terms of implementation. This will probably work well with modern browsers, but will not be great for Internet Explorer users as not so many users switched to IE9. example stats
- A Flash-based player. This will allow you to stream MP3 or FLA audio. Development is clunkier than plain Javascript, but you probably have better penetration than HTML5 Audio. In my limited experience, the Flash player needs some time to initialize so the user experience is not as quick as with HTML5 Audio.
- Native browser plugins. They are hacky, most likely don't work cross-platform. Stay away if you can.