Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Ask] Casting Icon visibility for Android #357

Open
fdobre opened this issue May 10, 2024 · 1 comment
Open

[Ask] Casting Icon visibility for Android #357

fdobre opened this issue May 10, 2024 · 1 comment

Comments

@fdobre
Copy link

fdobre commented May 10, 2024

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 fdobre changed the title [Ask] Controls visibility for Android [Ask] Casting Icon visibility for Android May 15, 2024
@fdobre
Copy link
Author

fdobre commented Jul 9, 2024

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);
 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant