How could I play a shoutcast/icecast stream using HTML5?

前端 未结 7 1998
借酒劲吻你
借酒劲吻你 2020-12-04 12:49

Is it possible to play a shoutcast/icecast stream using HTML5?

If so, how should I implement it?

7条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-04 13:27

    2020 update

    Modern browsers don't need any special treatment or server-side workarounds to play audio. Simply use an audio tag with a direct link to one or more stream sources (not a playlist):

    
    

    From MDN:

    The HTML element is used to embed sound content in documents. It may contain one or more audio sources, represented using the src attribute or the element: the browser will choose the most suitable one.

    Browsers support flac, mp3, vorbis, aac, opus and wav. More details on caniuse.com.

    Original post

    Add a semicolon to the end of the http request. It IS the protocol set forth by shoutcast to override it's browser detection. Like this:

    
    

提交回复
热议问题