温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

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

发布时间:2021-12-10 16:29:41 来源:亿速云 阅读:201 作者:iii 栏目:大数据

这篇文章主要介绍“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拉流错误有哪些”的学习就结束了,希望能够解决大家的疑惑。理论与实践的搭配能更好的帮助大家学习,快去试试吧!若想继续学习更多相关知识,请继续关注亿速云网站,小编会继续努力为大家带来更多实用的文章!

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI