chrisyue / mala
Transform your m3u8 videos into a http live streaming channel
1.0.2
2016-03-20 10:39 UTC
Requires
- php: >=5.3.9
- chrisyue/php-m3u8: ^1.0.0
Requires (Dev)
This package is auto-updated.
Last update: 2024-10-25 15:20:57 UTC
README
v1.0.2
Transform your m3u8 videos into a http live streaming channel
Installation
$ composer require 'chrisyue/mala'
Usage
I suggest you check the mala-demo to see more details.
Suppose you've already implemented all interfaces under Model
and Manager
namespaces, then you can
Generate EPG with m3u8 videos and generate hls playlist (scheduled media segments)
// $epgManager = Chrisyue\Mala\Manager\EpgManagerInterface; // $videoManager = Chrisyue\Mala\Manager\VideoManagerInterface; $epgScheduler = new \Chrisyue\Mala\EpgScheduler($epgManager, $videoManager); // $channel = Chrisyue\Mala\Model\ChannelInterface; // generate tomorrow's epg $epgScheduler->schedule($channel, new \DateTime('tomorror midnight'), new \DateTime('tomorrow 23:59:59')); // generate playlist // $mediaSegmentManager = ...; $parser = new \Chrisyue\PhpM3u8\Parser(); $playlistScheduler = new \Chrisyue\Mala\PlaylistScheduler($parser, $epgManager, $mediaSegmentManager); $playlistScheduler->schedule($channel, new \DateTime('tomorror midnight'), new \DateTime('tomorrow 23:59:59'));
Generate current hls m3u8 from scheduled epg and playlist
// $mediaSegmentManager = ...; $options = ['target_duration' => 10, 'version' => 3]; $m3u8Generator = new M3u8Generator($mediaSegmentManager, $options); // $channel = ...; $m3u8 = $m3u8Generator->generate($channel[, $playsAt]); // or can you specify the play time as the 2nd parameter // $dumper = ...; $dumper->dump($m3u8);
You can check the mala-demo to get more details and examples about implementing the model/manager interfaces