That's the best way right now. YouTube doesn't offer anything else than that.
You also might want to look at oEmbed. It supports more video services at once. You can find some packages for it as well ;)
oEmbed: http://oembed.com/
Summer Sale! All accounts are 50% off this week.
Is anyone using a Youtube video on websites?
I am currently letting users post a url of videos, and then I paste it with iframe tags.
Let me know if there is other way or better way to do it.
That's the best way right now. YouTube doesn't offer anything else than that.
You also might want to look at oEmbed. It supports more video services at once. You can find some packages for it as well ;)
oEmbed: http://oembed.com/
I use Plyr for my website Grime Archive. I just store the Video ID, for example dQw4w9WgXcQ in my database and use Plyr like this.
<div data-type="youtube" data-video-id="dQw4w9WgXcQ"></div>
The player is pretty customisable too. I actually implemented an autoplay next video like YouTube does into Grime Archive recently. Here's what the autoplay looks like - https://twitter.com/joedawsonnn/status/773637940648050689
Personally i do not see benefit of just storing vide code id. Yes maybe in 10 000 years YouTube will change name and links won`t work but embed with full link is the simplest way to go.
Thanks to all.I did some research and ended up with using this plugin
@Kemito You don’t see the benefit of storing the video ID, and instead store the full link? Does that “full link” not also include the same video ID?
The advantage of storing just the video ID is that you can then display it however you want on the front end. You’re not tied to displaying it in whatever format the embed code you’ve copied is.
For Laracasts, do you think Jeffrey’s storing a Vimeo embed tag in the database? Or just the Vimeo ID after which he’s free to display the video however he wants in a view?
@martinbean I dont always think what Jeffrey would think. What i think is that its too much effort put in for such feature to worry about. As i would take full link and embed the video and move on.
@Kemito That approach is fine. Until you need to add attributes to all the embed codes on your site, or add a class name, or use a different player…
Absolutely! Using YouTube videos on websites is a common practice. However, instead of directly using iframe tags, consider using the YouTube API. It provides more control, better performance, and additional features like autoplay, custom player controls, and event tracking. This can enhance user experience and offer a more seamless integration.
Please or to participate in this conversation.