how to embed video in laravel code how to embed video in laravel code laravel laravel

how to embed video in laravel code


Fortunately , I did manage to find a solution to my problem. Hopefully it should help you as well . Use the url that is present in the embed statement. so for example if you goto youtube and click on the embed link of this video you would get this

<iframe width="420" height="315" src="//www.youtube.com/embed/BstTBw6BLrE" frameborder="0" allowfullscreen></iframe>

now use the url that is present in the src tag. This works with other video hosting services, like VEVO as well.

Hope it helps..


For anyone else looking to Embed Videos in Laravel, have a look at KaneCohen/embed. It's works great with Youtube or Vimeo (haven't tried other sources), and you don't have to mess with any logic. Simply install (installation guide in documentation) and:

@foreach ($videos as $video)    <h4>{{ $video->title }}</h4>    <div class="media">        <div class="media-body">            {!! Embed::make($video->link)->parseUrl()->getIframe() !!}        </div>    </div>@endforeach

Don't forget to set up the alias in you config/app.php


I have the same issue, but the console catch this error:

Refused to display 'URL' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.

I look for it here and i found this post

Refused to display in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'

and that work for me.

You should try this

@layout('layouts.master')@section('content')@foreach ($videos as $video)    <h4>{{ $video->title }}</h4>    <br>    <div class="media">        <div class="media-body">            <iframe width="560" height="315" src={{ $video->link + "&output=embed" }} frameborder="0" allowfullscreen>            </iframe>        </div>    </div>    <br>@endforeach@endsection