微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

nginx-http-flv-module flv拉流错误有哪些

这篇文章主要介绍“Nginx-http-flv-module flv拉流错误有哪些”,在日常操作中,相信很多人在Nginx-http-flv-module flv拉流错误有哪些问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”Nginx-http-flv-module flv拉流错误有哪些”的疑惑有所帮助!接下来,请跟着小编一起来学习吧!

1.flv拉流错误

Uncaught (in promise) DOMException: play() Failed because the user didn't interact with the document first. https://goo.gl/xX8pDD

在video标签中加入 muted 即可

<video muted id="videoElement" class="centeredVideo" controls autoplay width="1024" height="576">
Your browser is too old which doesn't support HTML5 video.
</video>

2.HTML采用flv.js与dplayer播放器来播放http-flv格式视频时,请求nignx服务器遇到了chrom跨域的问题

Access to fetch at ‘http://192.168.31.66:9999/zzh-1586620072-2020-04-11-23_47_52.flv’ from origin ‘http://localhost:8080’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.

http{
    server {
        listen      8000;
        server_name localhost;
        add_header 'Access-Control-Allow-Origin' '*'; #允许所有来源访问
        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS, PUT, DELETE'; #允许访问的方式

3.推流权限控制

rtmp {  
    server {  
        listen 1935;  #监听的端口
        chunk_size 4000;
        application myapp {
            live on;
            notify_method get;
            publish_notify on;
            on_publish http://192.168.0.103:8087/autho/rtmp; #这里进行权限控制
			on_publish_done http://127.0.0.1:8087/autho/rtmpOver;#直播结束回调
        }  
        application hls {
            live on;
            hls on;
            hls_path /home/soap/rtmp/hls;#视频流存放地址
            hls_fragment 5s;
            hls_playlist_length 15s;
            hls_continuous on; #连续模式。
            hls_cleanup on;    #对多余的切片进行删除。
            hls_nested on;     #嵌套模式。
        }
    }  
}

4.flv拉取流的路径

http://example.com[:port]/dir?[port=xxx&]app=appname&stream=streamname

http://127.0.0.1:8000/live?app=myapp&stream=fhx

port认为1935

myapp为配置路径

fhx为流路径

5.obs设置

nginx-http-flv-module flv拉流错误有哪些

6.效果

nginx-http-flv-module flv拉流错误有哪些

到此,关于“Nginx-http-flv-module flv拉流错误有哪些”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注编程之家网站,小编会继续努力为大家带来更多实用的文章

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