javascript 如何在网页上嵌入 RTMP 视频流播放器?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27199000/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 07:06:48  来源:igfitidea点击:

How to embed RTMP video stream player on webpage?

javascripthtmlembedjwplayerrtmp

提问by Sarchophagi

Is there any free/open/customizable solution?

有没有免费/开放/可定制的解决方案?

I heard about jwplayerbut i cound't get it to work using their page structions, like the following:

我听说过,jwplayer但我无法使用他们的页面结构使其正常工作,如下所示:

<script src="http://jwpsrv.com/library/XXzG4ndHEeS3EA6sC0aurw.js"></script>

<script>
$(document).ready(function() {  
    jwplayer("cover").setup({
        file: "rtmp://199.59.88.39/cam4-cr107/130.flv",
        image: "start.png",
        height: 360,
        width: 640
    }); 
});
</script>

What I'm I doing wrong? Any other better player suggestion?

我做错了什么?还有其他更好的玩家推荐吗?

回答by Ben

You have a problem in this line jwplayer("#cover").setup({

你在这一行有问题 jwplayer("#cover").setup({

Also you forget to add <div id=cover></div>Try this code:

你也忘记添加 <div id=cover></div>试试这个代码:

<script src="http://jwpsrv.com/library/XXzG4ndHEeS3EA6sC0aurw.js"></script>
<div id=cover></div>
<script>
$(document).ready(function() {  
    jwplayer("cover").setup({
        file: "rtmp://199.59.88.39/cam4-cr107/130.flv",
        image: "start.png",
        height: 360,
        width: 640
    }); 
});
</script>