• 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播放测试

  • 相关阅读:
    Android在代码中获取应用签名
    Android之密码的显示与隐藏
    如何把本地项目上传到Github
    Android之移动热修复
    Android之apk优化
    Android之内存泄漏
    Java类加载顺序
    mysql系列-⼀条SQL查询语句是如何执⾏的?
    java操作redis(jedis)常用方法示例
    mybatis拦截器实现通用权限字段添加
  • 原文地址:https://www.cnblogs.com/wuchaodzxx/p/8204242.html
Copyright © 2020-2023  润新知