Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux 启动hls流后,wideo不移动_Linux_Nginx - Fatal编程技术网

Linux 启动hls流后,wideo不移动

Linux 启动hls流后,wideo不移动,linux,nginx,Linux,Nginx,我正在尝试创建一个网站来观看RTMP流。为此,我安装了nginx服务器,并将其设置为在http中显示rtmp流。作为流接收器,我在React.js中使用ReactPlayer组件创建了一个页面。不幸的是,当我在浏览器中打开选项卡时,图像没有移动 我已根据本指南准备了整个服务器: 所以从理论上讲,视频应该移动,但它不会。我检查了hls部件所在的文件夹,它们就在那里。你可以在下面看到 webapp@webapp-VirtualBox:/usr/local/nginx/conf$ ls -al /ng

我正在尝试创建一个网站来观看RTMP流。为此,我安装了nginx服务器,并将其设置为在http中显示rtmp流。作为流接收器,我在React.js中使用ReactPlayer组件创建了一个页面。不幸的是,当我在浏览器中打开选项卡时,图像没有移动

我已根据本指南准备了整个服务器:

所以从理论上讲,视频应该移动,但它不会。我检查了hls部件所在的文件夹,它们就在那里。你可以在下面看到

webapp@webapp-VirtualBox:/usr/local/nginx/conf$ ls -al /nginx/hls
razem 41668
drwxr-xr-x 2 nobody   www-data    4096 lis 21 15:03 .
drwxr-xr-x 3 www-data www-data    4096 lis 21 14:14 ..
-rw-r--r-- 1 nobody   nogroup  2690468 lis 21 15:01 stream-29.ts
-rw-r--r-- 1 nobody   nogroup  2692348 lis 21 15:01 stream-30.ts
-rw-r--r-- 1 nobody   nogroup  2689904 lis 21 15:02 stream-31.ts
-rw-r--r-- 1 nobody   nogroup  2690280 lis 21 15:02 stream-32.ts
-rw-r--r-- 1 nobody   nogroup  2690656 lis 21 15:02 stream-33.ts
-rw-r--r-- 1 nobody   nogroup  2689528 lis 21 15:02 stream-34.ts
-rw-r--r-- 1 nobody   nogroup  2689340 lis 21 15:02 stream-35.ts
-rw-r--r-- 1 nobody   nogroup  2689528 lis 21 15:02 stream-36.ts
-rw-r--r-- 1 nobody   nogroup  2690280 lis 21 15:02 stream-37.ts
-rw-r--r-- 1 nobody   nogroup  2689904 lis 21 15:03 stream-38.ts
-rw-r--r-- 1 nobody   nogroup  2689716 lis 21 15:03 stream-39.ts
-rw-r--r-- 1 nobody   nogroup  2689528 lis 21 15:03 stream-40.ts
-rw-r--r-- 1 nobody   nogroup  2689340 lis 21 15:03 stream-41.ts
-rw-r--r-- 1 nobody   nogroup  2689528 lis 21 15:03 stream-42.ts
-rw-r--r-- 1 nobody   nogroup  2713216 lis 21 15:03 stream-43.ts
-rw-r--r-- 1 nobody   nogroup  2257692 lis 21 15:03 stream-44.ts
-rw-r--r-- 1 nobody   nogroup     1316 lis 21 15:03 stream.m3u8
我还检查了vlc和ffplay中的图像,它们也没有移动。所以我怀疑这与不正确的nginx设置或linux中的访问有关。有没有人对在哪里寻找解决方案有什么好的建议

我还添加了我的nginx配置:

#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}


rtmp {
    server {
        listen 1935; # Listen on standard RTMP port
        chunk_size 4000;

        application show {
            live on;
            # Turn on HLS
            hls on;
            hls_path /nginx/hls/;
            hls_fragment 1;
            hls_playlist_length 60;
            # disable consuming the stream from nginx as rtmp
            deny play all;
        }
    }
}


http {
    sendfile off;
    tcp_nopush on;
    #aio on;
    directio 512;
    default_type application/octet-stream;

    server {
        listen 8081;

        location /hls {
        # Disable cache
        add_header 'Cache-Control' 'no-cache';

        # CORS setup
        add_header 'Access-Control-Allow-Origin' '*' always;
        add_header 'Access-Control-Expose-Headers' 'Content-Length';

        # allow CORS preflight requests
        if ($request_method = 'OPTIONS') {
            add_header 'Access-Control-Allow-Origin' '*';
            add_header 'Access-Control-Max-Age' 1728000;
            add_header 'Content-Type' 'text/plain charset=UTF-8';
            add_header 'Content-Length' 0;
            return 204;
        }

        types {
            application/dash+xml mpd;
            application/vnd.apple.mpegurl m3u8;
            video/mp2t ts;
        }

        root /nginx/;
        }
    }
}
提前感谢您的帮助。