lezhnev74/hls-monitor

控制台脚本,用于监控HLS链接是否可访问(支持自适应流媒体)

安装: 67

依赖项: 0

建议者: 0

安全性: 0

星标: 12

关注者: 2

分支: 6

开放问题: 0

类型:项目

1.0.10 2022-02-16 14:08 UTC

This package is auto-updated.

Last update: 2024-09-16 19:28:52 UTC


README

控制台脚本,用于监控HLS链接是否可访问(支持自适应流媒体)

通过Composer安装

composer require lezhnev74/hls-monitor

用法

该包包含一个控制台文件,位于vendor/bin/hls-monitor。请检查播放列表是否可用,以及所有流是否可以从互联网访问(10个并发连接)

vendor/bin/hls-monitor playlists --log log.txt --concurrency=10 https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8

输出将类似于以下内容

#---------------------------------------------------
Executed on node: <YOUR_PUBLIC_IP>
Date of execution: 29.11.2016, 10:04 UTC
#---------------------------------------------------

Concurrency level:50
Playlists fetching is over in 0.7s
Streams fetching is over in 0.68s
Chunks fetching is over in 255.22s

控制台命令如果没有发现任何问题,将返回代码0。如果某个流不可访问,您将看到如下内容

#---------------------------------------------------
Executed on node: <YOU_PUBLIC_IP>
Date of execution: 29.11.2016, 11:11 UTC
#---------------------------------------------------

Downloading playlist...DONE
Playlist is located on: 127.0.0.1
Found streams in playlist: 3
Started checking streams
Stream is not accessible: http://m3u8provider.dev.com/stream2.m3u8
Stream has unaccessible chunks:
|--Chunk: http://m3u8provider.dev.com/04.ts
|--Chunk: http://m3u8provider.dev.com/05.ts
|---
Checking Streams is DONE

报告

在这个版本中,库没有报告功能。

您需要为这个工具编写一个包装器,以捕获所有失败的输出,并将其通过电子邮件发送给您或报告到其他地方。

伪代码如下所示

$playlists = [...many playlists to check...];
$failed_reports = [];

// for each given playlist - make checking
$output = [];
$return_code = 0;
exec('vendor/bin/hls-monitor playlists '.implode(",",$playlists), $output, $return_code);   
   
if($return_code) {
   // there were problems with this palylist
   $failed_reports[] = $output;
}


// then report if anything is not good
if(count($failed_reports)) {
   // mail reports to somewhere
}