引用 @vim /usr/local/src/nginx/conf/nginx.conf
rtmp {
server {
listen 1935; #监听的端口
chunk_size 4096;
application hls {#rtmp推流请求路径 (切记路径错了会推不上流)
live on; #开启实时
hls on; #开启hls
hls_path /usr/local/src/nginx/html/masssa; #rtmp推流请求路径,文件存放路径
hls_fragment 5s; #每个TS文件包含5秒的视频内容
}
}
}
#在server中添加
location /hls {
# Serve HLS fragments
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
root /home/wwwroot;
add_header Cache-Control no-cache;
#解决跨域问题
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Headers X-Requested-With;
add_header Access-Control-Allow-Methods GET,POST,OPTIONS;
}
|