https://github.com/chrisyue/mala
Translate your http video resources (m3u8) into an http live streaming channel
https://github.com/chrisyue/mala
epg hls m3u m3u8 m3u8-videos php playlist
Last synced: 6 months ago
JSON representation
Translate your http video resources (m3u8) into an http live streaming channel
- Host: GitHub
- URL: https://github.com/chrisyue/mala
- Owner: chrisyue
- License: mit
- Created: 2016-03-01T03:08:53.000Z (over 9 years ago)
- Default Branch: develop
- Last Pushed: 2016-03-20T10:39:20.000Z (over 9 years ago)
- Last Synced: 2025-04-11T21:06:37.132Z (6 months ago)
- Topics: epg, hls, m3u, m3u8, m3u8-videos, php, playlist
- Language: PHP
- Homepage:
- Size: 15.6 KB
- Stars: 6
- Watchers: 1
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Mala
====v1.0.2
Transform your m3u8 videos into a http live streaming channel
[](https://insight.sensiolabs.com/projects/f2d48dbd-2a9c-42eb-94ee-a097fb79e1f6)
[](https://packagist.org/packages/chrisyue/mala)
[](https://packagist.org/packages/chrisyue/mala)
[](https://travis-ci.org/chrisyue/mala)
[](https://scrutinizer-ci.com/g/chrisyue/mala/?branch=develop)
[](https://scrutinizer-ci.com/g/chrisyue/mala/?branch=develop)
[](https://styleci.io/repos/52257600)Installation
------------```
$ composer require 'chrisyue/mala'
```Usage
-----I suggest you check the [mala-demo](https://github.com/chrisyue/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)
```php
// $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
```php
// $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](https://github.com/chrisyue/mala-demo) to get more details and examples about implementing the model/manager interfaces