jwplayer/jwplayer-react-native

[BUG] [Android] Previous video gets played on the Chromecast device

Closed this issue · 4 comments

Describe the bug
Previous video gets played on the Chromecast device

To Reproduce

  1. Play a video
  2. Close player and open another video
  3. Chromecast the video on a device
  4. Observe that previous video is played on the casting device

Expected behavior
Current video should be played on the chrome casting device, not previous one

"@jwplayer/jwplayer-react-native": "^1.0.1",

This bug seems to be the same as the one mentioned here:

chaimPaneth/react-native-jw-media-player#282

Hey @fdobre, I have a PR up that should resolve this. Please take a look if you have a second. It will be patched in the next release to NPM after I can get an internal review.

@Jmilham21 Sorry I am away from the project for about 10 days. I won't be able to check this until next week.

@Jmilham21 Tested the PR with many videos. There is definitely a big improvement.

I can confirm the issue already mentioned at the PR is present: if current video playing ends you have to close current casting and open a new one for the next video otherwise you will just see the casting icon on the target device screen.

The good news is patch allows to play current video, you can play another video immediately (unless you allow current one to reach the end) or by closing and reopening the casting connection.

Hey @fdobre, I mentioned this on the PR but will echo it here:

We don't have a way to connect a new player to an existing cast session seamlessly. Because of this and some other internal blockers, we must essentially lock a player to a cast session on Android. This means that when the player is destroyed, we must tear down the cast session to avoid situations where the device is still connected to the receiver but content cannot be played (and playback starts on the sender [phone]).

This may not be ideal for you but you should be able to play your content on a player that you can keep alive across navigation, and load new content into that player rather than creating a new player for each piece of content and attempting to route that player to an existing cast session (it could be possible but with our architecture it would require major refactoring or some not so great hacking).