0

I try to read multiple videos, but I encountered a problem when loading them, the problem is that the browser crash and the loading time of all videos is very long, I dont know if it is possible to display only the title and an image of every video,,, After that when the user wants to watch a specific video, in this case he load this video and watch it in streaming mode, but not loading them all at the same time (is there any soft/smart solution for that)

this is the Controller methode :

public function videos()
{
$videos = Video::all();
return view("videos", compact('videos'));
}

this is the view blade :

<div class="row">
@foreach ($videos as $v)
    <div class="col-lg-4">
        <div class="card">
            <video class="video" controls>
                <source src="{{URL::asset("/videos/upload/$v->file_name")}}" type="video/mp4">
            </video>
         </div>
        <div class="card-title">
             {{ $v->title }}
        </div>
    </div>
@endforeach

PRANK HB
  • 1
  • 2
  • set `autostart="false"` to `source` – PHP Ninja Sep 18 '19 at 10:26
  • I tried this, Bur even with autostart = false Or autopaly = false the browser does not support the size of the videos to display and it crashes – PRANK HB Sep 18 '19 at 10:40
  • here is solution https://stackoverflow.com/questions/20075875/how-to-set-the-thumbnail-image-on-html5-video – PHP Ninja Sep 18 '19 at 10:43
  • how many videos are you loading? what do you mean by the browser crashes? have you optimized the videos for streaming (MOOV atom at the start)? You could write code that displays the title and maybe a poster image, and only loads the source of the video after an onclick – Offbeatmammal Sep 18 '19 at 10:43
  • thanks mr Gulshan i tried poster and it works now better than before, But i think i still need a faster solution because it still take some seconds to load the videos, and when i will deploy the app to production i think that there would be some problems... we can say that it is a Lite version hhh,,THANKS – PRANK HB Sep 20 '19 at 09:33
  • Offbeatmammal , i actualy upload multiple videos by theme ( by event // by topic ), and I propose to users to watch them in frontend...............thanks !! – PRANK HB Sep 20 '19 at 10:01

0 Answers0