admin管理员组文章数量:1315984
How can i play RTSP streams with HTML5 audio tag, I already check streaming links from wowza http and RTSP both work perfectly on VLC but when I embed these links in html5 audio tag, nothing seems to work any help would be appreciated. Here is my HTML5 code
<!DOCTYPE html>
<html>
<body>
<audio controls>
<source src="http://[ServerIP]:1935/bw/_definst_/mp3:audio/64kbps/A_B_C_D_Any_Body_Can_Dance_Bezubaan.mp3/playlist.m3u8" type="audio/mpeg">
Audio not supported
</audio>
</body>
</html>
Edit: Stream works on smartphones perfectly, but doesn't work on PC browsers
How can i play RTSP streams with HTML5 audio tag, I already check streaming links from wowza http and RTSP both work perfectly on VLC but when I embed these links in html5 audio tag, nothing seems to work any help would be appreciated. Here is my HTML5 code
<!DOCTYPE html>
<html>
<body>
<audio controls>
<source src="http://[ServerIP]:1935/bw/_definst_/mp3:audio/64kbps/A_B_C_D_Any_Body_Can_Dance_Bezubaan.mp3/playlist.m3u8" type="audio/mpeg">
Audio not supported
</audio>
</body>
</html>
Edit: Stream works on smartphones perfectly, but doesn't work on PC browsers
Share Improve this question edited Apr 4, 2014 at 21:03 user2009750 asked Mar 10, 2014 at 9:59 user2009750user2009750 3,1976 gold badges37 silver badges58 bronze badges 2- you should probably look at MPEG-DASH. – rshmelev Commented Mar 18, 2014 at 15:28
- Server side control is not in my hand, i'm given streaming URLs that work on VLC but not in wem. – user2009750 Commented Mar 24, 2014 at 5:58
2 Answers
Reset to default 3HLS (m3u8 files) will play on iOS (and some Android but support can be clunky) and Mac OS Safari in an HTML5 audio tag:
<video width="640" height="360" preload="auto" controls src="http://[ServerIP]:1935/vod/test.mp4/playlist.m3u8"></video>
RTSP can be played on Android via an a tag in Chrome:
<div id="myElement">
<a href="rtsp://[ServerIP]:1935/vod/mp4:test.mp4">watch this stream over RTSP</a>
</div>
RTSP should work in a HTML5 video tag on Android but only on the native browser (well that is my experience of it I normally use the a tag as Chrome is now the default browser in Android 4+): <video width="640" height="360" preload="auto" controls src="rtsp://[ServerIP]:1935/vod/sample.mp4">
</video>
To support desktop PC, either provide a download link to the video tag src (mp3, ogg, wav ..) or if you have to use a streaming protocol you will need to resort to a plugin like Flash (and feed it a RTMP or HDS feed).
There is the VLC plugin for web browsers that can allow playback of RTSP streams but that is in an embed tag:
<embed TYPE="application/x-vlc-plugin" autoplay="no" loop="no" width="640" height="360" target="rtsp://[ServerIP]:1935/vod/sample.mp4"></embed>
Though HTML5 video is protocol agnostic it is dependent on the web browser/OS manufacturer implementation and that can vary along time and manufacturers.
<audio controls autoplay="autoplay"><source src="http://ip:port/;stream.mp3" type="audio/mp3">Your browser does not support the audio element.</audio>
worked for me on ie10, ff-chrome(win7) and android, iphone/ipad, im waiting to test on older ies-windows, safari and opera. Will not work on ie 8.
本文标签: javascriptPlaying audio stream using html5Stack Overflow
版权声明:本文标题:javascript - Playing audio stream using html5 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741995158a2409893.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论