0
$qiniu = $this->config->qiniu;

$auth = new \Qiniu\Auth($qiniu->accessKey, $qiniu->secretKey);
$config = new \Qiniu\Config();
$pfop = new \Qiniu\Processing\PersistentFop($auth, $config);

$bucket = $qiniu->bucket;
$pipeline = $qiniu->pipeline;
$notifyUrl = 'xxx.com/notify';
$force = false;

$fileName = date('Ymd');
$saveKey = \Qiniu\base64_urlSafeEncode("{$bucket}:{$fileName}.m3u8");        
$pattern = \Qiniu\base64_urlSafeEncode($fileName. '_$(count).ts');

$fops = "avthumb/m3u8/noDomain/1/segtime/30/pattern/{$pattern}|saveas/{$saveKey}";

$pfop->execute($bucket, $key, $fops, $pipeline, $notifyUrl, $force);

生成的文件如下:

  • 20171012.m3u8
  • 20171012_000000.ts
  • 20171012_000001.ts
  • 20171012_000002.ts

m3u8 文件内容如下:

#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-ALLOW-CACHE:YES
#EXT-X-TARGETDURATION:33
#EXTINF:30.600000,
/20171012_000000.ts
#EXTINF:32.120000,
/20171012_000001.ts
#EXTINF:25.880000,
/20171012_000002.ts
#EXT-X-ENDLIST

里面的ts文件都带了 / , 去掉 / 后才能正常播放,有遇到这个问题的吗?

1 个回答

0

使用一个flash的播放器播放不了,换vlc播放器能播放,应该不是七牛格式的问题。