nginx hls stream not working in pc browsers

80 views Asked by At

so i have nginx runing in my ubuntu 20 and rtmp active for hls. in iOS device and android all browsers work fine but in pc browsers not play stream link.in Firefox window I get this error : no video with supported format and mime type found. i share my nginx config . appreciate for help.

this is site_availeble.conf

server {
    listen 80 default_server;
    listen [::]:80 default_server;
    
    listen 443 ssl default_server;
        listen [::]:443 ssl default_server;
        ssl_certificate /etc/nginx/certificate/ssl-certificate.crt;
        ssl_certificate_key /etc/nginx/certificate/private.key;
    
    index index.html index.htm index.nginx-debian.html index.php;

    server_name _;

    location / {
        root /usr/share/nginx/html;
    add_header Cache-Control no-cache;
    add_header 'Access-Control-Allow-Origin' '*';
    
    }
    types {
                application/dash+xml mpd;
                application/vnd.apple.mpegurl m3u8;
                video/mp2t ts;
        video/mp4 mp4;
            }
}

and this is nginx.conf

user www-data;
worker_processes  auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
    worker_connections 810;
}

http {
    tcp_nopush on;
    tcp_nodelay on;
    sendfile        off;
    keepalive_timeout 65;
    types_hash_max_size 2048;
    client_body_timeout 10s;
    client_header_timeout 10s;
    add_header Content-Disposition "attachment";

    
    include /etc/nginx/mime.types;
    default_type application/octet-stream;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
    ssl_prefer_server_ciphers on;

    gzip on;

    include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;
}
rtmp {
        server {
                listen 1935;
                chunk_size 4096;

                application live {
                        live on;
                    hls on;
                    hls_path /usr/share/nginx/html/hls;
                    hls_fragment 3;
                    hls_playlist_length 60;

            exec ffmpeg -i rtmp://localhost:1935/stream/$name
              -c:a aac -c:v libx264 -vf yadif -b:v 1100k -f flv -g 60 -r 30 -s 1280x720 -force_key_frames expr:gte(t,n_forced*2) -preset superfast -profile:v main rtmp://localhost:1935/hls/$name_720p2628kbs
              -c:a aac -c:v libx264 -vf yadif -b:v 600k -f flv -g 60 -r 30 -s 854x480 -force_key_frames expr:gte(t,n_forced*2) -preset superfast -profile:v main rtmp://localhost:1935/hls/$name_480p1128kbs
              -c:a aac -c:v libx264 -vf yadif -b:v 300k -f flv -g 60 -r 30 -s 640x360 -force_key_frames expr:gte(t,n_forced*2) -preset superfast -profile:v main rtmp://localhost:1935/hls/$name_360p878kbs;



                    # MPEG-DASH is similar to HLS
                    dash on;
                    dash_path /usr/share/nginx/html/hls/dash;

                    # disable consuming the stream from nginx as rtmp
                    deny play all;
                }
    
        }
}

and link I use in browser like this

https://myip/hls/test.m3u8
0

There are 0 answers