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

FrameworkSampleSource fails to stop buffering and start playback #38

Closed
IanDBird opened this issue Sep 1, 2014 · 7 comments
Closed
Assignees
Labels

Comments

@IanDBird
Copy link
Contributor

IanDBird commented Sep 1, 2014

I'm having issues when i'm trying to play an MP4 but at a non-zero offset. I'm allowing the user to "Resume" their video where they last stopped playing, but occasionally (maybe 1 in 3), ExoPlayer refuses to start playback.

I don't think I am doing anything unusual when configuring the player, e.g.

    m_player.prepare(renderers);
    m_player.seekTo(m_offset);

I can see from logging in the onPlayerStateChanged callback, that the video player goes through the following states: STATE_IDLE, STATE_PREPARING and STATE_BUFFERING. It then remains in the buffering state indefinitely.

The issue appears to be effected by the fact i'm trying to seek in the video. I'm yet to have it fail when starting the video at the beginning. Is this a known issue? Are there any workarounds to ensure that playback always begins?

@natez0r
Copy link
Contributor

natez0r commented Sep 11, 2014

I am also seeing this problem. For me it's easiest to reproduce if you seek near the end of the video and seek back to the beginning. We only use progressive download mp4 files.

Still happening in 1.0.13.

@IanDBird
Copy link
Contributor Author

I retested the other day against the latest dev branch and was still able to reproduce. I explored different options how to try and workaround it myself, but since the issue is the player remaining in buffering, it's very difficult to determine the difference between a video buffering for a long time vs this issue. If the video is just taking a long time to load, the last thing you want to do is kill the video and try to load it again...

@ephemient
Copy link

I think I can get it to happen more frequently by seeking right to almost the end of the file.

With additional logging in ExoPlayerImplInternal.rendererReadyOrEnded, it seems that MediaExtractor.getCachedDuration sometimes stops short of the requested buffer duration. Since FrameworkSampleSource.continueBuffering is a no-op, there is no way to ask it to buffer more, and ExoPlayer remains in this state indefinitely.

@ojw28
Copy link
Contributor

ojw28 commented Sep 13, 2014

That sounds plausible. The easiest way to work around the issue would be to make an instance like:

ExoPlayer.Factory.newInstance(numRenderers, 0, 0)

Is your use case playing back regular MP4 files? The complete ExoPlayer based solution to this problem would be to implement everything at the application layer and stop using FrameworkSampleSource. This would give us enough control to fix these problems properly, as we've done for DASH and SmoothStreaming. It's quite a lot of work though.

@ephemient
Copy link

Yes, I'm playing MP4s from a URL. Setting the buffer times to 0 does seem to avoid getting stuck, but doesn't feel great for other reasons.

As another potential workaround, how acceptable would it be to implement a buffer within FrameworkSampleSource which continues to read samples ahead from MediaExtractor until it has cached enough? Although I'm not sure how to tell if we're in the buffering or rebuffering case from there.

@ojw28
Copy link
Contributor

ojw28 commented Sep 17, 2014

That doesn't sound ideal either. As per above, the best option by far is to implement everything at the application layer.

Maybe the best workaround would be to have FrameworkSampleSource.getBufferedPositionUs claim that it's buffered to the end if you're within the last ~5 seconds or so of the content. That would be more or less equivalent to setting the buffer times to 0 selectively, only when seeking near the end of the content.

@ojw28 ojw28 self-assigned this Sep 25, 2014
@ojw28
Copy link
Contributor

ojw28 commented Apr 13, 2015

On the latest dev branch, you can use ExoPlayer's application level MP4 extractor to avoid this issue (in the demo app, use TYPE_MP4 rather than TYPE_OTHER).

@ojw28 ojw28 closed this as completed May 8, 2015
@google google locked and limited conversation to collaborators Jun 28, 2017
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