Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to embed a YouTube video for mobile devices in a page, rather than linking to YouTube?

I have an page with a YouTube video embedded (using jQuery + swfobject). Currently, iOS users need to be taken to YouTube to view the video rather than viewing it within the page. Android browsers will spawn the YouTube Player without redirecting to YT, so that works fine.

Is it possible to embed YT videos so that they can play within the page for iOS?

like image 374
Jeff Avatar asked Mar 13 '11 20:03

Jeff


People also ask

How do you embed a YouTube video on mobile?

Open a YouTube video, select the 'Share' Option. Click on the 'Embed' option. Enable the start at option, enter your chosen time, and copy the code. Paste the code in your website page.

Is it better to embed or link?

In most cases, you'll want to embed videos. Embedding videos help improve video SEO and the searchability of your video content. But there's no harm in occasionally linking videos, especially for external content.

Why do some YouTube videos not embed?

If you receive the error message, "Embedding disabled on request” ,you have probably accidentally disabled embedding via YouTube. To grant permission again, follow these steps: Go to “Video Manager.” Select the appropriate video and click “Edit”.


1 Answers

Use the iframe-embedded version of the player instead of the Flash one. The embedded version is smart enough to render the appropriate player based on the device (ie, it may render the Flash version for phones like the Android that support it, or the HTML5 version for iPhone).

If you load the video on Youtube.com, there's a "Share" button that gives you the code, so you basically just need to copy-paste. It should look something like this:

<iframe 
    width="240" height="135" 
    src="http://www.youtube.com/embed/videoid" 
    frameborder="0" allowfullscreen>
</iframe>

On the developers' site there's a more advanced version of the same thing, with various parameters and a demo of the Javascript API.

Update: As of January 2015, youtube's javascript api is officially deprecated. It has been replaced with the new and improved Iframe API.

like image 107
McGarnagle Avatar answered Oct 03 '22 00:10

McGarnagle