GithubHelp home page GithubHelp logo

Comments (11)

 avatar commented on April 28, 2024

Was able to fix this by simply adding a listener using AppStateIOS module and setting the repeat prop to false when the app was not active. Closing this issue as it's really more of an enhancement. Feel free to reopen as such.

from react-native-video.

 avatar commented on April 28, 2024

Quick update. Still seeing this issue sometimes even with use of AppStateIOS. Haven't figured out root cause as it's difficult to reproduce consistently. What I can mention is that, when the device wakes, it's often running hot and the video seems to appear momentarily before getting replaced with a black background.

In closed beta right now and none of my internal testers have brought it up yet, but if they do I may have to get more surgical to address.

from react-native-video.

 avatar commented on April 28, 2024

Thanks for re-opening @brentvatne. Just had my first beta user report the issue and mentioned the black screen. Said he'd left the app running in the background and when he came back to it some time later this issue occurred.

from react-native-video.

brentvatne avatar brentvatne commented on April 28, 2024

@jhabdas - I think the desired behaviour here is to automatically pause the video when we background the app, and resume it when you jump back in. But we can make this controllable via a prop as well, because there may be situations where you want to have audio/video running in background (eg: a media player app like Rdio or Spotify) πŸ˜„

from react-native-video.

 avatar commented on April 28, 2024

Sounds good. Will continue with your recommendations and tightening up my state management and update later. Hope to see some sweet control center integration with the audio going into this awesome component. Keep up the great work!

from react-native-video.

 avatar commented on April 28, 2024

Based on additional research and debugging today I was able to replicate this issue even without the video looping. As such I have adjusted the title and description of this issue, cut a pre-release version of the affected app and updated the steps to replicate.

As far as I can tell, this issue should be able to be replicated on any app which uses this component if the device is locked (replicated consistently on iPhone 6) without first sending the app into the background, and with the USB connection to Xcode unplugged.

A workaround for this issue would be to remove the video component when the app state goes into the background, but, from what I can see, the AppStateIOS module doesn't fire the UIApplicationDidEnterBackgroundNotification event in time for it to make it over the bridge; the JS event listeners can't catch it in time to respond.

I tried to speed things up a little by dispatching my own inactive event across the bridge with some light abuse of appStateDidChange, though, unfortunately, even this event wasn't fast enough and was only received after the app was unlocked (as if it were somehow deferred).

Here's some code for anyone who want's to give the inactive hack a try:

- (void) applicationWillResign
{
  [self.bridge.eventDispatcher sendDeviceEventWithName:@"appStateDidChange"
                                                  body:@{@"app_state": @"inactive"}]; // received on JS side of bridge only after the device is unlocked
  NSLog(@"derp"); // outputs to log a moment after the screen is locked
}

- (void) subscribeToNotifications
{
  [[NSNotificationCenter defaultCenter]
   addObserver:self
   selector:@selector(applicationWillResign)
   name:UIApplicationWillResignActiveNotification
   object:nil];
}

Unfortunately this means I'm going to have to remove this component from my app until a suitable workaround or fix can be found. I'd love to study any app using this component which does not express this issue if someone can point me in the right direction.

from react-native-video.

brentvatne avatar brentvatne commented on April 28, 2024

@jhabdas - I can't seem to get your project running :( followed your README instructions and got this:
screen shot 2015-06-25 at 3 25 22 pm

I tried the steps you mentioned above on an app that I have which uses video and I didn't have the problem, but I tried a fix anyways and pushed it in 0.4.8 - can you let me know if that works for you? (1f901be)

from react-native-video.

 avatar commented on April 28, 2024

Thanks for cutting a new version @brentvatne. Unfortunately I'm still seeing the same problem after pulling in 0.4.8. Because my app's about 2 minors behind react-native now I'm going to pull it forward to the latest stable to see if that helps clear things up. I also subbed #65, though I'm not sure it's necessary as, at least in my case, I noticed the problem occurred with and without looping enabled.

I'll update with more info mid to late next week on the outcomes of the update. Meanwhile, unless others are seeing this issue, it may be pertinent to bump again to pull the changes in 1f901be. Your call, of course.

Thanks for your time and attention on this. More info to follow.

from react-native-video.

brentvatne avatar brentvatne commented on April 28, 2024

Hey @jhabdas - that's very strange, I wonder why this would be happening if it's being paused when the app becomes inactive. I haven't seen any mention of this in googling for AVPlayer issues so it doesn't seem to be specific to that. @johanneslumpe - any ideas?

from react-native-video.

 avatar commented on April 28, 2024

Resolved with bump to React Native v0.5.0 (or v0.6.0) and React Native Video v0.4.9. Looks like there were some dispatcher bugs resolved in v0.5.0-rc which I overlooked while debugging, and when I test drove the latest version of this component the other day I did so using a 0.4.x version of React Native. Derp.

from react-native-video.

brentvatne avatar brentvatne commented on April 28, 2024

Awesome! πŸ˜„

from react-native-video.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.