Mahmoud Al-HabashOpen to new projects
  • WorkWork
  • ServicesServices
  • LabLab
  • WritingWriting
  • ContactContact
Amman--:--عربي
Writing/Livewire

Building Video Player with Livewire v4

Create a custom video player.

1 February 20261 min readLivewireاقرأ بالعربية

On this page

  1. Component

Build a video player component.

Component

blade
<div x-data="{ playing: false }">
    <video 
        x-ref="video"
        @play="playing = true"
        @pause="playing = false"
        @ended="$wire.markAsWatched()">
        <source src="{{ $videoUrl }}" type="video/mp4">
    </video>
    
    <button @click="playing ? $refs.video.pause() : $refs.video.play()">
        <span x-text="playing ? 'Pause' : 'Play'"></span>
    </button>
</div>
All articles

Keep reading

  • Authorization in Livewire v4 Components1 February 20261 min read
  • Blaze Pre-Compiler: Massive Performance Gains in Livewire v41 February 20261 min read
  • Building a Bookmark Feature with Livewire v41 February 20261 min read