This guide is intended for administrators who need to install, configure, and maintain the HLS Video Player feature in the Sponzy platform. HLS (HTTP Live Streaming) provides adaptive bitrate streaming, which automatically adjusts video quality based on the viewer's network conditions.
Note: Administrator privileges are required for most operations described in this guide.
Verify FFmpeg Installation
Ensure FFmpeg is installed with HLS support:
ffmpeg -version
ffmpeg -encoders | grep libx264
Create Storage Directory
Create a directory for HLS files:
mkdir -p public/uploads/hls
chmod 775 public/uploads/hls
Update Configuration
Add HLS path to your config/path.php:
'hls' => 'uploads/hls/',
Add Required Libraries
Add the following to your main layout file:
<!-- Video.js CSS -->
<link href="https://vjs.zencdn.net/7.20.3/video-js.css" rel="stylesheet" />
<!-- Video.js -->
<script src="https://vjs.zencdn.net/7.20.3/video.min.js"></script>
<!-- HLS.js -->
<script src="https://cdn.jsdelivr.net/npm/hls.js@latest"></script>
Update Database Schema
Run the migration to add the HLS column:
php artisan migrate
Navigate to Admin Panel → Settings → Video Settings to configure HLS options:
Configure the quality levels based on your audience's needs:
| Quality | Resolution | Bitrate | Recommended For |
|---|---|---|---|
| Low | 480p | 500 Kbps | Mobile data, poor connections |
| Medium | 720p | 1000 Kbps | Average connections |
| High | 1080p | 1500 Kbps | Good connections |
HLS requires more storage than standard MP4 files. Configure your storage settings accordingly:
Warning: HLS generates multiple files for each video. Monitor your storage usage carefully to avoid running out of space.
To convert your existing video library to HLS format:
Track the progress of video conversions:
HLS creates multiple files for each video:
You can manage these files through the file manager:
Monitor the performance of your HLS implementation:
Perform these maintenance tasks regularly:
When backing up your system, consider these HLS-specific points:
Symptoms: Videos fail to convert to HLS format
Possible Causes:
Solutions:
storage/logs/laravel.logSymptoms: Videos don't play or frequently buffer
Possible Causes:
Solutions:
Use these tools to diagnose HLS issues:
ffprobe -v quiet -print_format json -show_format -show_streams video.m3u8You can customize the FFmpeg encoding parameters for better quality or efficiency:
// In EncodeVideo.php
$format->addAdditionalParameter('-preset', 'slow'); // Better quality, slower encoding
$format->addAdditionalParameter('-crf', '23'); // Constant Rate Factor (quality)
For high-traffic sites, configure a CDN for HLS delivery:
To secure your HLS content with encryption:
// In EncodeVideo.php
$hlsExporter->withEncryptionKey(
$encryptionKey, // Your encryption key
$encryptionKeyUrl, // URL where the key can be accessed
$encryptionIV // Initialization vector
);
Note: For additional support or questions about the HLS implementation, please contact our support team at support@example.com.