Skip to main content
Please wait...
Image

Streaming like in a blockbuster: Laravel-HLS takes the stage

At OBI Partner, we are used to saving projects like Tom Cruise saves the world in Mission Impossible. But this time, the mission is different: streaming videos without everything going up in smoke.

Because let's be clear:

  • Videos that load in a loop are like a credit roll that never ends.

  • Crying databases are worthy of an episode of Dark.

  • And developers who swear “¡pero en mi máquina sí funciona!”, resemble a badly dubbed parody on Netflix.

That's where our hero appears: laravel-hls.

🎥 The pitch

Laravel-HLS is an open-source package that does the job of video producer in your Laravel app:

  • It converts your files into adaptive HLS streams using ffmpeg.

  • It adds AES-128 encryption, so your videos don't wander naked on the Internet.

  • It works in Laravel queues, like an editing team that doesn't block the main shoot.

  • And it provides you directly the playlist .m3u8 to stream your movie.

In short: you upload a video, and it comes out ready for Netflix (well… in a handmade version 😅).

🎬 Act I: Installation

  1. You call in reinforcements via Composer:

    composer require achyutn/laravel-hls
  2. You dump the config into your project:

    php artisan vendor:publish --provider="AchyutN\LaravelHLS\HLSProvider" --tag="hls-config" 
  3. In config/hls.php, you set the scenario: resolutions, bitrates, encryption, queue, storage…

  4. You add the trait to your video model:

    use AchyutN\LaravelHLS\Traits\ConvertsToHls; class Video extends Model { use ConvertsToHls; }
  5. And BOOM: you get your playlist with a simple route /hls/{id}/playlist.

🎬 Act II: Behind the scenes

💣 Encryption: like in any good thriller, there's a secret key. Here, AES-128 protects your video segments. Without the key → no playback → no spoilers.

Parallel processing: conversion happens in the background with Laravel jobs. Your web server doesn't need to be Rambo to handle video rendering.

🚀 Deployment: you can integrate this into your CI/CD pipeline, to automatically start conversions as soon as a file lands in your project.

🎬 Act III: CI/CD action plan

Example with GitLab CI:

Here, it's like a commando mission:

  • test checks that the team is ready,

  • convert takes care of the editing,

  • deploy streams the movie to the marquee 🎞️.

🎬 Bonus: Possible spin-offs

  • E-learning: your courses stream securely, no content leaks.

  • Internal VOD: you become the company's Netflix.

  • Live events: conferences, concerts or online lotteries (yes yes 👀).

🎬 The sequel

Laravel-HLS already works very well, but the sequel could include:

  • CMAF for more compatibility,

  • Hollywood-level DRM,

  • Scalability with distributed workers,

  • IMDB-style dashboard to track conversions.

🎬 Conclusion

➡️ If you want a CI/CD forge that deploys your apps like a buffet, we have GitLab.
➡️ If you want modular, food‑truck style, go with Gitea + Woodpecker.
➡️ And if you want to stream videos like Netflix, laravel-hls is your leading actor.

At OBI Partner, we like to say:
“No need for Hollywood, as long as your video streams, without spoilers and without black screens.” 🍿

👉 So, ready to shoot your first blockbuster in Laravel?

Add new comment

Restricted HTML

  • You can align images (data-align="center"), but also videos, blockquotes, and so on.
  • You can caption images (data-caption="Text"), but also videos, blockquotes, and so on.