首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >NGINX-RTMP问题

NGINX-RTMP问题
EN

Stack Overflow用户
提问于 2018-01-29 15:05:10
回答 1查看 393关注 1票数 1

我已经配置了NGINX-RTMP服务器,可以在VLC Media Player上播放直播。但是当我试图在网站上播放它时,它就不能播放了。这是我的nginx.conf文件的RTMP配置代码。

代码语言:javascript
运行
复制
rtmp {
    server {
            listen 1935;
            chunk_size 4096;

            application live {
                    live on;
                    record off;
            }
    }
}

我试着通过clappr播放器播放它,这是代码

代码语言:javascript
运行
复制
var player = new Clappr.Player({
    source: "rtmp://192.168.4.136:1935/live/test",
    parentId: "#player",
    plugins: {'playback': [RTMP]},
    rtmpConfig: {
        swfPath: 'dist/assets/RTMP.swf',
        scaling:'stretch',
        playbackType: 'live',
        bufferTime: 1,
        startLevel: 0,
        switchRules: {
            "SufficientBandwidthRule": {
                "bandwidthSafetyMultiple": 1.15,
                "minDroppedFps": 2
            },
            "InsufficientBufferRule": {
                "minBufferLength": 2
            },
            "DroppedFramesRule": {
                "downSwitchByOne": 10,
                "downSwitchByTwo": 20,
                "downSwitchToZero": 24
            },
            "InsufficientBandwidthRule": {
                "bitrateMultiplier": 1.15
            }
        }
    },
});

我有以下错误

请帮我解决这个问题。提前谢谢。

EN

回答 1

Stack Overflow用户

发布于 2020-10-15 05:46:12

第一件事(当你有一个域名时,OpenSSL不能工作,你必须使用CertBot。)根据这一点,我没有使用我使用的Clapp播放器,我使用的是互联网上的一个。

在我放在这里的rtmp上更改你想要的,这样就不会做很多事情,除了

未删除

代码语言:javascript
运行
复制
 hls on;
 hls_path /nginx/hls;
 hls_fragment 3;
 hls_playlist_length 60;
 # disable consuming the stream from nginx as rtmp
 deny play all;

在LINUX控制台上做什么

代码语言:javascript
运行
复制
sudo mkdir /nginx
sudo mkdir /nginx/hls

在rtmp中,尝试执行以下操作:

代码语言:javascript
运行
复制
rtmp {
server {
    listen 1935; # Listen on standard RTMP port
    chunk_size 4000;

    application live {
        live on;
        # Turn on HLS
        hls on;
        hls_path /nginx/hls;
        record all;
        record_path /videos;
        hls_fragment 3;
        hls_playlist_length 60;
        # disable consuming the stream from nginx as rtmp
        deny play all;
    }
}
}

当时我在网站上是这样做的:

网站上的

更改ip和端口

代码语言:javascript
运行
复制
   <head>
<link href="https://vjs.zencdn.net/7.6.6/video-js.css" rel="stylesheet" />
<script src="https://vjs.zencdn.net/7.6.6/video.js"></script>
<title>Stream PAGE</title>
<!-- This style is clearly not needed but yolo  -->
<style>
  body {
width: 35em;
margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif;
 }
</style>
</head>   
<body>
<h1>What you want</h1>
<video id="player" class="video-js vjs-default-skin" width="800" height="440"  controls preload="none">
<source src="http://192.168.205.1:9000/1234.m3u8" type="application/x-mpegURL" />
</video>
 <script>
 var player = videojs('#player')
  </script>

You should be able after completing the web something like this

如果这对你没有帮助,这个视频节省了我无数个小时的工作,因为我重新做了一遍:https://www.youtube.com/watch?v=Y-9kVF6bWr4&t

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/48496042

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档