tomaj / php-evostream
PHP 库,用于控制 Evostrem 服务器。
1.3.0
2017-04-13 06:32 UTC
Requires
- php: >=5.3.3
Requires (Dev)
- phpunit/phpunit: 4.1.*
- satooshi/php-coveralls: dev-master
- squizlabs/php_codesniffer: ~1.5
This package is not auto-updated.
Last update: 2024-09-14 16:13:34 UTC
README
这是一个基本的库,用于通过 PHP 控制与 evostream 服务器 API 交互。您可以同时控制一个或多个服务器。
如何安装
最佳安装方式是使用 composer 将其安装到项目中,或者您可以使用具有自己 CLI 运行器的库直接控制 evostream 服务器。
$ composer require tomaj/php-evostream
如何使用
运行基本的 version 命令
$command = new \Tomaj\Evostream\Command\Version();
$evostream = new \Tomaj\Evostream\Evostream(new \Tomaj\Evostream\Protocol\HttpProtocol());
$result = $evostream->addServer('127.0.0.1:7777')
->runCommand($command);
if ($result->allOk()) {
print_r($result->getResponses());
}
或者您可以将 pullStream 命令设置到多个服务器上
$command = new \Tomaj\Evostream\Command\PullStream();
$command->setUri('some stream url')
->setKeepAlive(true)
->setLocalStreamName('some local stream url')
->setTtl(10); // more sets available - check evostream api
$evostream = new \Tomaj\Evostream\Evostream(new \Tomaj\Evostream\Protocol\HttpProtocol());
$result = $evostream->addServers(array('192.168.1.101:7777', '192.168.1.102:7777'))
->runCommand($command);
if ($result->allOk()) {
print_r($result->getResponses());
}
每个 Evostream 命令都在库中实现,命令名称与 evostream API 调用名称相同,只是首字母大写。有关将 Evostream API 命令映射到 PHP 库命令的更多信息,请参阅 命令列表 章节下面。
如何从 CLI 使用
Cli 包装器是一个简单的命令行工具,用于命令 evostream 服务器。
示例使用控制台
php cli/run.php 129.168.1.101 pullStream uri=rtmp://... localStreamName=teststream
命令列表
所有 EvoStream API 命令均通过 PHP 库提供。
####流
- pullStream - Tomaj\Evostream\Command\PullStream
- pushStream - Tomaj\Evostream\Command\PushStream
- createHLSStream - Tomaj\Evostream\Command\CreateHLSStream
- createHDSStream - Tomaj\Evostream\Command\CreateHDSStream
- createMSSStream - Tomaj\Evostream\Command\CreateMSSStream
- record - Tomaj\Evostream\Command\Record
- transcode - Tomaj\Evostream\Command\Transcode
- listStreamsIds - Tomaj\Evostream\Command\ListStreamsIds
- getStreamInfo - Tomaj\Evostream\Command\GetStreamInfo
- listStreams - Tomaj\Evostream\Command\ListStreams
- getStreamsCount - Tomaj\Evostream\Command\GetStreamsCount
- shutdownStream - Tomaj\Evostream\Command\ShutdownStream
- listConfig - Tomaj\Evostream\Command\ListConfig
- removeConfig - Tomaj\Evostream\Command\RemoveConfig
- addStreamAlias - Tomaj\Evostream\Command\AddStreamAlias
- listStreamAliases - Tomaj\Evostream\Command\ListStreamAliases
- removeStreamAlias - Tomaj\Evostream\Command\RemoveStreamAlias
- flushStreamAliases - Tomaj\Evostream\Command\FlushStreamAliases
- createIngestPoint - Tomaj\Evostream\Command\CreateIngestPoint
- removeIngestPoint - Tomaj\Evostream\Command\RemoveIngestPoint
- listIngestPoints - Tomaj\Evostream\Command\ListIngestPoints
####实用工具
- launchProcess - Tomaj\Evostream\Command\LaunchProcess
- setTimer - Tomaj\Evostream\Command\SetTimer
- listTimers - Tomaj\Evostream\Command\ListTimers
- removeTimer - Tomaj\Evostream\Command\RemoveTimer
- insertPlaylistItem - Tomaj\Evostream\Command\InsertPlaylistItem
- listStorage - Tomaj\Evostream\Command\ListStorage
- addStorage - Tomaj\Evostream\Command\AddStorage
- removeStorage - Tomaj\Evostream\Command\RemoveStorage
- setAuthentication - Tomaj\Evostream\Command\SetAuthentication
- setLogLevel - Tomaj\Evostream\Command\SetLogLevel
- version - Tomaj\Evostream\Command\Version
- help - Tomaj\Evostream\Command\Help
- shutdownServer - Tomaj\Evostream\Command\ShutdownServer
####连接
- listConnectionsIds - Tomaj\Evostream\Command\ListConnectionsIds
- getConnectionInfo - Tomaj\Evostream\Command\GetConnectionInfo
- listConnections - Tomaj\Evostream\Command\ListConnections
- getExtendedConnectionCounters - Tomaj\Evostream\Command\GetExtendedConnectionCounters
- resetMaxFdCounters - Tomaj\Evostream\Command\ResetMaxFdCounters
- resetTotalFdCounters - Tomaj\Evostream\Command\ResetTotalFdCounters
- getConnectionsCount - Tomaj\Evostream\Command\GetConnectionsCount
- getConnectionsCountLimit - Tomaj\Evostream\Command\GetConnectionsCountLimit
- setConnectionsCountLimit - Tomaj\Evostream\Command\SetConnectionsCountLimit
- getBandwidth - Tomaj\Evostream\Command\GetBandwidth
- setBandwidthLimit - Tomaj\Evostream\Command\SetBandwidthLimit
####服务
- listServices - Tomaj\Evostream\Command\ListServices
- createService - Tomaj\Evostream\Command\CreateService
- enableService - Tomaj\Evostream\Command\EnableService
- shutdownService - Tomaj\Evostream\Command\ShutdownService
待办事项
- 实现telnet协议