willkg/richard — pull request #95 by squiddy (2012-05-07 16:54:06+00:00)
Title: 89. Link to specific timecode of videos

See #89

Similar to YouTube, people can link to a specific part of a video. We
can use this (at pyvideo) to provide direct links for example to the
different presentations in lightning talks.

For example this URL will start playing at 15 minutes and 30s.

http://pyvideo.org/video/956/keynote-guido-van-rossum#t=15m30s

Right now, this is only working for videos that are managed by
UniversalSubtitles, because they expose a very helpful `playAt` function
that hopefully works across all their supported players.
I only tested this with YouTube videos so far.

--
**Implemented for videos managed by universal subtitles**

There are a couple TODOs in the code, mostly about error handling.

One thing I don't like is the way the code waits until the widget is ready (https://github.com/squiddy/richard/pull/new/89-video-link-timecode#L0R66). It just checks every second if a particular global variable is available and then continues to work on the first widget. I think it's possible that at that moment the player is not ready yet and we can't set the time. Looking through their widget code, I could not find a better way yet.

The huge advantage with unisubs here is that they did most of the work already by abstracting the different players and providing a single interface. Adding support for HTML5 videos shouldn't be difficult, but maybe we can wrap these with unisubs too and just use the same code.
Of course that depends on [#3 universal subtitles support](https://github.com/willkg/richard/issues/3) - that is, are we integrating unisubs into richard or not.