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

Display last frame when seeking to end of stream #2568

Closed
kneep opened this issue Mar 17, 2017 · 8 comments
Closed

Display last frame when seeking to end of stream #2568

kneep opened this issue Mar 17, 2017 · 8 comments
Assignees
Labels

Comments

@kneep
Copy link

kneep commented Mar 17, 2017

Seeking to last ms of a video makes the player switch to STATE_ENDED but the frame before the seeking is performed is still on the screen. Is there any way to make the player display the last frame if we seek to the last ms or just black out the screen? Thank you.

@ojw28 ojw28 changed the title Seeking to the last ms of a video Display last frame when seeking to end of stream Mar 17, 2017
@ojw28
Copy link
Contributor

ojw28 commented Mar 17, 2017

You can easily make the display go black when the player transitions to the ended state by having a black View above the surface that you make visible when you see the transition.

Showing the last frame in this case is surprisingly non-trivial to do without incurring any additional cost (e.g. latency through the rendering pipeline), so we've kind of ignored the problem up until now. It doesn't seem like a big issue. We'll use this issue for tracking, but it's unlikely we'll be fixing it any time soon.

@ojw28 ojw28 added the bug label Mar 17, 2017
@kneep
Copy link
Author

kneep commented Mar 18, 2017

That makes sense. I was trying to make sure I didn't miss any methods in ExoPlayer that could do this job. I can do this in the App level as a temp solution. Thank you.

@martijnvm
Copy link

Related to this issue.. I am not seeking to a specific position but I am just letting the video play and complete itself. After completion, the view is empty. Can you push me in the right direction on how I keep the last frame on screen?

@ojw28
Copy link
Contributor

ojw28 commented Mar 29, 2017

I don't think that's what happens. The last frame of the video should remain visible. Are you sure the last frame in the video isn't black (or whatever "empty" means in this case)?

@martijnvm
Copy link

martijnvm commented Mar 29, 2017

My Activity has a transparent window so basically when my video completes, I can see the content in the Activity behind it. That's my 'empty state' which I was referring too.

This is my piece of code:
videoView = new EMVideoView(getContext().getApplicationContext());
videoView.setPreviewImage(previewBitmap);
videoView.setVideoURI(getVideoUrl());
videoView.setOnPreparedListener(this :: startVideo);
addView(videoView, 0);

startVideo just calls .start() on the videoView.

I have double checked and my videos don't have empty frames at the end :).

PS: Great reaction time!

@ojw28
Copy link
Contributor

ojw28 commented Mar 29, 2017

Hm. Not sure about that. I don't think we have much control over this kind of thing at the ExoPlayer level; we simply release buffers to the surface (and that's about it). I don't know what EMVideoView does internally. You should probably report the issue to the author of that class. In any case, I don't think this discussion is relevant to this issue.

@ghost
Copy link

ghost commented Dec 20, 2017

In our application, to overcome this problem, we do the following and it works well:

If the seekTo is within 200ms from the end then we seek to (duration - 200ms) and then unpause the player. Just make sure that you then catch the ExoPlayer.STATE_ENDED event and upon receiving that you pause the player. We have noticed no side effects. And this is barely visible to the user.

@ojw28 ojw28 assigned tonihei and unassigned ojw28 May 9, 2018
ojw28 pushed a commit that referenced this issue Jun 6, 2019
We currently don't display the last frame because the seek time is behind the
last frame's timestamps and it's thus marked as decodeOnly.

This case can be detected by checking whether all data sent to the codec is
marked as decodeOnly at the time we read the end of stream signal. If so, we
can re-enable the last frame. This should work for almost all cases because the
end-of-stream signal is read in the same feedInputBuffer loop as the last
frame and we therefore haven't released the last frame buffer yet.

Issue:#2568
PiperOrigin-RevId: 251425870
@tonihei
Copy link
Collaborator

tonihei commented Jul 9, 2019

Issue is solved on the dev-branch now. Closing.

@tonihei tonihei closed this as completed Jul 9, 2019
ojw28 pushed a commit that referenced this issue Jul 9, 2019
We currently don't display the last frame because the seek time is behind the
last frame's timestamps and it's thus marked as decodeOnly.

This case can be detected by checking whether all data sent to the codec is
marked as decodeOnly at the time we read the end of stream signal. If so, we
can re-enable the last frame. This should work for almost all cases because the
end-of-stream signal is read in the same feedInputBuffer loop as the last
frame and we therefore haven't released the last frame buffer yet.

Issue:#2568
PiperOrigin-RevId: 251425870
@google google locked and limited conversation to collaborators Oct 3, 2019
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

4 participants