·您当前的位置:首页 > 技术教程 > FFmpeg技术 >

[nginx]nginx.conf的配置文件做m3u8的支持

时间:2017-10-26 23:21酷播
[nginx]nginx.conf的配置文件做m3u8的支持,[nginx]nginx.conf的配置文件做m3u8的支持

nginx.conf的配置文件做m3u8的支持

  1. worker_processes  1;   
  2. error_log  logs/error.log debug;   
  3. events {   
  4.     worker_connections  1024;   
  5. }   
  6. rtmp {   
  7.     server {   
  8.         listen 1935;   
  9.         application myapp {   
  10.             live on;   
  11.             #record keyframes;   
  12.             #record_path /tmp;   
  13.             #record_max_size 128K;   
  14.             #record_interval 30s;   
  15.             #record_suffix .this.is.flv;   
  16.             #on_publish http://localhost:8080/publish;   
  17.             #on_play http://localhost:8080/play;   
  18.             #on_record_done http://localhost:8080/record_done;   
  19.         }   
  20.         application hls {     
  21.              live on;     
  22.              hls on;     
  23.              hls_path /tmp/app;     
  24.              hls_fragment 5s;     
  25.        }     
  26.     }   
  27. }   
  28. http {   
  29.     autoindex on;   
  30.     server {   
  31.         listen      8080;   
  32.         location /stat {   
  33.             rtmp_stat all;   
  34.             rtmp_stat_stylesheet stat.xsl;   
  35.         }   
  36.         location /stat.xsl {   
  37.             root /opt/nginx/nginx-rtmp-module/;   
  38.         }   
  39.         location /control {   
  40.             rtmp_control all;   
  41.         }   
  42.         #location /publish {   
  43.         #    return 201;   
  44.         #}   
  45.         #location /play {   
  46.         #    return 202;   
  47.         #}   
  48.         #location /record_done {   
  49.         #    return 203;   
  50.         #}   
  51.         location /rtmp-publisher {   
  52.             root /opt/nginx/nginx-rtmp-module/test;   
  53.         }   
  54.         location /hls {     
  55.            #server hls fragments     
  56.            types{     
  57.              application/vnd.apple.mpegurl m3u8;     
  58.              video/mp2t ts;     
  59.            }     
  60.         alias /tmp/app;     
  61.         expires -1;     
  62.         }     
  63.         location / {   
  64.             root /opt/nginx/nginx-rtmp-module/test/www;   
  65.         }   
  66.     }   
  67. }   

 调用测试时可以用

  1. <html>   
  2. <head>   
  3. <title>HTTP Live Streaming Example</title>   
  4. </head>   
  5. <body>   
  6. <video src="http://www.cuplayer.com/iphone/samples/bipbop/bipbopall.m3u8" height="300" width="400">   
  7. </video>        
  8. </body>   
  9. </html>   

当然也可以下载酷播V4的最新款跨平台播放器来测试,下载地址是:http://www.cuplayer.com/cuplayer/download.html

\\player

酷播V4.0版跨平台网页播放器(完全免费/支持右键自定义)

热门文章推荐

请稍候...

保利威视云平台-轻松实现点播直播视频应用

酷播云数据统计分析跨平台播放器