Files
mattermost-mobile/patches/react-native-video+5.2.0.patch

93 lines
4.7 KiB
Diff

diff --git a/node_modules/react-native-video/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java b/node_modules/react-native-video/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java
index fe95fdf..e38b9a9 100644
--- a/node_modules/react-native-video/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java
+++ b/node_modules/react-native-video/android-exoplayer/src/main/java/com/brentvatne/exoplayer/ReactExoplayerView.java
@@ -3,6 +3,7 @@ package com.brentvatne.exoplayer;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
+import android.graphics.Color;
import android.media.AudioManager;
import android.net.Uri;
import android.os.Handler;
@@ -14,6 +15,7 @@ import android.view.Window;
import android.view.accessibility.CaptioningManager;
import android.widget.FrameLayout;
import android.widget.ImageButton;
+import android.widget.ImageView;
import com.brentvatne.react.R;
import com.brentvatne.receiver.AudioBecomingNoisyReceiver;
@@ -317,6 +319,7 @@ class ReactExoplayerView extends FrameLayout implements
playerControlView.setPlayer(player);
playerControlView.show();
playPauseControlContainer = playerControlView.findViewById(R.id.exo_play_pause_container);
+ playerControlView.findViewById(R.id.exo_fullscreen_button).setOnClickListener(v -> setFullscreen(!isFullscreen));
// Invoking onClick event for exoplayerView
exoPlayerView.setOnClickListener(new OnClickListener() {
@@ -736,6 +739,7 @@ class ReactExoplayerView extends FrameLayout implements
@Override
public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
String text = "onStateChanged: playWhenReady=" + playWhenReady + ", playbackState=";
+ eventEmitter.playbackRateChange(playWhenReady && playbackState == com.google.android.exoplayer2.ExoPlayer.STATE_READY ? 1.0f : 0.0f);
switch (playbackState) {
case Player.STATE_IDLE:
text += "idle";
@@ -1305,6 +1309,7 @@ class ReactExoplayerView extends FrameLayout implements
Window window = activity.getWindow();
View decorView = window.getDecorView();
int uiOptions;
+ ImageView fullscreenButton = playerControlView.findViewById(R.id.exo_fullscreen_icon);
if (isFullscreen) {
if (Util.SDK_INT >= 19) { // 4.4+
uiOptions = SYSTEM_UI_FLAG_HIDE_NAVIGATION
@@ -1316,10 +1321,13 @@ class ReactExoplayerView extends FrameLayout implements
}
eventEmitter.fullscreenWillPresent();
decorView.setSystemUiVisibility(uiOptions);
+ decorView.setBackgroundColor(Color.parseColor("#000000"));
+ fullscreenButton.setImageResource(R.drawable.exo_controls_fullscreen_exit);
eventEmitter.fullscreenDidPresent();
} else {
uiOptions = View.SYSTEM_UI_FLAG_VISIBLE;
eventEmitter.fullscreenWillDismiss();
+ fullscreenButton.setImageResource(R.drawable.exo_controls_fullscreen_enter);
decorView.setSystemUiVisibility(uiOptions);
eventEmitter.fullscreenDidDismiss();
}
diff --git a/node_modules/react-native-video/android-exoplayer/src/main/res/layout/exo_player_control_view.xml b/node_modules/react-native-video/android-exoplayer/src/main/res/layout/exo_player_control_view.xml
index becee6a..96cbfc9 100644
--- a/node_modules/react-native-video/android-exoplayer/src/main/res/layout/exo_player_control_view.xml
+++ b/node_modules/react-native-video/android-exoplayer/src/main/res/layout/exo_player_control_view.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
@@ -71,6 +72,22 @@
android:paddingRight="4dp"
android:includeFontPadding="false"
android:textColor="#FFBEBEBE"/>
+ <FrameLayout
+ android:id="@+id/exo_fullscreen_button"
+ android:layout_width="32dp"
+ android:layout_height="wrap_content"
+ android:layout_gravity="right">
+
+ <ImageView
+ android:id="@+id/exo_fullscreen_icon"
+ android:layout_width="32dp"
+ android:layout_height="32dp"
+ android:layout_gravity="center"
+ android:adjustViewBounds="true"
+ android:scaleType="fitCenter"
+ app:srcCompat="@drawable/exo_controls_fullscreen_enter" />
+
+ </FrameLayout>
</LinearLayout>
</LinearLayout>