TheWidlarzGroup / react-native-video

A <Video /> component for react-native
http://thewidlarzgroup.github.io/react-native-video/
MIT License
7.16k stars 2.88k forks source link

Audio pauses and then restarts when navigating between screens #3127

Closed snips11 closed 5 months ago

snips11 commented 1 year ago

Bug

We are using react native video to play audio, the play/ pause button button and video component is in a custom header. When we navigate between screens it pauses shortly before restarting on its own when navigated.

Platform

Which player are you experiencing the problem on:

Environment info

React native info output:

System:
    OS: macOS 13.3.1
    CPU: (10) x64 Apple M1 Max
    Memory: 62.79 MB / 64.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 16.14.0 - /usr/local/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 8.3.1 - /usr/local/bin/npm
    Watchman: 2023.05.01.00 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.12.1 - /Users/jamesparsons/.rbenv/shims/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.4, iOS 16.4, macOS 13.3, tvOS 16.4, watchOS 9.4
    Android SDK: Not Found
  IDEs:
    Android Studio: 2020.3 AI-203.7717.56.2031.7784292
    Xcode: 14.3/14E222b - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.17 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.0.0 => 18.0.0 
    react-native: ^0.69.0 => 0.69.10 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Library version: "react-native-video": "^5.2.1"

Steps To Reproduce

  1. Use code show below
  2. Add audio stream (example, http://listen.vibenation.live:80/vibe)
  3. Navigate between a page (React Navigation) ...

Expected behaviour

  1. Audio player does not pause and then restart when navigating between pages.

Reproducible sample code

   ` <Video
      source={{uri: 'http://listen.vibenation.live:80/vibe'}}
      audioOnly={true}
      paused={play}
      ignoreSilentSwitch="ignore"
      playWhenInactive={true}
      playInBackground={true}
    />`
amm4ryous4f commented 9 months ago

Same issue in android

version : 6.0.0-beta.3

johankasperi commented 7 months ago

I am seeing this issue as well on android. 6.0.0-beta.3

freeboub commented 7 months ago

Did you check if the <Video component is unmounted ? If you need a audio player in all tabs why don't you put it in an upper level component ?