幽灵资源网 Design By www.bzswh.com
戏说前文
不要想太多,直播和你(php)没啥关系、帮忙配置一下推拉流地址和License、然后生成一下推拉流地址详细链接就好了
但是,像是送礼物,弹幕自己写长连接或调用im。家族,充币等都是逻辑问题,这里就不说了
下面
第一步 配置推拉流地址
bizid
appkey
第二步:生成地址
像这样生成
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 = '"bizid" => $live_bizid,
"txSecret" => $txSecret,
"txTime" => $txTime
));
}
$url = [
"push_url" => "rtmp://".$push_domain."/live/".$livecode.(isset($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配置许可证
标签:
php和腾讯直播,php腾讯直播
幽灵资源网 Design By www.bzswh.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
幽灵资源网 Design By www.bzswh.com
暂无评论...




