Karthiga
Karthiga

Reputation: 897

How to display video in laravel view

I am using laravel 5.4 i need to show one video in my product detail page but the video not displayed properly..

This is my view

@foreach($detail_videos as $video)
               <video width="100" height="100" controls class="thumb" data-full="{{ asset($video) }}">
                 <source src="{{ asset($video) }}">
               </video>
               @endforeach

In my controller i give like this

  $detail_dir_videos = 'uploads/products/videos/'.$getProduct->id;
      $detail_dir_videos_files = array_slice(scandir($detail_dir_videos), 2);
      $detail_videos = [];
      foreach($detail_dir_videos_files as $detail_dir_videos_file){
        $detail_videos[] = $detail_dir_videos.'/'.$detail_dir_videos_file;
      }
 return view('pages.product_detail', ['videos'=>$videos,'detail_videos'=>$detail_videos ])

Now the video is not displaying in my view can any please help me out to resolve this..

Upvotes: 1

Views: 2284

Answers (1)

Exprator
Exprator

Reputation: 27513

edit this code and check

$detail_videos = [];
      foreach($detail_dir_videos_files as $detail_dir_videos_file){
        $detail_videos= $detail_dir_videos.'/'.$detail_dir_videos_file;
      }

Upvotes: 1

Related Questions