PHP code example of chrisyue / mala

1. Go to this page and download the library: Download chrisyue/mala 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/ */

    

chrisyue / mala example snippets


// $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'));

// $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);