php实现播放直播_PHP直播技术分享(一:实现直播)

推流服务器采用的是自搭的推流服务器 , 自己玩玩 做外包项目还是去搞七牛云/阿里这样的服务器吧,开始bb-----

1:技术栈

74d122bfcf51

image.jpeg

2:开发中业务

(1)主播申请时创建个秘钥 , 这个秘钥随时字符串即可到时候根据字符串找到拉流的直播位置存数据库包括推流地址

74d122bfcf51

image.png

3:配置nginx-rtmp

播放器用的是西瓜视频,hls协议基于http协议,nginx配置用hls协议配置如下:

rtmp {

server{

listen 1935;

chunk_size 4000;

application live{

live on;

hls on;

wait_key on; #对视频切片保护

hls_path /var/video/hls; #切片视频位置,要去创建目录

hls_fragment 10s; #切片时长

hls_playlist_length 60s; #可以回看的事件,这里设置一分钟

hls_continuous on; #连续模式

hls_cleanup on; #对多余切换删除

hls_nested on; # 嵌套模式

}

}

}

#再到server中拉流创建请求地址并设置防止跨域

location /live {

types {

application/vnd.apple.mpegurl m3u8;

video/mp27 ts;

}

alias /var/video/hls;

autoindex on;

expires -1;

add_header Cache-Control no-cache;

add_header 'Access-Control-Allow-Origin' '*';

add_header 'Access-Control-Allow-Creadentials' 'true';

add_header 'Access-Control-Allow-Methods' 'GET,POST';

add_header 'Access-Control-Allow-Headers' 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';

}

3:使用obs进行推流

74d122bfcf51

image.png

74d122bfcf51

image.png

4:进行拉流

西瓜播放器的SDK:

这秘钥就申请为主播到时候创建,去拉去这个index.m3u8即可

74d122bfcf51

image.png

74d122bfcf51

image.png

74d122bfcf51

image.png

74d122bfcf51

image.png

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/440776.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

php获取location,php获取header[‘location’]信息常见问题

15/01/31本文关键字: 302, header, location//初始化url信息$host “#8221;;$url$host.”l/rzTf7ap2viw/&iid222004556&resourceId0_04_05_99/v.swf”;//按照字段获取header响应信息$headers get_headers($url, TRUE);//获取这个土豆的302跳转地址$u302 $headers[“Lo…

php对联广告,html左右对联代码 cms网站对联广告html代码

实现网页左右两侧居中的对联广告代码你只记得自己有好多朋友却从没想过小编只有你一人。无标题文档 #left{ width:200px;height:450px; position:absolute; left:0px; background:red; border:1px #000 solid} #right{width:200px;height:450px; position:absolute; right:0px;…

php 分页 url重写 分页问题,解决千古难题,wordpress分页URL问题,wordpress给分页加链接...

原本的wordpress文章如果分页会成如下的结构:http://www.xyqzmt.cn/1.html/2通常固定链接都是这样的结构,设为/%postname%.html或者/%post_id%.html 以前我一直无法解决如上的问题,最后放弃挣扎,如果遇到很长的文章全都放在一个页…

【牛客 - 181F】子序列(容斥,组合数,费马小定理)

题干: 题目描述 给出一个长度为n的序列,你需要计算出所有长度为k的子序列中,除最大最小数之外所有数的乘积相乘的结果 输入描述: 第一行一个整数T,表示数据组数。 对于每组数据,第一行两个整数N,k&#…

【CodeForces - 485C】Bits (二进制相关,数学,贪心)

题干: Lets denote as the number of bits set (1 bits) in the binary representation of the non-negative integer x. You are given multiple queries consisting of pairs of integers l and r. For each query, find the x, such that l ≤ x ≤ r, an…

php工程导致系统蓝屏,经常蓝屏是什么原因

经常蓝屏的原因:1、错误安装或更新显卡驱动后导致电脑蓝屏;2、超频过度是导致蓝屏;3、安装的软件存在不兼容;4、电脑内部硬件温度过高;5、内存条接触不良或内存损坏。错误更新显卡驱动错误安装或更新显卡驱动后导致电脑…

【CodeForces - 485A】Factory (水题,抽屉原理,tricks)

题干: One industrial factory is reforming working plan. The director suggested to set a mythical detail production norm. If at the beginning of the day there were x details in the factory storage, then by the end of the day the factory has to p…

matlab调用哈希表,ros与matlab联动使用

