Critical Section

Archive: January 25, 2009

<<< January 24, 2009

Home

January 26, 2009 >>>


embedding YouTubes

Sunday,  01/25/09  11:32 AM

<nerdy optional=completely>

In the public interest (and so I can find it later), I thought I'd reveal how I embed YouTube videos.  YouTube makes this really easy, and they take you almost all the way there, but not quite quite.

If you view a video on the YouTube site, you'll notice at the upper right they have an Embed text box with the HTML you have to insert in a page to play that video.  You can configure the size, whether to include a border, the color, and so on...  really nice.  But just sticking this HTML into your page this isn't exactly what you want, because what you really want is to display an image first which, when clicked, causes the YouTube video to play.  This is prettier for people who visit the page itself, and much prettier for people who read the page via RSS readers and so on which may not know what to do with embedded videos.

Okay, so how is this done?  Well first make the image; generally edited from a screenshot of the YouTube video, but it can be any image at all.  And then insert the following HTML into the page:

  1. <center>
  2. <img id="ytimg"  src="img_url.jpg" style="cursor: pointer"
  3.     onclick='ytimg.style.display="none"; ytvid.style.display="inline"'>
  4. <div id="ytvid" style="display: none">
  5. <object width="640" height="505">
  6. <param name="movie"
  7.     value="http://www.youtube.com/v/G0FtgZNOD44&hl=en&fs =1&autoplay=1" />
  8. <param name="allowFullScreen" value="true" />
  9. <param name="allowscriptaccess" value="always" />
  10. <embed src="http://www.youtube.com/v/G0FtgZNOD44&hl=en&fs=1&autoplay=1"
  11.     type="app lication/x-shockwave-flash"
  12.     allowscriptaccess="always" allowfullscreen="true"
  13.     width="640" height="505" />
  14. </object>
  15. </div>
  16. </center>

The numbers are so I can refer to the lines.  The brown text is what you get from YouTube's Embed text string.  You start by copying that in, and then add the rest.  Some notes:

Line 1/16 are optional if you want to center the whole thing.
Line 2 includes the image; the src= parameter gives the image URL.  Note pointing hand cursor.
Line 3 is what happens when you click; the image is hidden and the video is displayed.
Line 4/15 are a <div> surrounding the video; this is what you enable.
Line 7 and 10 add &autoplay=1 to the video URLs so the video plays immediately.

One more note: for more than one of these on a page, use unique id= values for the <img> and <div> tags, and modify the onlick= JavaScript accordingly...

</nerdy>

 

Sunday,  01/25/09  01:05 PM

A mid-day Sunday post... why not?  Last night I took a long hard ride in the rain and fog and cold on my mountain bike, and it was great.  I really need cycling right now, it is so simple: you get on your bike, you ride, you have fun, you feel good afterward, and it keeps you fit.  What could be better?  Otherwise a pretty quiet day, cold and rainy, spent some time coding, trying to programmatically clean up and analyze some study data...

ChumbyI have a friend with a Chumby; he really like it, and apparently has it set to display RSS feeds when he wakes up.  Sometimes the first thing he sees in the morning is the last thing I posted the night before.  Wow, now there's some pressure; post something interesting for people to read when they wake up.  Perhaps they'll read this...

Kay YowDon't know why but this really hit me: Kay Yow loses battle with cancer.  One of the most successful college basketball coaches ever, she battled breast cancer for 22 years, and finally lost.  So inspiring!  Makes me want to do whatever I can to help others like Kay Yow win.

ESPN counts down college football's most prestigious programs (since 1936, when the AP poll was started).  #1 is Oklahoma, #2 USC, #3 Ohio State, #4 Notre Dame, #5 Nebraska.  That seems pretty right to me.  Obviously in the last decade USC is #1 and Notre Dame has been shot out the back, but it was not always so.  Certainly a good subject for a bar debate :)

