IMO this should be a feature of TextTrackCue and has no relevance to VTTCue 
specifically. There's implementation overloading here that is mixing concerns 



On 18 Sep 2016, at 17:46, Melvin Carvalho 
<<>> wrote:

On 18 September 2016 at 14:44, Simon Pieters 
<<>> wrote:

On Sun, 18 Sep 2016 01:21:27 +0200, Melvin Carvalho <<>> 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 ;

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


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!


The pauseOnExit attribute on VTTCue can be used for this purpose. See
#text-track-api:the-audio-element for an example.

Thank you for both answers!

I found pauseOnExit to work very well for my use case.  I ended up with.

cue = new VTTCue(start, end, '')
cue.pauseOnExit = true
v.currentTime = start


var cue = new VTTCue(start, end, '');

As best I could tell that last parameter is a 'message', tho Im not sure I
got any message when the video stopped, even when I populated it.  Maybe I
wasnt supposed to.

I'm quite happy to use this solution.  My slight concert is whether there
are any side effects from adding a TextTrack to a video.

Should this be considered best practice, or would there perhaps still be
room in future for (start, end) parameters?

Simon Pieters
Opera Software

Reply via email to