chaimPaneth / react-native-jw-media-player

React-Native Android/iOS bridge for JWPlayer SDK (https://www.jwplayer.com/)
MIT License
189 stars 91 forks source link

[Chomecast] Previous video gets played on the Chromecast device #282

Open SufianBabri opened 1 year ago

SufianBabri commented 1 year ago

Summary

The previous video is getting played on the Chromecast device. Happens on the latest version (0.2.34) and also on the older version 0.2.29.

Video recording of the issue is available here.

PS: I tried to reproduce this issue in a native Android project (no React Native) and couldn't reproduce it.

Reproduction Steps

You need to clone this repo and follow these steps:

  1. Click the button labelled "Playlist 1",
  2. Cast the video to your Chromecast device
  3. Stop the casting and press back button (to go back to the home screen)
  4. Click the button labelled "Playlist 2"
  5. Cast it to your Chromecast device. Notice that the video being played is not the current one but the previous video (the one from "Playlist 1").

Note: You will need to create a .env file with your JW Player keys. Please use .env.example as a reference.

Udbhav24378 commented 1 year ago

Is there any fix for this @SufianBabri @chaimPaneth so much of time invested but no use with latest version also..can u fix it as it is the major roadblock for my app release?

SufianBabri commented 1 year ago

@Udbhav24378 we ended up disabling JW Player's chromecast and using google cast library instead.

For this, you need to do the following things (can be found here):

  1. Apply the patch with patch-package
  2. For iOS, you will need to hide the Chromecast button.
Udbhav24378 commented 1 year ago

@SufianBabri can u please let me know the steps for google cast sdk integration .. and implementation in jwplayer?

SufianBabri commented 1 year ago

@Udbhav24378 just follow the docs.

grigdodon commented 8 months ago

hey @SufianBabri . have you managed by any chance to create a patch for disabling JW Player's chromecast for the latest version?

SufianBabri commented 8 months ago

@grigdodon my project is using version 0.2.35 of react-native-jw-media-player dependency. Using for the newer versions shouldn't need to be much different. Does this patch cause any issues with the newer versions of this library?

grigdodon commented 8 months ago

@SufianBabri unfortunately not. I get:

**ERROR** Failed to apply patch for package react-native-jw-media-player at path

    node_modules/react-native-jw-media-player

  This error was caused because react-native-jw-media-player has changed since you
  made the patch file for it. This introduced conflicts with your patch,
  just like a merge conflict in Git when separate incompatible changes are
  made to the same piece of code.

  Maybe this means your patch file is no longer necessary, in which case
  hooray! Just delete it!

  Otherwise, you need to generate a new patch file.

  To generate a new one, just repeat the steps you made to generate the first
  one.

  i.e. manually make the appropriate file changes, then run 

    patch-package react-native-jw-media-player

  Info:
    Patch file: patches/react-native-jw-media-player+0.2.35.patch
    Patch was made for version: 0.2.35
    Installed version: 0.2.39

And on version 0.2.35 the fullscreen events are not working, which I am using to control whether the player is playing or not.

SufianBabri commented 8 months ago

@grigdodon I have updated the patch for version 0.2.39. Please test and update us if it works fine.

Any chance that this fullscreen events issue is not there in one of the older releases?

grigdodon commented 8 months ago

@SufianBabri oh you absolute legend! thank you! the fullscreen events stopped working in 0.2.35 and are working now in 0.2.39

grigdodon commented 6 months ago

hey @SufianBabri any chance you have the time to generate the patch for the latest version as well 0.2.43? thank you very much!

SufianBabri commented 6 months ago

Hi @grigdodon. My apologies, I'm busy with a feature right now.

I can help you in creating a patch though. I have struggled in the past with updating patches and found these steps to make it much simpler. Hopefully, you'll find it helpful.

Just follow these steps:

  1. Install the dependency version that you want to patch
  2. Copy the contents of your old patch and paste them into the text area of diffy
  3. Now navigate to relevant files (as pointed out by diffy. You can reach your library folder at node_modules/react-native-jw-media-player/).
  4. Once you've made all the changes, you need to create the patch file by executing yarn create-patch react-native-jw-media-player (if you're using npm, it's probably npm run create-patch react-native-jw-media-player). I've added "create-patch" and "postinstall" to my scripts block like this to my package.json:
    "scripts": {
        "create-patch": "npx --yes patch-package --exclude 'build/|xcodeproj'",
        "postinstall": "npx --yes patch-package"
    }
  5. If executing yarn install (for npm it's npm i) doesn't show an error specific to the newly created patch file, you can now delete the old patch file (make a copy of the old patch file just in case)