[whatwg] Feature Request: Media Elements as Targets for Links
silviapfeiffer1 at gmail.com
Sun Nov 25 17:17:34 PST 2012
On Mon, Nov 26, 2012 at 4:47 AM, Nils Dagsson Moskopp <
nils at dieweltistgarnichtso.net> wrote:
> Silvia Pfeiffer <silviapfeiffer1 at gmail.com> schrieb am Mon, 26 Nov 2012
> 00:01:52 +1100:
> > Can you provide an example markup and an example URL that you think
> > will solve your use case?
> Example markup. Assume I have an audio element in a blog:
> <audio id="episode1">
> <source src="episode1.oga" type="audio/ogg; codecs=vorbis">
> <source src="episode1.mp3" type="audio/mpeg">
> Someone could comment it like:
> <a href="#t=01:23" target="audio">When Alice mentioned Bob</a> …
> When someone clicks the link, the browsing context would not change,
> but the media element would jump to that point (and possibly play).
> > I'm asking because we don't use the name attribute any more in HTML5,
> > because we have the id attribute on all elements. Thus, it is always
> > possible to hyperlink directly to a video element using a hash on a
> > URL and the value of the id element. But I still wonder what you
> > think is missing.
> I want to hyperlink directly to a embedded media content at a specific
> time while preserving the context without going through brittle
> Something like <http://example.org/podcast.html#episode1#t=01:23> could
> link to the audio element on the page at a specific point in time. (I
> am just conjecturing now, though – is that even legal URL synthax?)
No, that is invalid since you can only have one fragment on a URL - at best
you could do http://example.org/podcast.html#episode1&t=01:23.
What is currently possible is <a href="#episode1" target="audio">When
by changing the currentSrc to something like "episode1.oga#t=01:23" or by
setting the currentTime to 83.
I agree that this is a frustrating situation and a declarative means of
setting the media fragment offset would be much preferred. I have used
@data-time attributes for this before (while of course still using JS to
actually implement it).
I would support introduction of a standard attribute for this. Maybe
something like @mediafrag="t=01:23" on <a> elements would be really useful
and can be converted by browsers to be added to a <video> or <audio>
element currentSrc if the <a> links to the @id of a media element.
The biggest problem that I see, however, is that you really want the URL of
the Web page be changed to reflect the time offset status of the media
resource, e.g. http://example.com/AliceAndBobVideo.html ->
http://example.com/AliceAndBobVideo.html#t=01:23 . In this way people can
cut-and-paste the URL and share it with the time offset intact.
(I also have an example of such a use case
I don't think there is a simple way to achieve this with the way that the
Web currently works because the interpretation of the fragment parameters
of the HTML page are controlled by the Web application where they don't
apply to an @id attribute on the page. We would need to change the way in
which URL fragments are interpreted by Web pages.
More information about the whatwg