我已经配置了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
}
}
},
});
我有以下错误
请帮我解决这个问题。提前谢谢。
发布于 2020-10-15 05:46:12
第一件事(当你有一个域名时,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
https://stackoverflow.com/questions/48496042
复制相似问题