media icon indicating copy to clipboard operation
media copied to clipboard

Support t= URL parameter to specify start position

Open yoobi opened this issue 2 years ago • 3 comments

Use case description

The use case would be to start the dash stream at a specific position. For example, a dash stream has a duration of 60 minutes, and we want to start the stream at 10 minutes instead of 0 minute. This avoids having to load the first chunk just to do a player.seekTo() and loading chunks again at the desired position.

Proposed solution

After reading from dash.js repository, they use a #t=600 at the end of the url to notify it should start at 10 minutes.

Alternatives considered

Using player.seekTo()

yoobi avatar Jan 29 '24 09:01 yoobi

This avoids having to load the first chunk just to do a player.seekTo() and loading chunks again at the desired position.

If you seek before calling prepare, the media is immediately loaded from the requested position. Have you tried to call methods in this order?

If you want to support t= URL parameters, you can also easily convert parameter to a seek operation when setting the media item.

I can mark this issue as an enhancement to support this automatically (as it has also been asked for HLS before: https://github.com/google/ExoPlayer/issues/9946). The right implementation may depend on https://github.com/google/ExoPlayer/issues/6373 to be able to specify a start position that does not override the default position.

tonihei avatar Jan 29 '24 16:01 tonihei

Hello,

Thank you ! I didn't know calling seek before prepare would work, I'll try it out and tell you about it

yoobi avatar Jan 30 '24 08:01 yoobi

I've managed to load only once be seeking before preparing the media, thank you

yoobi avatar Feb 06 '24 08:02 yoobi