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?
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.
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.
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”.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With