Jump to content

YouTube compatibility


L.Adlon

Recommended Posts

Hi. I'm wondering... Since YouTube seems to be using Flash to do their videos, does that mean I'll have compatibility issues with things like some mobile devices (or anything without Flash support) if I try and embed a YouTube video on my website (via the usual <embed> method)? Or, does it switch over to some other (compatible) format if viewed on a non-Flash supported platform? Otherwise, mobile devices wouldn't be able to watch YouTube vids, right?

 

I use embedded YouTube videos, because I pretty much gave up trying to figure out how to embed locally stored videos myself years ago (with all the redundant code for compatibility, and the multiple formats, etc)... figuring I'd let the techs at YouTube keep up with the latest methods/formats, and I just embed the video, hosted on their site. But, now I am wondering if their Flash method is going to give me compatibility problems.

 

If there will be problems with just embedding a YouTube vid, can someone point me to the current/best method to embed a video on a regular HTML page?

Link to comment
Share on other sites

I don't have a mobile device to test on, but youtube's usual embed code might actually be a problem for mobile devices since it uses Flash. There's documentation on youtube APIs for embedding videos: https://developers.google.com/youtube/getting_started#embedded_player

It seems that the <iframe> API is the only one that will allow youtube to choose between Flash or HTML 5 based on the user's device: https://developers.google.com/youtube/iframe_api_reference

Link to comment
Share on other sites

Ya, I noticed the (alternative?) iFrame embed method (as opposed to the <embed> method)... but, I was looking into iFrame (for my scrolling gallery image strip thing I mentioned in another post) a few years back when I first did my site, and seem to remember something about iFrame not being compatible with some platform or browsers or something. Is iFrame fully supported on all things these days? Safe to use?

 

I'll check out those links you posted, Ingolme. The read may make my brain wobble, though.

 

 

(Complete side note: Wow, this forum is glitching out on me. As I type, the text is randomly switching from black to white, even on other people's posts. Something seriously funky with my machine, I think...)

Link to comment
Share on other sites

<iframe> has been supported by browsers forever. Anything in the HTML 4.01 specification is fully supported.

http://www.w3schools.com/tags/default.asp

Things that don't have a "5" next to them on this page are from HTML 4.01. Don't use elements that say "Deprecated".

 

If there is a "5" next to the element, click on it to see how well it is supported.

Edited by Ingolme
Link to comment
Share on other sites

I've been trying to shed away all the depreciated tags (as well as some of the traditional hacks and non-standard methods). Almost there...

 

Still using tables for the main page layout (just the literal framework of the site.... graphic elements for the header bar, the side bar, and the footer. Just never seemed to get CSS-based positioning to fully work for me. I may play around with that now, and see how well it works for me this time.

 

 

Weird... I could have sworn there was some issue with iFrame at the time I was tinkering with it (years ago). Maye I'll find the mention of that in one of my books.

 

Well, if it's fully supported now, that's what really counts.

Link to comment
Share on other sites

I think using Youtube is a good idea. Most videos I see on Youtube have a variety of formats.

 

Hello davej, since you know most videos on YouTube have a variety of formats, could you please tell us where to choose the format when we want to embed a video, I cannot find where to choose the video format.

Link to comment
Share on other sites

  • 2 weeks later...

Hello again, guys.

 

Well, I don't seem to have much luck... I just did a test of a simple YouTube video embed, and it's not working, regardless of what I do... which is even weirder, in that I've got it to work before, years ago.

 

All I did in this attempt, is go to one of my existing YouTube videos, clicked the Embed tab in the Share section, set the options, copied the resulting code, and pasted it in a blank HTML page (...by that, I mean with just the bare essentials of the DOC TYPE, <HTML>, <head> and <body> tags).

 

I first tried the 'new embed' method (iframe), and just got a blank element (....I set a border style, so I could at least see if the element itself was there, which it was).

 

I then tried the 'old embed' method (object), and got a blank element again.

 

Any ideas what might be happening here?

 

(BTW, I'm testing it in Firefox on a PC)

 

 

(BTW II) I checked out the YouTube embedding reference on this site ( http://www.w3schools.com/html/html_youtube.asp ), and both sample DO work for me... Weird.

 

 

(BTW III) Why is it that your site suggests using the <embed> method (as an alternative to the <iframe> one), yet YouTube suggests the <object> method instead?[Late addition] I just tried the w3schools suggested <iframe> embed method on my test page, putting in the same URL as that from the YouTube suggested code... and it works. I really wonder why the suggested YouTube codes (both) don't work, yet the w3schools one does... even though the URL is the same. I'll have to compare the attributes and stuff, and see what the difference is.

Edited by L.Adlon
Link to comment
Share on other sites

I figured out what was the issue. Even though both codes (YouTube vs w3schools) were almost identical, the key thing seemed to be that the YouTube video lacked the http in front of the url. Putting that in made the video appear.

 

Very odd that they left that out in their suggested code. But, there it is, I think.

 

 

[Late addition] I just tested it in Internet Explorer, and the w3schools method worked fine, and the YouTube <iframe> method showed the embedded video thumbnail frame, but 'an error occurred' when I tried to actually play it. Very, very weird.... Looks like the w3schools method wins.

Edited by L.Adlon
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...