💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
戏说前文 不要想太多,直播和你(php)没啥关系、帮忙配置一下推拉流地址和License、然后生成一下推拉流地址详细链接就好了 但是,像是送礼物,弹幕自己写长连接或调用im。家族,充币等都是逻辑问题,这里就不说了 下面 ## 第一步 配置推拉流地址 pusht 推流域名前缀 plavt 播放域名前缀 ![在这里插入图片描述](https://img-blog.csdnimg.cn/20201112105321331.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dhbmd6aGFl,size_16,color_FFFFFF,t_70#pic_center) **bizid** ![在这里插入图片描述](https://img-blog.csdnimg.cn/20201211162931984.png) **appkey** ![在这里插入图片描述](https://img-blog.csdnimg.cn/2020121116282785.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dhbmd6aGFl,size_16,color_FFFFFF,t_70) ## 第二步:生成地址 ![在这里插入图片描述](https://img-blog.csdnimg.cn/20201112093035189.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dhbmd6aGFl,size_16,color_FFFFFF,t_70#pic_center) 像这样生成 ```php if (!function_exists('create_live')) { function create_live($user_id = 0) { $live_bizid = Config::get("site.live_bizid");//直播bizid $live_sdkapp_id = Config::get("site.live_sdkapp_id");//直播sdkapp_id $push_domain = Config::get("site.push_domain");//推流域名 $play_domain = Config::get("site.play_domain");//播放域名 $live_key = Config::get("site.live_key");//直播key $live_expiry_time = Config::get("site.live_expiry_time");//直播过期时间 $livecode = $live_sdkapp_id.'_'.$user_id; //默认名// 推荐用随机数字或者用户 ID if ($live_key && $live_expiry_time) { $time = time()+$live_expiry_time; //过期时间 //strtoupper把所有字符转换为大写 base_convert把进制数转换: $txTime = strtoupper(base_convert($time,10,16)); //加密 $txSecret = md5($live_key.$livecode.$txTime); //StreamName(流 ID):推荐用随机数字或者用户 ID。 //bizid 直播bizid //txTime(地址有效期):何时该 URL 会过期,格式支持十六进制的 UNIX 时间戳。 //txSecret(防盗链签名):防止攻击者伪造您的后台生成推流 URL $ext_str = '?'.http_build_query(array( "bizid" => $live_bizid, "txSecret" => $txSecret, "txTime" => $txTime )); } $url = [ "push_url" => "rtmp://".$push_domain."/live/".$livecode.(isset($ext_str) ? $ext_str : ""), "rtmp_play_url" => "rtmp://".$play_domain."/live/".$livecode, "flv_play_url" => "http://".$play_domain."/live/$livecode.flv", "m3u8_play_url" => "http://".$play_domain."/live/$livecode.m3u8", ]; return $url; } } ``` ## 给安卓ios配置许可证 ![在这里插入图片描述](https://img-blog.csdnimg.cn/20201112092906585.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3dhbmd6aGFl,size_16,color_FFFFFF,t_70#pic_center)