FREE BURMA!

( ? , qUeStIoNMaRk )

Seeking for a sustainable amount of chaos. AKA an electronic stream of consciousness about software engineering, open source, life. By Marco Fabbri.

July 19, 2008

Of Small Things, Time, Links and Videos.

It seems that a pragmatic approach to ending procrastination is focusing on “small things”, and getting them done. As part of this today I focused on a long-standing “issue” of mine… getting YouTube videos link-addressable. You know, it happens you want to link to a precise (topical) moment in a video - e.g “when the kitten can’t finally keep up with the ever speeding treadmill” - and what you are left with is a “at X minutes and Y seconds in the “.

That said, having previously spotted the YouTube JavaScript Player API providing a seekTo function, I managed to leverage it (through Greasemonkey) to come to a solution: SeekTube.

SeekTube is a Greasemonkey user script to enable the same “link within a video” feature provided by Google Video also on YouTube videos.
[…]
Well, SeekTube enables the same functionality: i.e. you can specify a permalink to a precise time in the video by appending an “#” followed by the time formatted as HhMmSs to the video url, where H, M, S are sequence of digits indicating hours, minutes and seconds respectively (none of them is mandatory); e.g. you can take a look at the BeOS nice long degradation curve under heavy load(multiple multimedia streams and 3D graphics, half computing power down), happening at 7 minutes and 50 seconds (http://www.youtube.com/watch?v=6VDYdaXApNk#7m50s) from the beginning of the video.

Note: it’s rather alpha stage, as I haven’t yet figured out a way to cope more gracefully with the security/sandboxing model of Greasemonkey/Firefox (see SeekTube page for details on the implementation).

As a note for the JavaScript-inclined, an interesting failing approach to get a working reference to the “player” object inside the Greasemonkey execution environment (without overloading the window.onYouTubePlayerReady function) is to wait for the player.seekTo function to be ready, i.e. defined, i.e no more undefined, which goes down to setting a recurring timeout until the player.seekTo is defined. This approach failed beacuse of Greasemonkey sandboxing; player.seekTo will be undefined forever. Here comes the code… (the GM_log() is GreaseMoney logger to JavaScript Console)

function seekOnPlayerReady(){
  player = document.getElementById(‘movie_player’);
  if(player.seekTo) {
    /* seek time retrieval from url */
    player.seekTo(seekTime,true);
  } else {
    GM_log(‘player not yet ready’);
    setTimeout(’seekOnPlayerReady()’, 500);
  }
}
setTimeout(‘’, 500);

PS: DiveIntoGreasemonkey, being not fully up to date, is yet a very nice introduction, js2mode (by Steve Yegge) for Emacs is great.

1 Comment »

The URI to TrackBack this entry is: http://questionmark.blogsome.com/2008/07/19/of-small-things-time-links-and-videos/trackback/

  1. good site.

    Comment by Press Digital — November 17, 2008 @ 10:02 am

RSS feed for comments on this post.

Leave a comment

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>


Safely store your passwords on

Clipperz - online password manager

Get free blog up and running in minutes with Blogsome | Theme designs available here