【问题标题】:NGINX-RTMP IssueNGINX-RTMP 问题
【发布时间】:2018-01-29 07:05:09
【问题描述】:

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

rtmp {
    server {
            listen 1935;
            chunk_size 4096;

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

我尝试通过 clappr 播放器播放 这是代码

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
            }
        }
    },
});

我有以下错误 请帮我解决它。 提前致谢。

【问题讨论】:

    标签: nginx rtmp live-streaming


    【解决方案1】:

    第一件事(当您拥有域时,OpenSSL 将无法工作,您必须使用 CertBot。) 据此,我没有使用 Clapp 播放器,我使用的是互联网上的一个有效的播放器。

    在我放在这里的 rtmp 上改变你想要的东西,所以除了

    不删除

     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 控制台上做什么

    sudo mkdir /nginx
    sudo mkdir /nginx/hls
    

    在 rtmp 中试试这个:

    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 和端口

       <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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-10-01
      • 2012-01-06
      • 1970-01-01
      • 2022-01-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多