简体   繁体   English

带VLC的RTSP流:用户可更改rtsp IP

[英]RTSP streaming with VLC: changeable rtsp IP by user

So simply I have the code below for streaming rtsp with VLC on webpage. 因此,我简单地拥有下面的代码,即可在网页上通过VLC流式传输rtsp。 Is it too complicated to have script to change the rtsp address by user (lets say right click on video and pick another rtsp address from drop-down list) ? 使用脚本来更改用户的rtsp地址是否太复杂了(让我们说右键单击视频并从下拉列表中选择另一个rtsp地址)?

embed type="application/x-vlc-plugin" pluginspage="http://www.videolan.org" version="VideoLAN.VLCPlugin.2" width="100%" height="100%" id="vlc" loop="yes" autoplay="yes" target="rtsp://192.168.1.225"> 嵌入type =“ application / x-vlc-plugin” pluginspage =“ http://www.videolan.org” version =“ VideoLAN.VLCPlugin.2” width =“ 100%” height =“ 100%” id =“ vlc “ loop =” yes“ autoplay =” yes“ target =” rtsp://192.168.1.225“>

Thanks for your help... 谢谢你的帮助...

What you are looking for might not be easily possible. 您正在寻找的内容可能不容易实现。 However, you can very well change the embed content using button clicks. 但是,您可以通过单击按钮很好地更改嵌入内容。 I am attaching a working solution below 我在下面附上一个有效的解决方案

code for embed- 嵌入代码

<embed id="camFeed" type="application/x-vlc-plugin" pluginspage="http://www.videolan.org" autoplay="yes" loop="no" bgcolor="#fff" width="752" height="424" src="" />

code for button- 按钮代码

 <button type="button" onclick="newFeed()">Click Me!</button>

function for changing the content- 更改内容的功能-

<script type="text/javascript">
function newFeed()
{
     document.getElementById("camFeed").src = "rtsp://xxx.xxx.xxx.xxx:554";
}
</script>

Note: If you want to display feed from a list of cameras, you will have to look into importing php arrays into js using json_encode() 注意:如果要显示摄像机列表中的提要,则必须考虑使用json_encode()将php数组导入js。

You must to change it using js, I use this: 您必须使用js进行更改,我使用以下方法:

HTML: HTML:

<embed type="application/x-vlc-plugin"
    pluginspage = "http://www.videolan.org"
    id = "vlc"
    width = "100"  
    height ="100"
    autoplay = "true"
    src = "HERE TYPE YOUR FIRST IP"
/>

JS (example with Jquery): JS(Jquery示例):

var vlc = $("#vlc")[0];
var newSrc = "HERE TYPE YOUR SECOND IP";
vlc.playlist.stop();
vlc.playlist.items.clear();
var item = vlc.playlist.add(newSrc);
vlc.playlist.playItem(0);

You can get more info here: https://wiki.videolan.org/Documentation:WebPlugin 您可以在此处获取更多信息: https : //wiki.videolan.org/Documentation : WebPlugin

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM