我配置了NGINX-RTMP服务器,我可以在VLC Media Player上播放实时流媒体。 但是,当我试图在网站上播放它然后它不播放。 这是我的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
}
}
},
});
答案 0 :(得分:0)
第一件事(当您拥有域时,OpenSSL将不起作用,您必须使用CertBot。) 据此,我没有使用Clapp播放器,而是使用了可以正常工作的Internet播放器。
更改您想要在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