Can audio bookmarks be hyperlinks?

Tim Chase blinux.list at thechases.com
Mon Nov 15 03:12:31 UTC 2010


On 10/27/2010 08:16 AM, marbux wrote:
> Does anyone know of such a URI specification?

Paul, I haven't seen any answer fly by, so I thought I'd take a 
stab at it.  There's no defined standard for doing it, so it 
varies from player to player.  With a little JavaScript, you can 
do like YouTube does and read the offset value from 
window.location.hash and use it to control whichever embedded 
media-player you're using.  If you're using HTML5, there's an 
built-in media player for .wav/.ogg/.mp3 (the supported subset of 
those three audio-types varies by browser) with a .currentTime 
property that you can set when the content is loaded.  Then your 
URL would look something like

  http://example.com/page_displaying_html5_embedded_audio#t=3.2

where your JavaScript code parses out the "3.2" and uses that to 
set the .currentTime offset to begin playing.  If I read things 
correctly, you may also have to set the "autobuffer" and 
"autoplay" accordingly to load the content at page-load (rather 
than when the user initiates it manually), specifying a callback 
to set the offset after the content has finished loading.

A couple good resources with fragments of useful code:

http://blog.gingertech.net/2009/08/19/jumping-to-time-offsets-in-videos/

http://stackoverflow.com/questions/3165444/html5-video-chrome-error-settings-currenttime


As always with JavaScript, the devil is in the details -- unless 
you can mandate support for HTML5, you'd have to also have a 
media player (Flash, Silverlight, whatever) with fallback.

Hope that helps point you in the right direction,

-tim







More information about the Blinux-list mailing list