react-native-jw-media-player icon indicating copy to clipboard operation
react-native-jw-media-player copied to clipboard

[Ask] Casting Icon visibility for Android

Open fdobre opened this issue 1 year ago • 1 comments

I would need to hide the casting icon for Android without removing totally the casting dependencies because they are used by another player. Is there any option to do that?

Any response will be greatly appreciated.

Thank you!

fdobre avatar May 10 '24 15:05 fdobre

I was able to hide the cast icon and add an error code for Android by adding a patch:

diff --git a/node_modules/react-native-jw-media-player/android/src/main/java/com/appgoalz/rnjwplayer/RNJWPlayerView.java b/node_modules/react-native-jw-media-player/android/src/main/java/com/appgoalz/rnjwplayer/RNJWPlayerView.java
index 45ec30a..3e609f3 100755
--- a/node_modules/react-native-jw-media-player/android/src/main/java/com/appgoalz/rnjwplayer/RNJWPlayerView.java
+++ b/node_modules/react-native-jw-media-player/android/src/main/java/com/appgoalz/rnjwplayer/RNJWPlayerView.java
@@ -747,6 +747,14 @@ public class RNJWPlayerView extends RelativeLayout implements
             }
         }
 
+        if (prop.hasKey("hideCastIcon")) {
+            boolean hideCastIcon = prop.getBoolean("hideCastIcon");
+            if(hideCastIcon) {
+                View castView = findViewById(R.id.center_cast_img);
+                castView.setLayoutParams(new LayoutParams(0,0));
+            }
+        }
+
         if (mColors != null) {
             if (mColors.hasKey("backgroundColor")) {
                 mPlayerView.setBackgroundColor(Color.parseColor("#" + mColors.getString("backgroundColor")));
@@ -1207,6 +1215,7 @@ public class RNJWPlayerView extends RelativeLayout implements
         if (ex != null) {
             event.putString("error", ex.toString());
             event.putString("description",  errorEvent.getMessage());
+            event.putString("code",  String.valueOf(errorEvent.getErrorCode()));
         }
         getReactContext().getJSModule(RCTEventEmitter.class).receiveEvent(getId(), "topPlayerError", event);
 

fdobre avatar Jul 09 '24 17:07 fdobre