ros与matlab联动使用联动使用教程1 ubuntu18.04或16.04下安装matlab R2017b参考链接2 ubuntu下基于matlab启动rosmatlab中常用命令如下:查看robotics system toolbox工具箱是否安装成功help robotics.rosrosinit ——表示启动ROS,相当于roscorerosshutdo…

【CodeForces - 1020A】New Building for SIS(模拟)

题干: You are looking at the floor plan of the Summer Informatics Schools new building. You were tasked with SIS logistics, so you really care about travel time between different locations: it is important to know how long it would take to get …

【CodeForces - 1020B】Badge(模拟,图,环)

题干: In Summer Informatics School, if a student doesnt behave well, teachers make a hole in his badge. And today one of the teachers caught a group of nn students doing yet another trick. Lets assume that all these students are numbered from …

【Hihocoder - 1723】子树统计(线性基合并)

题干: 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 给定一棵N个节点的有根树,树上每个节点有一个非负整数权重Wi。定义节点集合S{i1, i2, ……, ir}的总权重为:(⊕是异或运算) 每次询问一棵子树内所有可能出现的总权重数量&a…

【CodeForces - 485D】Maximum Value (枚举,用数组离散化,数学,取模运算,因子,筛法)

题干: You are given a sequence a consisting of n integers. Find the maximum possible value of (integer remainder of ai divided by aj), where 1 ≤ i, j ≤ n and ai ≥ aj. Input The first line contains integer n — the length of the seq…

【牛客 - 371牛客OI周赛7-提高组A】小睿睿的等式(dp,暴力 )

题干: 链接:https://ac.nowcoder.com/acm/contest/371/A 来源:牛客网 小睿睿在游戏开始时有n根火柴棒,他想知道能摆成形如“ABn”的等式且使用的火柴棒数也恰好等于n/k的等式有多少种(BAn与ABn看作一种) 注: “”与…

oracle用户新增数据文件,[数据库]20200722_Oracle添加表空间、用户,用户授权

[数据库]20200722_Oracle添加表空间、用户,用户授权0 2020-07-25 17:00:30--创建表空间CREATE TABLESPACE aifu --表空间名 aifu LOGGING DATAFILE D:\dev_config\OracleTableSpaces\aifu.DBF SIZE 5M --数据文件路径 D:\dev_config\OracleTableSpaces AUTOEXTEND O…

【牛客 - 327牛客寒假算法基础集训营2 I】处女座的测验(二)(积性函数性质,数论,素数唯一性分解,STL)

题干: 链接:https://ac.nowcoder.com/acm/contest/327/I 来源:牛客网 现在处女座顺利的完成了测验,处女座想要知道知道自己输出的结果是否正确。他希望知道自己有自己输出的数中有多少对是不满足要求的。 更具体的&#xff0c…

linux监控命令执行,你可能不知道的 即时监控 Linux 使用者执行指令的三种方法...

原标题:你可能不知道的 即时监控 Linux 使用者执行指令的三种方法这里介绍如何在 Linux 系统上以管理者权限即时监控一般使用者所执行的任何指令。Linux 的 root 管理者可对系统进行任何的管理与操作,如果想要即时监控特定使用者在主机上所执行的指令&am…

【POJ - 2728】Desert King (最有比率生成树,分数规划)

题干: David the Great has just become the king of a desert country. To win the respect of his people, he decided to build channels all over his country to bring water to every village. Villages which are connected to his capital village will be…

linux远程打开windows程序,为新手讲解Linux和Windows系统的远程桌面访问知识

很多新手都是使用Linux和Windows双系统的,它们之间的远程桌面访问是如何连接的,我们就为新手讲解Linux和Windows系统的远程桌面访问知识,包括所使用的软件及方法。本文所使用的Linux版本是深度操作系统,如果要安装该版本请参考U盘…

【蓝桥杯官网试题 - 算法训练 】K好数(线性dp与优化)

题干: 问题描述 如果一个自然数N的K进制表示中任意的相邻的两位都不是相邻的数字,那么我们就说这个数是K好数。求L位K进制数中K好数的数目。例如K 4,L 2的时候,所有K好数为11、13、20、22、30、31、33 共7个。由于这个数目很大…

【CodeForces - 897D】Ithea Plays With Chtholly (交互题型,贪心,思维构造,题目信息)

题目大意: This is an interactive problem. Refer to the Interaction section below for better understanding. Ithea and Chtholly want to play a game in order to determine who can use the kitchen tonight. Initially, Ithea puts n clear sheets of pa…