bank market capsMore bank news; the infographic at left compares the market caps of various banks between Q2 2007 (blue) and Q1 2009 (yellow).  Wow.  The second big circle in the top row is Royal Bank of Scotland; the biggest circle on the bottom is Citibank.  The bank that's shrunk the least is Spain's Santander.  And this of course only includes banks which still exist. [ via Gary on Facebook ]

Still noodling over Scott Adam's Define Friend.  I've decided it really comes down to trust, someone who will share your interests in the future.

Lexus LS600hLTTAC reviews the Lexus LS600hL.  "To reality check my impressions, I floored it.  And backed off.  And pressed a couple of buttons.  And floored it.  And backed off.  And then it hit me: the LS600h L has the world’s finest automobile engine."  The interior is spectacular, too, and the electronic toys like the GPS are top-of-the-line.  I'm not in the market for a new car (who is?) but if I were, I'd definitely consider this one.

Carizzo Plain - San Andreas faultRandall Parker says SoCal overdue for Carrizo Plain earthquake.  Great, that's just what we need right now, a disastrous earthquake.  I've actually visited the Carrizo Plain, it's beautiful, although I must tell you it is a bad place to have a flat tire :)  You can see the San Andreas fault quite plainly, it runs right down the middle...

Allan Davis wins in Tour Down UnderCongratulations to Allan Davis, winner of the Tour Down Under.  Yesterday he won his third stage of the eight-day tour, pretty much wrapping things up.  Of course the big news in this tour has been Lance Armstrong's return to competitive stage racing.  What I found interesting is that while Lance was right in there - competitive as always - you realize that he doesn't win everything each time he gets on the bike, and he has bad days just like everybody else.  I must tell you I can't wait for the Tour of California!

From PCWorld: The Seven Worst tech Predictions of All Time.  They are pretty bad, including "I think there is a world market for maybe five computers", and "there is no reason anyone would want a computer in their home".

Robert Scoble reports FriendFeed hits one million users.  Huh, FriendFeed?  I have a FriendFeed account, but I don't get it.  Yet another Web 2.0 social network thing that I don't get - once again it seems there's no there there.  Really the only one of these sites I get is Facebook.  It might be hopeless for me, but I keep trying...  old dog, new trick, etc.

 

stay hungry, stay foolish

Sunday,  01/25/09  08:09 PM

I shared Steve Jobs' classic introduction of the Macintosh from 1984 with my colleagues at Aperio, and one of them pointed me to this YouTube video, Steve Jobs’ Stanford Commencement Speech in 2005.  I had read excerpts from this speech but never seen it.  Some great wisdom and emotion packed into just 15 minutes.  I found it inspiring, and I hope you do too.

PS it is especially poignant given his current medical issues...

 
 

Return to the archive.

Home
Archive
'14   '13   '12
'11   '10   '09
'08   '07   '06
'05   '04   '03
flight
About Me
W=UH
Email
RSS   OPML

Greatest Hits
Correlation vs. Causality
The Tyranny of Email
Unnatural Selection
Lying
Aperio's Mission = Automating Pathology
On Blame
Try, or Try Not
Books and Wine
Emergent Properties
God and Beauty
Moving Mount Fuji The Nest Rock 'n Roll
IQ and Populations
Are You a Bright?
Adding Value
Confidence
The Joy of Craftsmanship
The Emperor's New Code
Toy Story
The Return of the King
Religion vs IQ
In the Wet
the big day
solving bongard problems
visiting Titan
unintelligent design
the nuclear option
estimating in meatspace
second gear
On the Persistence of Bad Design...
Texas chili cookoff
almost famous design and stochastic debugging
may I take your order?
universal healthcare
entertainment
triple double
New Yorker covers
Death Rider! (da da dum)
how did I get here (Mt.Whitney)?
the Law of Significance
Holiday Inn
Daniel Jacoby's photographs
the first bird
Gödel Escher Bach: Birthday Cantatatata
Father's Day (in pictures)
your cat for my car
Jobsnotes of note
world population map
no joy in Baker
vote smart
exact nonsense
introducing eyesFinder
resolved
to space
notebooks
where are the desktop apps?