From 6a6db1d69dca82fc95d7eabfc5b2479c33a04317 Mon Sep 17 00:00:00 2001 From: Vehovec Date: Thu, 14 Dec 2023 13:29:33 +0100 Subject: [PATCH] chore: add FLAG_KEEP_SCREEN_ON to example/MainActivity --- .../bitmovin/player/reactnative/example/MainActivity.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/example/android/app/src/main/java/com/bitmovin/player/reactnative/example/MainActivity.java b/example/android/app/src/main/java/com/bitmovin/player/reactnative/example/MainActivity.java index 6414bcf1..0c4dfd44 100644 --- a/example/android/app/src/main/java/com/bitmovin/player/reactnative/example/MainActivity.java +++ b/example/android/app/src/main/java/com/bitmovin/player/reactnative/example/MainActivity.java @@ -8,6 +8,8 @@ import com.facebook.react.defaults.DefaultReactActivityDelegate; import com.google.android.gms.cast.framework.CastContext; +import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; + public class MainActivity extends ReactActivity { @Override public void onCreate(@Nullable Bundle savedInstanceState) { @@ -19,6 +21,11 @@ public void onCreate(@Nullable Bundle savedInstanceState) { } catch (Exception e) { // cast framework not supported } + + // Prevent going into ambient mode on Android TV devices / screen timeout on mobile devices during playback. + // If your app uses multiple activities make sure to add this flag to the activity that hosts the player. + // Reference: https://developer.android.com/training/scheduling/wakelock#screen + getWindow().addFlags(FLAG_KEEP_SCREEN_ON); } /**