PHP code example of aminyazdanpanah / php-shaka
1. Go to this page and download the library: Download aminyazdanpanah/php-shaka 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/ */
aminyazdanpanah / php-shaka example snippets
$config = [
'packager.binaries' => 'path/to/packager/binary',
'timeout' => 3600
];
$shaka = \Shaka\Shaka::initialize($config);
php
$stream1 = \Shaka\Options\Streams\Stream::input('/the/path/to/the/file');
$stream2 = \Shaka\Options\Streams\Stream::input('/the/path/to/the/file');
//...
php
$stream1->streamSelector('video')
->output('video.mp4');
php
$export = $shaka->streams($stream)
->mediaFileAnalysis()
->export();
php
$stream1 = Stream::input('/the/path/to/the/file')
->streamSelector('video')
->output('video.mp4');
$stream2 = Stream::input('/the/path/to/the/file')
->streamSelector('audio')
->output('audio.mp4');
$export = $shaka->streams($stream1, $stream2)
->mediaPackaging()
->export();
php
$export = $shaka->streams($stream1, $stream2, ...)
->mediaPackaging()
->DASH('output.mpd', function ($options) {
return $options->generateStaticLiveMpd();
//->other options;
})
->export();
php
$export = $shaka->streams($stream1, $stream2, ...)
->mediaPackaging()
->HLS('output.m3u8', function ($options) {
return $options->HLSMasterPlaylistOutput();
//->other options;
})
->export();
php
$export = $shaka->streams($stream1, $stream2, ...)
->mediaPackaging()
->HLS('hls.m3u8')
->DASH('dash.mpd')
->export();
text
udp://<ip>:<port>[?<option>[&<option>]...]
text
udp://224.1.2.30:88?interface=10.11.12.13&reuse=1
php
$export = $shaka->streams($stream1, $stream2, ...)
->mediaPackaging()
->DRM('widevine', function ($options) {
return $options->keyServerUrl('https://license.uat.widevine.com/cenc/getcontentkey/widevine_test')**
->//other options
})
->HLS('hls.m3u8')
->DASH('dash.mpd')
->export();
php
$export = $shaka->streams($stream1, $stream2, ...)
->mediaPackaging()
->DRM('playReady', function ($options) {
return $options->playreadyServerUrl('http://playready.get.key')
->//other options
})
->HLS('hls.m3u8')
->DASH('dash.mpd')
->export();
php
$export = $shaka->streams($stream1, $stream2, ...)
->mediaPackaging()
->DRM('raw', function ($options) {
return $options->keys('...keys')
->//other options
})
->HLS('hls.m3u8')
->DASH('dash.mpd')
->export();
php
$export = $shaka->streams($stream1, $stream2, ...)
->mediaPackaging()
->HLS('hls.m3u8', function ($options) {
return $options->adCues('600;1800;3000');
})
->DASH('dash.mpd', function ($options) {
return $options->adCues('600;1800;3000');
})
->export();