nginx m3u8 ffmpeg
# nginx config
location /hls { types { application/vnd.apple.mpegurl m3u8; video/mp2t ts; } root "/var/www/m3u8/"; add_header Cache-Control no-cache; add_header Access-Control-Allow-Origin *; } # ffmpeg command ffmpeg -i demo.flv -codec: copy -start_number 0 -hls_time 10 -hls_list_size 0 -f hls /var/www/m3u8/hls/filename.m3u8 # html code <body> <script src="https://cdn.bootcdn.net/ajax/libs/hls.js/1.2.4/hls.js"></script> <div id="dplayer"></div> <script src="https://cdn.bootcdn.net/ajax/libs/dplayer/1.27.0/DPlayer.min.js"></script> </body> </html> <script> const dp = new DPlayer({ container: document.getElementById('dplayer'), video: { url: 'http://laravel9.test/hls/filename.m3u8', }, }); </script>