Html 如何通过网络播放/流式传输 RTSP。
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19399101/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to play/stream RTSP via web.
提问by bobbyjones
Can someone guide me on how to properly stream an RSTP in web?
有人可以指导我如何在网络中正确流式传输 RSTP 吗?
So I have this url rtsp://192.168.1.55:554/vid/stream/channels/1
When played via VLC player Streaming in my desktop appears to run/stream fine.
所以我有这个 urlrtsp://192.168.1.55:554/vid/stream/channels/1
当通过 VLC 播放器播放时,我的桌面上的流似乎运行/流良好。
My next challenge is, to view this via WEB. So I created a simple HTML site, and embedded the quicktime code which I found somewhere in stackoverflow.
我的下一个挑战是,通过 WEB 查看。所以我创建了一个简单的 HTML 站点,并嵌入了我在 stackoverflow 某处找到的 quicktime 代码。
<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" WIDTH="400" HEIGHT="300" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab";>
<PARAM NAME="src" VALUE="rtsp://192.168.1.55:554/vid/stream/channels/1";>
<PARAM NAME="controller" VALUE="false">
<PARAM name="AUTOPLAY" VALUE="true">
<PARAM NAME="qtsrc" VALUE="rtsp://192.168.1.55:554/vid/stream/channels/1";>
<PARAM NAME="pluginspage" VALUE="http://www.apple.com/quicktime/download/indext.html";>
<PARAM name="type" VALUE="video/quicktime">
<EMBED WIDTH="400" HEIGHT="300" AUTOPLAY="true" CONTROLLER="false" SRC="rtsp://192.168.1.55:554/vid/stream/channels/1"; qtsrc="rtsp://192.168.1.55:554/vid/stream/channels/1"; BGCOLOR="FFFFFF" BORDER="0" PLUGINSPAGE="http://www.apple.com/quicktime/download/indext.html";></EMBED>
</OBJECT>
i also included these on my <head>
tag
我也将这些包含在我的<head>
标签中
<script src="http://www.apple.com/library/quicktime/scripts/ac_quicktime.js" language="JavaScript" type="text/javascript"></script>
<script src="http://www.apple.com/library/quicktime/scripts/qtp_library.js" language="JavaScript" type="text/javascript"></script>
<link href="http://www.apple.com/library/quicktime/stylesheets/qtp_library.css" rel="StyleSheet" type="text/css" />
But when I load the page, I get a blank screen.
但是当我加载页面时,我得到一个空白屏幕。
I have tried chrome/ie/firefox.
我试过 chrome/ie/firefox。
回答by Víctor Alonso
You have to redirect your router public port 554 to the private 192.168.1.55:554 port in order to access it form other location in the web.
您必须将路由器公共端口 554 重定向到私有端口 192.168.1.55:554,以便从网络中的其他位置访问它。
finally you need to change the code:
最后你需要更改代码:
rtsp://XXX.XXX.XXX.XXX:554/vid/stream/channels/1
rtsp://XXX.XXX.XXX.XXX:554/vid/stream/channels/1
instead of
代替
rtsp://192.168.1.55:554/vid/stream/channels/1
rtsp://192.168.1.55:554/vid/stream/channels/1
where XXX.XXX.XXX.XXX is the public ip of your router
其中 XXX.XXX.XXX.XXX 是您路由器的公共 IP