How To Embed Responsive Videos on Blogs

Videos are used widely along with text content in blog posts and today’s article is all about how to make those embedded videos responsive plus display them inside elegant frames of your choice.

Making videos responsive is the easy task to accomplish but along with that, displaying those videos inside beautiful frames was little tedious for me.
I am going to share two different frames where first one is a image frame of blank MacBook so it appears as if video is playing inside it.
Second frame is what I have designed with pure CSS and added some cool shadows effect in the bottom using pseudo elements. I hope you’ll like it.

So what will you get in this post?

  1. Making Embedded Videos Responsive without adding any frame.
  2. Display Video Inside Responsive Frame Made of Pure CSS.
  3. Display Video Inside Responsive Image Frame of a Blank MacBook.So choice is yours, they all are responsive. 🙂

Note: You don’t have permission to copy and share my code on your blog

Make Embedded YouTube Videos or Vimeo Videos Responsive

When you get the code to Embed your video from YouTube or any other video hosting site, your code will contain a fixed height and width properties. So when someone visits your site from small resolution devices like as mobile or a tablet, then your embedded video will not re-size itself according to the screen size.
It will always contain its height and width to the original values despite the screen size. So it will either make a scrolling bar on small screen sizes or else it will hide the video part which is overflowing (If overflow: hidden; property is used for the content wrapper). You can not make them responsive like the way you can do with images.
If the scrolling bar is appearing then that particular page will also show an error in your webmaster tools account if you will check it for responsive design (Not Good For SEO?).
I wrote that all just because I wanted to to tell you about how important is it to make your embedded videos responsive.

So how to make it?

It is simple enough to do with the help of CSS. So follow the steps given below and be responsive. 😀

CSS Part

HTML Part

How can i use it?

CSS: Copy the above CSS Part first then switch to HTML Mode of your blogger post editor and paste the the whole CSS code as it is  (Will work for WordPress too)

Note: You can also paste the CSS code inside your blogger template skin so that you don’t have to paste the CSS code every time in any of your blogger post. If you want to paste the code inside your template then copy the CSS code without the <style> tag and paste it just before ]]></b:skin> and save your template.
HTML: Copy the HTML code and Paste inside your post editor after switching to HTML mode. You have to paste the HTML where you want your video to be appeared in  your content. Now for adding your video, just replace the code highlighted in yellow color with the embed code you got from your YouTube or Vimeo video.

Note: To get the embed code for your video on YouTube, just right click on the video player and select Get embed code. You will get your code in the middle of your video screen so copy it from there.

If you followed all the steps correctly then you will have your video which is fully responsive. You can check it live by re-sizing your browser window easily.

Now I am going to share those two other ways along with live demo for adding cool frames and the process of using the code will be same as explained above so I am not going to re-write it again (except few changes).

Add A Beautiful Frame to Embedded Videos Using Pure CSS

I love this one because it is made with pure CSS and loads as fast as you know. 🙂 It has got really cool design and shadows effect in the bottom.
I have also disabled the Video title Info which appears on the top of it and the related videos which appear in the end of video.

Watch the live demo below!

CSS Part

HTML Part

Editing Step:- Please take note that this time you need not to paste your embedding code from YouTube as it is so instead just replace the Video id which is highlighted in the yellow color above. You can easily get this id from the address bar of your browser. See the example:
This is the web address of my intro video on YouTube I have uploaded so I have highlighted the unique video id in the yellow color. Copy it in the same way for your video and replace in the above HTML. Ask me in comments if you did not get it.
For Vimeo videos, just replace the whole code starting with   code.
Common Problem – Shadows are not appearing as shown in the live demo? Just add this little CSS code to your template skin or inside your blog post with along with above CSS code given below:
So did it work for you? Let me know if it worked or not. I will definitely help you. So moving on to the image frame.

Displaying Embedded Video Inside a Responsive Image Frame

This is the frame of a blank MacBook. I used the border-image: property to display the image frame instead of adding the image frame with background-image: property.
This is all because I wanted to make it fully responsive. When I used the image with background-image: property then I could not make it fully responsive.
Video appeared to be overlapping the frame between different screen resolutions and I did not like it at all. So I decided to go with border-image: property instead which makes it neat and clean. You can use your any other image but you need to adjust the border width and border image values accordingly.
Note: No Browser support for IE10 and below, works well with others browsers, even with old versions with browser specific prefix. I just hate Internet Explorer.

See the live demo below:

CSS Part

HTML Part for it

Editing Step:- Please take note that this time you need not to paste your embedding code from YouTube as it is so instead just replace the Video id which is highlighted in the yellow color above. You can easily get this id from the address bar of your browser. See the example:
This is the web address of my intro video on YouTube I have uploaded so I have highlighted the unique video id in the yellow color. Copy it in the same way for your video and replace in the above HTML. Ask me in comments if you did not get it.
For Vimeo videos, just replace the whole code starting with  <iframe> code.
Common Problem – Shadows are not appearing as shown in the live demo? Just add this little CSS code to your template skin or inside your blog post with along with above CSS code given below:
So did it work for you? Let me know if it worked or not. I will definitely help you. So moving on to the image frame.

Displaying Embedded Video Inside a Responsive Image Frame

This is the frame of a blank MacBook. I used the border-image: property to display the image frame instead of adding the image frame with background-image: property.
This is all because I wanted to make it fully responsive. When I used the image with background-image: property then I could not make it fully responsive.
Video appeared to be overlapping the frame between different screen resolutions and I did not like it at all.
So I decided to go with border-image: property instead which makes it neat and clean. You can use your any other image but you need to adjust the border width and border image values accordingly.
Note:-  No Browser support for IE10 and below, works well with others browsers, even with old versions with browser specific prefix. I just hate IE

See the live demo given below.

CSS Part

HTML Part

Editing Step:

Replace the highlighted part with your video ID for YouTube and for Vimeo videos, just replace the full code.
So this is it for now and I hope you guys like it. Please let me know your feedback via comments whether your liked it or not.
If you’re facing any kind of problem or I could not make things clear then please let me know. I will try my best to help you out.
You can help me too by sharing this post or connecting with me on social networks. Thanks and stay blessed!

via Blogger http://www.droidadda.org/2017/04/embed-responsive-videos-on-blogs.html https://mtkdr0id.files.wordpress.com/2017/04/d1c9e-responsive-video-blogger.jpg?w=300

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s