You can add an event listener to the video element on the `timeupdate`
event and pause the video when the videos' time is at/past the time you
want to stop, but your idea does sound more convenient.

On Sat, Sep 17, 2016 at 5:21 PM, Melvin Carvalho <melvincarva...@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/
>

Reply via email to