123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- namespace Live\Lib;
- use Dever;
- class Cron
- {
- public function getStream_api()
- {
- }
- public function getUrl_api()
- {
- }
- # 定时获取 所有流的状态 获取推流地址、拉流地址、推流历史等
- public function getStream()
- {
- $data = Dever::db('live/stream')->state();
- if ($data) {
- foreach ($data as $k => $v) {
- $handle = new Handle();
- $data = $handle->get($v['id']);
- }
- }
- return 'yes';
- }
- # 定时获取 所有的直播视频的回放地址
- public function getUrl()
- {
- $video = Dever::config('base', 'live')->video;
- $data = Dever::db($video['table'])->state();
- if ($data) {
- $time = time();
- foreach ($data as $k => $v) {
- if ($v[$video['stream_id']] > 0 && !$v[$video['url_m3u8']] && $v[$video['sdate']] > 0 && $v[$video['edate']] > 0 && $time >= $v[$video['edate']]) {
- $info = Dever::db('live/stream')->one($v[$video['stream_id']]);
- $config = Dever::db('live/info')->one($info['live_id']);
- $handle = new Handle();
- $method = $handle->method($config);
- $handle->createUrlOne($v, $video, $method, $config, $info);
- }
- }
- }
- return 'yes';
- }
- }
|