PHP code example of juzaweb / laravel-hls-converter
1. Go to this page and download the library: Download juzaweb/laravel-hls-converter 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/ */
juzaweb / laravel-hls-converter example snippets
use Juzaweb\HLSConverter\HLSConverter;
$input = storage_path('app/videos/sample.mp4');
$output = storage_path('app/hls/single');
app(HLSConverter::class)->convert($input, $output);
use Juzaweb\HLSConverter\HLSConverter;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class ConvertVideoToHLSJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public $tries = 3;
public $timeout = 120;
public function __construct(
protected string $input,
protected string $output,
protected ?array $resolutions = null
) {}
public function handle()
{
app(HLSConverter::class)->convert($this->input, $this->output, $this->resolutions);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.