Skip to content

Instantly share code, notes, and snippets.

@NandoKstroNet
Created June 3, 2022 01:21
Show Gist options
  • Save NandoKstroNet/9451d414197595258f6e34b76d4ea2cd to your computer and use it in GitHub Desktop.
Save NandoKstroNet/9451d414197595258f6e34b76d4ea2cd to your computer and use it in GitHub Desktop.
Componente para trackear o processamento do video no projeto VideoFlix em https://laravelmastery.com.br
<div class="flex justify-around items-center my-10" wire:poll.5000ms="reloadProgress">
<small class="mr-5">Progresso processamento:</small>
<div class="w-96 rounded-full h-4 border border-green-900 p-0">
<div class="rounded-full h-4 bg-green-700" style="width: {{$progress?: 0}}%"></div>
</div>
<span class="ml-2">{{$progress?: 0}} %</span>
</div>
<?php
namespace App\Http\Livewire\Content\Video;
use App\Models\Video;
use Livewire\Component;
class SingleVideoProcessedProgress extends Component
{
public $video;
public $progress;
public function mount($video)
{
$this->video = $video;
$this->progress = Video::find($video)->progress;
}
public function reloadProgress()
{
if($this->progress >= 100) $this->emit('refreshContentListOfVideos');
$this->progress = Video::find($this->video)->progress;
}
public function render()
{
return view('livewire.content.video.single-video-processed-progress');
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment