Insert youtube for mobile page

Is there a way to insert a link to a video from YouTube so that the video plays in full screen on a mobile phone when a user clicks on the link?

By default, the iframe embed code will play the video on Android phones - (

If I go to m.youtube.com, they do what I need, but they do it in a strange way, because they generate different html and different links and protocols for watching videos, depending on which mobile phone I have.

This makes sense because the way the video is served depends on the user's phone, but is there a way to get javascript / html from youtube so that I can do the same on my own page?

+8
youtube video mobile-website
source share
5 answers

YouTube has an option for the embed button called โ€œuse old embed linkโ€ that gives you embed code.

If you want it to show the video according to the device, you're out of luck.

+1
source share

The correct way to do this is as follows:

<iframe class="youtube-player" type="text/html" width="640" height="385" src="http://www.youtube.com/embed/VIDEO_ID" frameborder="0"> </iframe> 

Check out the Youtube blog or whatever .

Now you just need to find a way to figure out what width and height to use for each device.

+11
source share

I am using the link from m.youtube.

You need to initiate it on the mobile phone, as it will not work on the website.

It looks like this:

RTSP: //v6.cache3.c.youtube.com/CjYLENy73wIaLQkhS9rfloZnFRMYJCAkFEIJbXYtZ29vZ2xlSARSBXdhdGNoYOTe4KOh-4e3TQw=/0/0/0/video.3gp

Quentin

0
source share

You can dynamically scale the video according to the device screen: I used a web application that creates the correct script for the embed code. http://embedresponsively.com

This is a service that sets up the embed code so that YouTube videos can scale.

I canโ€™t believe that Google is not running.

0
source share

Try this inline code

<iframe width = "611" height = "450" โ€‹โ€‹src = "https://www.youtube.com/embed/EzKX4LqCgCc" allowfullscreen = "allowfullscreen" mozallowfullscreen = "mozallowfullscreen" msallowfullscreen = "msallowfullscreen" oallowfullscreen = "oallowfullscreen "webkitallowfullscreen =" webkitallowfullscreen ">

0
source share

All Articles