chore(android): clean up ReactExoplayerView class (#4141)
This commit is contained in:
parent
8b8ebe9410
commit
c51c061f43
@ -7,7 +7,6 @@ import static androidx.media3.common.C.CONTENT_TYPE_RTSP;
|
|||||||
import static androidx.media3.common.C.CONTENT_TYPE_SS;
|
import static androidx.media3.common.C.CONTENT_TYPE_SS;
|
||||||
import static androidx.media3.common.C.TIME_END_OF_SOURCE;
|
import static androidx.media3.common.C.TIME_END_OF_SOURCE;
|
||||||
|
|
||||||
|
|
||||||
import android.annotation.SuppressLint;
|
import android.annotation.SuppressLint;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.ActivityManager;
|
import android.app.ActivityManager;
|
||||||
@ -24,7 +23,6 @@ import android.os.Looper;
|
|||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Window;
|
|
||||||
import android.view.accessibility.CaptioningManager;
|
import android.view.accessibility.CaptioningManager;
|
||||||
import android.widget.FrameLayout;
|
import android.widget.FrameLayout;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
@ -34,9 +32,6 @@ import android.widget.TextView;
|
|||||||
import androidx.activity.OnBackPressedCallback;
|
import androidx.activity.OnBackPressedCallback;
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.WorkerThread;
|
import androidx.annotation.WorkerThread;
|
||||||
import androidx.core.view.WindowCompat;
|
|
||||||
import androidx.core.view.WindowInsetsCompat;
|
|
||||||
import androidx.core.view.WindowInsetsControllerCompat;
|
|
||||||
import androidx.media3.common.AudioAttributes;
|
import androidx.media3.common.AudioAttributes;
|
||||||
import androidx.media3.common.C;
|
import androidx.media3.common.C;
|
||||||
import androidx.media3.common.Format;
|
import androidx.media3.common.Format;
|
||||||
@ -131,18 +126,17 @@ import com.facebook.react.bridge.Promise;
|
|||||||
import com.facebook.react.bridge.UiThreadUtil;
|
import com.facebook.react.bridge.UiThreadUtil;
|
||||||
import com.facebook.react.uimanager.ThemedReactContext;
|
import com.facebook.react.uimanager.ThemedReactContext;
|
||||||
import com.google.ads.interactivemedia.v3.api.AdError;
|
import com.google.ads.interactivemedia.v3.api.AdError;
|
||||||
import com.google.ads.interactivemedia.v3.api.AdEvent;
|
|
||||||
import com.google.ads.interactivemedia.v3.api.AdErrorEvent;
|
import com.google.ads.interactivemedia.v3.api.AdErrorEvent;
|
||||||
import com.google.ads.interactivemedia.v3.api.ImaSdkSettings;
|
import com.google.ads.interactivemedia.v3.api.AdEvent;
|
||||||
import com.google.ads.interactivemedia.v3.api.ImaSdkFactory;
|
import com.google.ads.interactivemedia.v3.api.ImaSdkFactory;
|
||||||
|
import com.google.ads.interactivemedia.v3.api.ImaSdkSettings;
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
import java.net.CookieHandler;
|
import java.net.CookieHandler;
|
||||||
import java.net.CookieManager;
|
import java.net.CookieManager;
|
||||||
import java.net.CookiePolicy;
|
import java.net.CookiePolicy;
|
||||||
import java.lang.Math;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@ -191,8 +185,6 @@ public class ReactExoplayerView extends FrameLayout implements
|
|||||||
private ExoPlayer player;
|
private ExoPlayer player;
|
||||||
private DefaultTrackSelector trackSelector;
|
private DefaultTrackSelector trackSelector;
|
||||||
private boolean playerNeedsSource;
|
private boolean playerNeedsSource;
|
||||||
private MediaMetadata customMetadata;
|
|
||||||
|
|
||||||
private ServiceConnection playbackServiceConnection;
|
private ServiceConnection playbackServiceConnection;
|
||||||
private PlaybackServiceBinder playbackServiceBinder;
|
private PlaybackServiceBinder playbackServiceBinder;
|
||||||
|
|
||||||
@ -205,7 +197,6 @@ public class ReactExoplayerView extends FrameLayout implements
|
|||||||
private long resumePosition;
|
private long resumePosition;
|
||||||
private boolean loadVideoStarted;
|
private boolean loadVideoStarted;
|
||||||
private boolean isFullscreen;
|
private boolean isFullscreen;
|
||||||
private boolean originalFitsSystemWindows;
|
|
||||||
private boolean isInBackground;
|
private boolean isInBackground;
|
||||||
private boolean isPaused;
|
private boolean isPaused;
|
||||||
private boolean isBuffering;
|
private boolean isBuffering;
|
||||||
@ -271,7 +262,7 @@ public class ReactExoplayerView extends FrameLayout implements
|
|||||||
|
|
||||||
private boolean viewHasDropped = false;
|
private boolean viewHasDropped = false;
|
||||||
|
|
||||||
private String instanceId = String.valueOf(UUID.randomUUID());
|
private final String instanceId = String.valueOf(UUID.randomUUID());
|
||||||
|
|
||||||
private CmcdConfiguration.Factory cmcdConfigurationFactory;
|
private CmcdConfiguration.Factory cmcdConfigurationFactory;
|
||||||
|
|
||||||
@ -1028,7 +1019,7 @@ public class ReactExoplayerView extends FrameLayout implements
|
|||||||
.setUri(uri);
|
.setUri(uri);
|
||||||
|
|
||||||
// refresh custom Metadata
|
// refresh custom Metadata
|
||||||
customMetadata = ConfigurationUtils.buildCustomMetadata(source.getMetadata());
|
MediaMetadata customMetadata = ConfigurationUtils.buildCustomMetadata(source.getMetadata());
|
||||||
if (customMetadata != null) {
|
if (customMetadata != null) {
|
||||||
mediaItemBuilder.setMediaMetadata(customMetadata);
|
mediaItemBuilder.setMediaMetadata(customMetadata);
|
||||||
}
|
}
|
||||||
@ -2269,8 +2260,6 @@ public class ReactExoplayerView extends FrameLayout implements
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Window window = activity.getWindow();
|
|
||||||
WindowInsetsControllerCompat controller = new WindowInsetsControllerCompat(window, window.getDecorView());
|
|
||||||
if (isFullscreen) {
|
if (isFullscreen) {
|
||||||
eventEmitter.onVideoFullscreenPlayerWillPresent.invoke();
|
eventEmitter.onVideoFullscreenPlayerWillPresent.invoke();
|
||||||
if (fullScreenPlayerView != null) {
|
if (fullScreenPlayerView != null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user