PDA

View Full Version : Validation errors on YOUTUBE embedded videos



utnalove
Jul 13th, 2009, 11:59 PM
Hello,
I think it is a common issue. Youtube embedded videos make the page to be validated with many errors.

The site is www.przepiekna.pl

The youtube video I need to embed (already embedded, but with errors) is:


<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/ijtOCbKbiG0&color1=0xb1b1b1&color2=0xcfcfcf&hl=it&feature=player_embedded&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.youtube.com/v/ijtOCbKbiG0&color1=0xb1b1b1&color2=0xcfcfcf&hl=it&feature=player_embedded&fs=1" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="425" height="344"></embed></object>


I edited the html or order to have the video on the second level... so I added some parameters and the code to embed the video is:


<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="373" height="280" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="wmode" value="opaque" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/ijtOCbKbiG0&hl=it&fs=1&" /><param name="allowfullscreen" value="true" /><embed embed wmode="opaque" type="application/x-shockwave-flash" width="373" height="280" src="http://www.youtube.com/v/ijtOCbKbiG0&hl=it&fs=1&" allowscriptaccess="always" allowfullscreen="true"></embed></object>

But the parameters that I have added do not create more validation errors. It is the youtube embedded code itself that generates those errors.

How can I edit the youtube codes in order to have a well validated site?

VIPStephan
Jul 14th, 2009, 12:45 AM
The video is a regular flash object so you can just embed it in an accessible manner with SWFobject (http://code.google.com/p/swfobject/).

utnalove
Jul 14th, 2009, 10:44 PM
that's great!!

it works, thanks!

utnalove
Jul 14th, 2009, 11:10 PM
well... anyway it's strange...
the videos work even without this code on the header:


<script type="text/javascript" src="swfobject/swfobject.js"></script>
<script type="text/javascript">
swfobject.registerObject("myFlashContent", "9.0.0");
</script>

If I remove this code, youtube works, and no problem...
and the validation error do not disappear :(

VIPStephan
Jul 15th, 2009, 12:02 AM
well... anyway it's strange...
the videos work even without this code on the header:


<script type="text/javascript" src="swfobject/swfobject.js"></script>
<script type="text/javascript">
swfobject.registerObject("myFlashContent", "9.0.0");
</script>

If I remove this code, youtube works, and no problem...
and the validation error do not disappear :(

SWFobject isn’t done with adding some javascript to the head, you have to have an element to apply it to, and that would usually not be an object element (since that is created by SWFobject – that’s why we’re using it) but typically it would be a division. So you would remove your Flash object from the HTML and replace it with a plain div:


<head>

<script type="text/javascript" src="swfobject/swfobject.js"></script>
<script type="text/javascript">
swfobject.registerObject("myFlashContent", "9.0.0");
</script>
</head>
<body>

<div id="myFlashContent>
here goes some alternative content that is shown if Flash or JS aren’t supported or otherwise available
</div>


You’d have regular HTML content in the div that you can style at free will and this content will be replaced with a Flash object by SWFobject.

And seeing that you are using jQuery there is also an SWFobject jQuery plugin (http://jquery.thewikies.com/swfobject/).

utnalove
Jul 15th, 2009, 11:09 AM
mmm, I got confused...

I was following those instructions: http://blog.case.edu/webdev/2008/04/20/youtube.html

And I have generated the code using this script: http://www.bobbyvandersluis.com/swfobject/generator/index.html

Using the method you described, what code should I use, for example for this youtube video? (knowing that I have the swfobject on the /sfwobject/.swfobject.js folder


<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/ijtOCbKbiG0&hl=en&fs=1&"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/ijtOCbKbiG0&hl=en&fs=1&" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>