https://github.com/chrisyue/mala-demo
mala demo with symfony and doctrine
https://github.com/chrisyue/mala-demo
m3u8 php symfony symfony-application
Last synced: about 2 months ago
JSON representation
mala demo with symfony and doctrine
- Host: GitHub
- URL: https://github.com/chrisyue/mala-demo
- Owner: chrisyue
- License: mit
- Created: 2016-03-19T04:42:12.000Z (about 9 years ago)
- Default Branch: develop
- Last Pushed: 2016-03-20T10:34:04.000Z (about 9 years ago)
- Last Synced: 2025-01-14T15:23:44.996Z (3 months ago)
- Topics: m3u8, php, symfony, symfony-application
- Language: PHP
- Size: 49.8 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Mala Demo
=========This project demostrates how to use [Mala](https://github.com/chrisyue/mala),
a PHP lib to transform your m3u8 files into a http live stream, with Symfony and DoctrineTutorial
--------To make a HTTP live stream, you should need some model:
- A `Channel`, which implements `Chrisyue\Mala\Model\ChannelInterface`
- A `Video`, which implements `Chrisyue\Mala\Model\VideoInterface`
- A `Program`, which implements `Chrisyue\Mala\Model\ProgramInterface`
- The last thing, a `ScheduledMediaSegment`, which is already a class in Mala, represent a m3u8 [media segment](https://tools.ietf.org/html/draft-pantos-http-live-streaming-18#page-5)In a Symfony project, those model would like to be entities(in the `src/AppBundle/Entity`)
And also, we need some manager to manipulate those models:
- `EpgManager`, which implements `Chrisyue\Mala\Manager\EpgManagerInterface`, manages programs
- `MediaSegmentsManager`, which implements `Chrisyue\Mala\Manager\MediaSegmentManagerInterface`
- `VideoManager`, which implements `Chrisyue\Mala\Manager\VideoManagerInterface`They are located in `src/AppBundle/Manager`, except `VideoManger`,
because `VideoManager` is only used to fetch videos, which is much like a `EntityRepository`
in a typical Symfony + Doctrine project.So `VideoRepository` implements the `Chrisyue\Mala\Manager\VideoManagerInterface`
instead of `VideoManager`. It's located in `src/AppBundle/Entity`You can check the source code of this project to see more details
You can try Mala using this demo
--------------------------------First of all, you should create the database and schema:
```
$ php app/console doctrine:database:create
$ php app/console doctrine:schema:create
```then create a channel:
```
$ php app/console app:channel:create
```which should create a channel. you should check the channel id in the database
after the channel is created, create some videos:
```
$ php app/console app:video:create
```after the video is created, you can schedule epg of the channel with those videos in a specified period:
```
$ php app/console app:epg:schedule --starts-at='now' --ends-at='tomorrow'
````starts-at` and `ends-at` can be any phrase you can use in PHP `strtotime` function
then you can schedule the playlist:
```
$ php app/console app:playlist:schedule --starts-at='now' --ends-at='tomorrow'
```start the server by
```
$ php app/console server:start
```finally you can browse the HLS uri `http://localhost:8000/.m3u8` to check if there are errors.
if no error raised you can use VLC or Quicktime or other players supporting HLS to see the HTTP live channel you've created!