[英]Playing audio stream using html5
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. 我如何播放带有HTML5音频标签的RTSP流,我已经检查了来自wowza http和RTSP的流链接在VLC上都可以正常工作,但是当我将这些链接嵌入html5音频标签中时,似乎没有任何帮助。 Here is my HTML5 code 这是我的HTML5代码
<!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 编辑:流可以完美地在智能手机上运行,但不能在PC浏览器上运行
HLS (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>
HLS(m3u8文件)将在HTML5音频标签中的iOS(和某些Android,但支持有些笨拙)和Mac OS Safari上播放: <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: 可以通过Chrome中的标签在Android上播放RTSP:
<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>
RTSP应该可以在Android上的HTML5视频标签中使用,但只能在本机浏览器上使用(这是我的经验,我通常使用标签,因为Chrome现在是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). 要支持台式机,请提供指向视频标签src(mp3,ogg,wav ..)的下载链接,或者如果您必须使用流协议,则需要使用Flash之类的插件(并向其提供RTMP或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>
有一个适用于Web浏览器的VLC插件,该插件可以播放RTSP流,但是在嵌入标签中: <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. 尽管HTML5视频与协议无关,但它取决于Web浏览器/ OS制造商的实现,并且会随时间和制造商而变化。
<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. 在ie10,ff-chrome(win7)和android,iphone / ipad上为我工作,即时通讯正等待在较旧的ies-windows,safari和Opera上进行测试。 Will not work on ie 8. 将无法工作,即8。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.