Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Play a specific portion of a video but display the whole video? #6428

Closed
PranjalDesai opened this issue Sep 13, 2019 · 4 comments
Closed

Play a specific portion of a video but display the whole video? #6428

PranjalDesai opened this issue Sep 13, 2019 · 4 comments
Assignees
Labels

Comments

@PranjalDesai
Copy link

PranjalDesai commented Sep 13, 2019

Searched documentation and issues

I have looked at ClippingMediaSource.

Question

I want to play a video from url. The whole video shows on the seek bar and player but it starts playing from a specific point and pauses at a specific point. The user can press play and continue watching the rest of the video. How can I achieve that?

@tonihei
Copy link
Collaborator

tonihei commented Sep 16, 2019

it starts playing from a specific point

You can call player.seekTo before player.prepare to ensure the video starts from the desired position.

and pauses at a specific point.

You can send a message that gets triggered at this point and pauses the player:

player.createMessage((type, payload) -> player.setPlayWhenReady(false))
  .setHandler(new Handler()).setPositionMs(pausePosition).send();

The user can press play and continue watching the rest of the video.

That just works with the method above because the video is paused in the normal way.

@PranjalDesai
Copy link
Author

That works for a single video but if you have multiple videos being passed as ConcatenatingMediaSource than how do you handle starting point for each video?

@tonihei
Copy link
Collaborator

tonihei commented Sep 16, 2019

That's unfortunately not yet supported but tracked by #6373.

If you need such a feature urgently, you can make it (mostly) work by writing a MediaSource wrapper that returns a Timeline wrapper that sets your start position as windowDefaultStartPositionUs.

@PranjalDesai
Copy link
Author

Awesome thanks!

@ojw28 ojw28 closed this as completed Nov 17, 2019
@google google locked and limited conversation to collaborators Jan 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants