我已經在我的linux服務器上安裝了帶有RTMP模塊的nginx,我希望它從Open Broadcaster軟件接收RTMP流,將其轉換爲HLS,並在我的私人網站上用一些HTML5播放器播放它。通過RTMP接收數據流工作,但HLS數據流似乎不起作用。我現在的配置是像這樣:nginx HLS流不工作
worker_processes 1;
events {
worker_connections 1024;
}
http {
#include mime.types;
#default_type application/octet-stream;
sendfile off;
#keepalive_timeout 65;
server {
listen 8080;
#server_name localhost;
#location/{
# root html;
# index index.html index.htm;
#}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#error_page 500 502 503 504 /50x.html;
#location = /50x.html {
# root html;
#}
#*********************************************************************************************************************************
location /hls {
types {
application/vnd.apple.mpegurl m3u8;
}
root /mnt/;
add_header Cache-Control no-cache;
# To avoid issues with cross-domain HTTP requests (e.g. during development)
#add_header Access-Control-Allow-Origin *;
}
#*********************************************************************************************************************************
}
}
rtmp {
server {
listen 1935;
chunk_size 4096;
application stream {
live on;
#record off;
hls on;
hls_path /mnt/hls;
#hls_fragment 6s;
}
}
}
要收到我用rtmp://ip/stream/streamname
我嘗試使用http://ip:8080/hls/streamname.m3u8
這給了我.m3u8文件,如果我在瀏覽器中鍵入它的正常工作,接受HLS的RTMP流,但當我嘗試在HTML5播放器中播放文件時,似乎無法在網頁上工作。我正在測試通過這些網頁:https://videojs.github.io/videojs-contrib-hls/和https://demo.theoplayer.com/test-hls-mpeg-dash-stream
任何人都可以幫助我瞭解我在做什麼錯?
正如我與那些玩家一起測試的,我沒有得到任何明確的錯誤反饋,但是當我在VLC中測試流時,此解決方案起作用。我注意到的另一件事是,它只在我使用我的直接ip時起作用,而當我嘗試連接時沒有域名,所以我想有一些奇怪的設置在那裏出錯了(或者只是被域名提供商阻止)。 – Zamor