Skip to content
/ mala Public

Translate your http video resources (m3u8) into an http live streaming channel

License

Notifications You must be signed in to change notification settings

chrisyue/mala

Repository files navigation

Mala

v1.0.2

Transform your m3u8 videos into a http live streaming channel

SensioLabsInsight

Latest Stable Version License Build Status Scrutinizer Code Quality Code Coverage StyleCI

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

About

Translate your http video resources (m3u8) into an http live streaming channel

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages