Friday, October 01, 2010

Embedding A Video In Your Post

One fun and sometimes practical accessory to add to your blog is a video. When added properly, you get a picture, that your readers can click on, and watch a movie, right in front of their eyes. This is called "streaming video", where the video content is downloaded from the distant server while you watch.

Here's a demonstration video that I have used in another post.


This is one example of why I prefer to live in California.



»www.youtube.com/watch?v=YCoxOReXlHI


<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/YCoxOReXlHI?fs=1&hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/YCoxOReXlHI?fs=1&hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>
This is one example of why I prefer to live in California.
<br clear=left />
»<a href="http://www.youtube.com/watch?v=YCoxOReXlHI" rel="nofollow" target="_blank">www.youtube.com/watch?v=YCoxOReXlHI
</a></span>

It's not difficult to get the code from YouTube. Just click on the link to YouTube
http://www.youtube.com/watch?v=YCoxOReXlHI
And there's the video. Somewhere nearby, you'll find a button or link - in this example, a button below the video - labeled "Embed". Click there, and you get a window with the code.

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

Just paste the code into the blog post, and there it is. Easy, right?

Not all websites are as thoughtful as YouTube. Some websites may provide the code, but it's not quite as complete.

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

That code is acceptable, in some applications. It won't work for Blogger though - the Blogger Post Editor will give you an HTML error.
Your HTML cannot be accepted: Tag is not closed: EMBED

Here's a critical snippet of code, that you need to include, to use this in a Blogger blog.
</embed>

Giving you the correct code block.
<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/YCoxOReXlHI?fs=1&hl=en_US"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/YCoxOReXlHI?fs=1&hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>

See the omission? Such a snippet - one obscure difference between liberal and strict HTML - and so essential, in Blogger.

>> Top

2 comments:

pcd2k said...

So far I don't seem to have encountered that problem with youtube video's, but it's quite likely why other embed codes I've attempted to embed like DailyMotion have failed ?

One small unrelated comment to this post I've been intending to ask; Is why does your blog behave so slowly in Firefox but not in other browsers ?

Zee Poodle said...

Thanks for this info. I've recently encountered the black screen when trying to play back videos from my blog.

I trawled the Blogger Help forum, but the things suggested there didn't work. That forum led me to you!

I hope you don't mind my asking but are you aware of ongoing probs with videos not playing?

All of my vids are less than 1minute, 30secs. Some were made by me into little animated cartoons.

All vids are WMV. Some were d/loaded from youtube, shortened by me, then uploaded to my blog (with accreditation).

But in the last fwe days, on clicking any vid, it says, "Video won't play, come back later" - PLUS a window sometimes pops up which says "play on youtube" - even for my own home made animations that are not on youtube.

I'm sorry to be a pain in the arts, but I'm trying everything to fix this.

I would be so grateful if you were aware of a fix or a link I oculd follow to correct this error??? Thank you so so so very much. Sorry this post is so long. Ungh.

Oh. My blog is:
poodlesonthemerrygoround.blogspot.com

Thank you again :)
Ms Charley
Australia