audio - Playing m3u playlist with html5 -


i've created simple , basic html5 audio player, not more than:

<audio src="[url-to-m3u]" controls> 

but facing 2 problems, simple audio tag working on chrome, not in safari 7 second is not working on iphone ios7, nor htc android 2.3


the playlist elements mp3 content type: audio/mpeg

i guess support m3u file format going scattered in html5 media compatible browser.

it should play on ios: try add mime-type audio/mpegurl or application/x-mpegurl server (if not done) , our source tag.

<audio controls>     <source src="[url-to-m3u]" type="audio/mpegurl" /> </audio> 

you need check browser support both mp3 , m3u canplaytype method - example:

var supportsmp3 = false; var myaudio = document.createelement('audio'); if (myaudio.canplaytype('audio/mpeg') !== ""){supportsmp3 = true;} 

you need check audio/mpegurl , application/x-mpegurl , audio/mpeg before going ahead , deliver m3u file. suggest use fallback case scenario not browsers going support m3u files.

for example m3u file not appear in supported media matrix android.

edit: can use jw player supports m3u files wider browser coverage. otherwise try find open source/free flash player fallback.

also m3u file can parsed using js extract mp3 urls (m3u files referencing playlist of items). after dynamic changing of src of audio tag correct mp3 url.


Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -