zoukankan      html  css  js  c++  java
  • nginx配置hls

    备注:本来是想用浏览器播放hls,后来没有成功,最后使用flash播放rtmp的方案。所以下面的配置未使用。

    修改/usr/local/nginx/conf/nginx.conf文件内容如下:

    worker_processes  1;
    error_log  logs/error.log debug;
    events {
        worker_connections  1024;
    }
    rtmp {
        server {
            listen 1936;
            application live{
                live on;
                #record keyframes;
                #record_path /tmp;
                #record_max_size 128K;
                #record_interval 30s;
                #record_suffix .this.is.flv;
                #on_publish http://localhost:8080/publish;
                #on_play http://localhost:8080/play;
                #on_record_done http://localhost:8080/record_done;
            }
        }
    }
    rtmp {
        server {
            listen 1935;
            chunk_size 4000;
            #HLS
            application hls {
                live on;
                hls on;
                hls_path /usr/local/nginx/html/hls;
                hls_fragment 5s;
            }
        }
    }
    http {
        server {
            listen  8080;
            location /hls {
                # Serve HLS fragments
                types {
                    application/vnd.apple.mpegurl m3u8;
                    video/mp2t ts;
                }
                root html;
                expires -1;
            }
        }
        server {
            listen      8081;
            location /stat {
                rtmp_stat all;
                rtmp_stat_stylesheet stat.xsl;
            }
            location /stat.xsl {
                root /html/nginx-rtmp-module/;
            }
            location /control {nginx-rtmp-module/
                rtmp_control all;
            }
            location / {
                root /html/nginx-rtmp-module/test/www;
            }
        }
    }
    

     如果推流地址为:“rtmp://192.168.1.104/hls/mystream” ,则访问路径为“http://192.168.1.104:8080/hls/mystream.m3u8”,可以使用VLC播放测试

  • 相关阅读:
    Use JAWS 14 in a VM
    远程文件拷贝
    MVA Prototype Only User License
    Global.asax 详解
    GridView of different size items
    Windows Phone 8, 添加Map控件
    动态规划——递归写法和递推写法
    守形数
    遍历链表
    成绩排序
  • 原文地址:https://www.cnblogs.com/wuchaodzxx/p/8204242.html
Copyright © 2011-2022 走看看