How to embed YouTube videos on Bubble.io using embed code
In this Bubble.io tutorial video we demonstrate how to embed a YouTube video in your Bubble app without using the built in video element. This tutorial uses the HTML / Custom code visual element.
Unlock YouTube embedding: Learn two powerful methods to seamlessly integrate videos into your Bubble app.
Master video customization: Discover how to fine-tune YouTube embeds with HTML elements for perfect sizing and positioning.
From basic drag-and-drop to advanced embed codes: Elevate your Bubble app with pro-level YouTube integration techniques.
Embedding YouTube Videos in Bubble.io
There are several ways to embed a YouTube video into your Bubble app. The simplest way is to use the built-in video element from visual elements on the sidebar. You can drag that in. You'll notice that the video element supports either YouTube or Vimeo. So it's a little bit restrictive. We'll do more videos in the future of how to embed, say, like a TikTok video. But for YouTube, it asks for the video ID. Now, the video ID is not the whole URL. It is just the bit at the end. After V equals, V standing for video, this is the video ID. And this is just a perfectly random YouTube video for this demonstration.
Using the Video Element
So we copy that into here. I think that's a little... Oh, there we go. It's loaded in. And you'll notice that the YouTube video I picked is showing up in my Bubble app. And it fills up the container that I dragged this video element. This being just a place over. And it provides you with some customization, such as being able to play the video automatically when the page loads, and also being able to loop the video. But you might find you require a little bit more finer tuning.
Using HTML Element for More Control
So a different way to approach it would be to use an HTML element. And this time, when I go onto YouTube, I need to get the embed code. And the embed code allows me, for example, if your video that you're embedding is two hours long, but when you have your user and they click play, you want to play from the hour mark, you can do that by shifting the start time. So for this Rick Ashley video, I'm going to say start it at one minute. And then I copy all of that code and I paste it into here. And then I click preview.
Adjusting Video Size and Positioning
So it's fairly similar, but you'll notice that it's shrunk down. And that's because the code that YouTube provided me has got these parameters in here. For example, the width is set to 560, and that's a pixel value. And so that's why it doesn't reach all the way across this whole rectangle, because the whole width of that is 758, which is a larger value. Now you can just, if you know what size you want your video to end up in your app, you can play around with the numbers here. You're not going to break it. Feel free to change some of the data in the YouTube embed code and see if you get the desired effect.
Removing Default Padding
Something to point out is for some reason, when you use an HTML element, the default styling Bubble provides has got padding on the vertical and on the horizontal axis. So let's say I want my video to be really snug in the corner. No border on the left or on the top. And if I hit preview, you'll see I don't get that. I get a small white bar going around it. So to get rid of that, I have to toggle off from the default style, and then select zero here. And you'll notice in the preview that it adjusts in the editor, rather. And then in the preview, you can see I now have my video sat snugly in the place where I desire it to be in my app.
Can't find what you're looking for?
Search our 300+ Bubble tutorial videos. Start learning no code today!
Flexible Pricing Plans to Fit Your No-Code Journey
Choose the plan that aligns with your goals and start building your startup today.
Have questions?
We have answers!
Find answers to common questions about our membership plans, programs, and more.
Both plans offer full access to our learning resources, community, and support. The Annual plan provides a significant discount (over 15%) compared to paying monthly, and it allows you to lock in your rate for a full year.
Absolutely! You can easily upgrade or downgrade your membership plan at any time by logging into your account and selecting the desired plan. Any unused portion of your current plan will be prorated and applied to your new plan.
As a Planet No Code member, you'll receive a discount on our Bubble coaching sessions. Monthly members receive a 10% discount, while Annual members receive a 17.5% discount. To redeem your discount, simply log into your account and book a coaching session through our platform.
Our 8-week intensive mentorship program is designed to provide personalized guidance and support to help you accelerate your startup journey. You'll be matched with a startup expert who will work with you one-on-one to set goals, overcome challenges, and make rapid progress.
To apply for the Mastery Program, simply click the "Request Invitation" button on our pricing page and fill out the application form. Our team will review your application and schedule a call with you to discuss your goals and determine if the program is a good fit for your needs.
We accept all major credit cards, including Visa, Mastercard, American Express, and Discover.
While we don't offer a free trial, we do provide a 14-day money-back guarantee. If you're not completely satisfied with your membership within the first 14 days, simply contact our support team, and we'll issue a full refund.
If you decide that Planet No Code isn't the right fit for you, you can cancel your membership at any time by logging into your account and navigating to the subscription management page. Click the "Cancel Membership" button, and your membership will be terminated at the end of your current billing cycle.