W3C home > Mailing lists > Public > whatwg@whatwg.org > September 2016

Re: [whatwg] possible new parameters to video.play() ?

From: Simon Pieters <simonp@opera.com>
Date: Sun, 18 Sep 2016 14:44:43 +0200
To: whatwg@lists.whatwg.org, "Melvin Carvalho" <melvincarvalho@gmail.com>
Message-ID: <op.ynzkctsgidj3kv@simons-mbp>
On Sun, 18 Sep 2016 01:21:27 +0200, Melvin Carvalho  
<melvincarvalho@gmail.com> wrote:

> Apologies if this has come up before, but I was wondering if it would be
> possible to add simple parameters to the play() function.
>
> They would be
>
> play(start, end)
>
> Where start and end are the times in seconds.
>
> I know you can do
>
> video.currentTime = start ; video.play()
>
> But there's no real easy way to stop it to play a clip
>
> The media fragments URIs spec [1] handles this quite nicely by adding to
> the URI
>
> #t=start,end
>
> But yet there seems to be no way to do this in JS, resorting to changing
> location.hash and then doing a reload, which seems a bit of a kludge
>
> I may be missing something extremely obvious, if so, I'd love to know!
>
> [1] https://www.w3.org/TR/media-frags/

The pauseOnExit attribute on VTTCue can be used for this purpose. See  
https://html.spec.whatwg.org/multipage/embedded-content.html#text-track-api:the-audio-element  
for an example.

-- 
Simon Pieters
Opera Software
Received on Sunday, 18 September 2016 12:45:14 UTC

This archive was generated by hypermail 2.3.1 : Sunday, 18 September 2016 12:45:14 UTC