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

Infinite buffering on Android (Exoplayer) caused by seeking #1320

Closed
aalzanki opened this issue Nov 9, 2018 · 12 comments
Closed

Infinite buffering on Android (Exoplayer) caused by seeking #1320

aalzanki opened this issue Nov 9, 2018 · 12 comments
Labels
stale Closed due to inactivity or lack or resources

Comments

@aalzanki
Copy link
Contributor

aalzanki commented Nov 9, 2018

Current behavior

If I have a very long video (45+ mins), and scrub a lot, the video player on Android will get stuck in an infinite buffering state. I initially thought it might be an HLS bug, but it happens on mp4 videos too.

Reproduction steps

  1. Have a very long video on android Exoplayer
  2. have a scrubber
  3. scrub a lot

Expected behavior

I expect the video to not get stuck.

Platform

Which player are you experiencing the problem on:

  • Android ExoPlayer

Video sample

Any long video.

I found a way to fix the issue, but I'm not sure if the fix has any bad repercussions. I do not understand the mechanics of this code, so any feedback would be appreciated! My fix is to replace the contents of buildHttpDataSourceFactory with:

DefaultHttpDataSourceFactory factory = new DefaultHttpDataSourceFactory(getUserAgent(context));

if (requestHeaders != null)
    factory.getDefaultRequestProperties().set(requestHeaders);

return factory;
@ShaubertIlya
Copy link

Hello and good day. May be useful. I've found, that if you're using react-native-progress bar component it works slower. Especially when you use a seek function. I removed react-native-progress and replaced it with native ProgressViewIOS and ProgressBarAndroid. It works fine, no more infinite buffering

@cobarx
Copy link
Contributor

cobarx commented Dec 13, 2018

@aalzanki @alejandrorangel Using the DefaultHttpDataSourceFactory does tend to fix these issues, however I have been hesitant to switch over from OkHTTP because we'd lose support for cookies set by React Native, which a number of people are relying on.

Would you mind testing with 4.1.0, we updated the OkHTTP library in 4.0.0 which fixed a number of issues like this. It would be super helpful to get confirmation on whether OkHTTP will work properly or we need to switch over toDefaultHttpDataSourceFactory.

@aalzanki
Copy link
Contributor Author

I'll try to upgrade to 4.1.0 (or 4.0.0) and test with it in the next couple of days.

@aalzanki
Copy link
Contributor Author

aalzanki commented Jan 4, 2019

Sorry for the long wait. I tested it again. I can still reproduce the bug on the latest version.

@anshul-kai
Copy link

This is happening on version 4.4.1 as well.

@JohnPremKumar
Copy link

Faced this issue recently and those changes mentioned by @aalzanki seems to fix this issue. Any chance that this changes will be merged since patching up the DataSourceUtil.java manually to fix this issue does not seems to be a good idea in long run

@devbot-pcarrillo
Copy link

I was the same problem, I only create a cooldown function by seek

function reactivatedVideo(time: number){
    clearTimeout ( reactivateVideoTimer );
    onSeekActive = true;
      reactivateVideoTimer = setTimeout(() => {
        onSeekActive = false;
        videoRef.current.seek( time );
        setState({
          ...state,
          play: true,
          currentTime: time 
        });
      }, 500);
  }

@jwebcat
Copy link

jwebcat commented Apr 8, 2021

Same issue here, the fix provided by @aalzanki works like a charm.

@SimajjiHans
Copy link

I am using react-native-video 5.1.1, how do I apply the fix mentioned by @aalzanki?

@androidparth90
Copy link

androidparth90 commented May 25, 2021

How can one update exo player ? I am using the latest version as well 5.1.1 of react native video but I am facing this issue. Can someone please update the exo player for this repo ? The current version of Exoplayer is not matching the one used in this repo. Please see this link: https://github.com/google/ExoPlayer/releases/tag/r2.14.0

@jwebcat
Copy link

jwebcat commented May 25, 2021

@SimajjiHans You can use patch-package to apply the fix from @aalzanki . Here is the diff for those changes -> NickAVolpe@b65461c.

@androidparth90
Copy link

androidparth90 commented May 27, 2021

@jwebcat : Thank a lot for replying. This helped me fix my issue as well. Your a saviour :) This should be merged is what I feel

@hueniverse hueniverse added the stale Closed due to inactivity or lack or resources label May 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale Closed due to inactivity or lack or resources
Projects
None yet
Development

No branches or pull requests

10 participants