jwplayer / jwplayer-react-native

MIT License
32 stars 9 forks source link

[BUG] Casting seems to be broken on Android #27

Closed jmurth1234 closed 6 months ago

jmurth1234 commented 6 months ago

Describe the bug Unable to cast with the example project on two android devices I have. (one samsung, one redmi)

Behaviour seems a bit strange, i was able to cast for about a second with the samsung before the display went blank

To Reproduce Uses the Example application, complete the steps to setup casting in the README

Steps to reproduce the behavior:

  1. Go to one of the videos
  2. Attempt to cast to a display

Expected behavior Video would cast

Screenshots / Visual evidence If applicable, add screenshots or recordings to help explain your problem. (Required if reproduction is not 100% reliable)

Desktop (please complete the following information): If you are having a build issue, we would like to know about your machine.

System: OS: macOS 14.4.1 CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz Memory: 1.60 GB / 32.00 GB Shell: 3.6.0 - /usr/local/bin/fish Binaries: Node: 21.6.2 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 10.2.4 - /usr/local/bin/npm Watchman: Not Found Managers: CocoaPods: 1.12.1 - /usr/local/bin/pod SDKs: iOS SDK: Platforms: DriverKit 23.4, iOS 17.4, macOS 14.4, tvOS 17.4, visionOS 1.1, watchOS 10.4 Android SDK: Not Found IDEs: Android Studio: 2023.3 AI-233.14808.21.2331.11709847 Xcode: 15.3/15E204a - /usr/bin/xcodebuild Languages: Java: 17.0.10 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.1.0 => 18.1.0 react-native: 0.70.14 => 0.70.14 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Device(s) affected

Additional context Add any other context about the problem here.

Jmilham21 commented 6 months ago

Confirmed this is a bug. This feels like a once-resolved issue after the Android 4.18.0 release.

I will take this on.

Jmilham21 commented 6 months ago

@rymate1234, what Android version are both of your devices running? I have found there is no issue on Android 8.0 but the casting session breaks on Android 14.0.

Looking into why, but this info could help determine scope of the issue.

jmurth1234 commented 6 months ago

I believe both devices are on Android 14

Jmilham21 commented 6 months ago

Thank you for bringing this to my attention. It appears that there is a significant issue with the native Android SDK regarding how the com.jwplayer.pub.api.background.MediaService interacts with casting. It seems that there is a mismatch of IDs being sent to the cast receiver.

For the time being, if you disable backgroundAudioEnabled, casting should function as expected. I will provide further updates once I have more information. However, since this issue may necessitate a change in the native SDK, a solution may be slightly delayed.

Jmilham21 commented 6 months ago

This was an issue with the background audio service on Android interfering with the cast service on Android 13/14 (at least).

The resolution was to ensure the service is only bound when we are not casting. PR has been merged and the update will be pushed to NPM in the next release.