PHP code example of flyrory / qiniu-lb-sdk

1. Go to this page and download the library: Download flyrory/qiniu-lb-sdk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

flyrory / qiniu-lb-sdk example snippets


php artisan vendor:publish

# 创建流
$result = app(QiniuLb::class)->createStream($streamKey);

# 获取流信息
$result = app(QiniuLb::class)->getStreamInfo($streamKey);

# 获取流列表
$result = app(QiniuLb::class)->getStreamList($streamKey, $limit, $offset);

# 获取正在直播的流列表

$result = app(QiniuLb::class)->getLiveStreamList($streamKey, $limit, $offset);

# 批量查询流直播信息

$result = app(QiniuLb::class)->getBatchLiveStreamList($streamKeys);

# 查询流的直播状态
$result = app(QiniuLb::class)->getLiveStatus($streamKey);

# 禁用流

$result = app(QiniuLb::class)->disableStream($streamKey);

# 启用流

$result = app(QiniuLb::class)->enableStream($streamKey);

# 保存直播数据

$result = app(QiniuLb::class)->saveLive($streamKey, $options);

# 查询推流历史记录

$result = app(QiniuLb::class)->getHistoryActivity($streamKey, $start, $end);

# 保存直播截图

$result = app(QiniuLb::class)->saveSnapshot($streamKey, $options);

# 更改流的实时转码规格

$result = app(QiniuLb::class)->editConverts($streamKey, $options);

# 生成推流地址

$result = app(QiniuLb::class)->getRtmpPublishUrl($streamKey, $expireAfterSeconds);

# 生成rtmp播放地址

$result = app(QiniuLb::class)->getRtmpPlayUrl($streamKey);

# 生成hls(m3u8)播放地址

$result = app(QiniuLb::class)->getHlsPlayUrl($streamKey);

# 生成hdl(flv) 播放地址

$result = app(QiniuLb::class)->getHdlPlayUrl($streamKey);

# 生成直播封面截图地址

$result = app(QiniuLb::class)->getSnapshotPlayURL($streamKey);