I'm building a social network site with Laravel
I have a section of my site where a user can submit a URL to a video with a form ex. https://www.youtube.com/watch?v=xxxxxxxxxx
The URL gets saved in the database.
I want to embed the youtube/vimeo player on the page using an iframe.
I can grab the url using $video->url
In order to display the iframe I use
<iframe width="306" height="200" src={{ $video->url }} frameborder="0" allowfullscreen></iframe>
The space is there but no video. Just blank space. I figure this is because the link is not the embed link youtube provides which should be //www.youtube.com/embed/xxxxxxxxxx
Is there a Laravel way to convert site URLs to embed URLs? I don't want to make my users submit the embed URL since most people don't know about it and it's easier for them to just submit the URL in their browser