流媒体MediaStream

NGINX配置rtmp块只需要配置一个application就可以了
application myapp {
            live on;//开启直播
            gop_cache on;
            hls on;//开启切片
            hls_path /usr/local/nginx/myapp;//切片存放路径
}
使用OBS推流
rtmp://example.com[:port]/appname/streamname
http-flv播放形式:(配合bilibili的flv.js播放)
http://example.com[:port]/dir?[port=xxx&]app=appname&stream=streamname
需要配置dir为http块中location的对应块,块中要标明下列等信息
flv_live on;
chunked_transfer_encoding  on;
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
RTMP播放形式:(VLC media player可以播放)
rtmp://example.com[:port]/appname/streamname
HLS播放方式:(VLC media player可以播放)
http://example.com[:port]/dir/streamname.m3u8
需要配置dir为http块中location的对应块,块中要标明
types {
        application/vnd.apple.mpegurl m3u8;
         video/mp2t ts;
}
alias /usr/local/nginx/myapp;
add_header 'Cache-Control' 'no-cache';
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
videojs可以播放rtmp和hls
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值