mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-20 00:29:11 +01:00
Pass through clip information to video player.
This commit is contained in:
committed by
Greyson Parrelli
parent
8c76cead58
commit
220931d3df
@@ -13,9 +13,9 @@ import androidx.lifecycle.DefaultLifecycleObserver;
|
||||
import androidx.lifecycle.Lifecycle;
|
||||
import androidx.lifecycle.LifecycleOwner;
|
||||
|
||||
import com.google.android.exoplayer2.ExoPlayer;
|
||||
import com.google.android.exoplayer2.MediaItem;
|
||||
import com.google.android.exoplayer2.Player;
|
||||
import com.google.android.exoplayer2.SimpleExoPlayer;
|
||||
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
|
||||
|
||||
import org.signal.core.util.logging.Log;
|
||||
@@ -54,7 +54,7 @@ public final class GiphyMp4ProjectionPlayerHolder implements Player.Listener, De
|
||||
this.policyEnforcer = policyEnforcer;
|
||||
|
||||
if (player.getExoPlayer() == null) {
|
||||
SimpleExoPlayer fromPool = ApplicationDependencies.getExoPlayerPool().get(TAG);
|
||||
ExoPlayer fromPool = ApplicationDependencies.getExoPlayerPool().get(TAG);
|
||||
|
||||
if (fromPool == null) {
|
||||
Log.i(TAG, "Could not get exoplayer from pool.");
|
||||
@@ -75,7 +75,7 @@ public final class GiphyMp4ProjectionPlayerHolder implements Player.Listener, De
|
||||
this.mediaItem = null;
|
||||
this.policyEnforcer = null;
|
||||
|
||||
SimpleExoPlayer exoPlayer = player.getExoPlayer();
|
||||
ExoPlayer exoPlayer = player.getExoPlayer();
|
||||
if (exoPlayer != null) {
|
||||
player.stop();
|
||||
player.setExoPlayer(null);
|
||||
@@ -142,7 +142,7 @@ public final class GiphyMp4ProjectionPlayerHolder implements Player.Listener, De
|
||||
@Override
|
||||
public void onResume(@NonNull LifecycleOwner owner) {
|
||||
if (mediaItem != null) {
|
||||
SimpleExoPlayer fromPool = ApplicationDependencies.getExoPlayerPool().get(TAG);
|
||||
ExoPlayer fromPool = ApplicationDependencies.getExoPlayerPool().get(TAG);
|
||||
if (fromPool != null) {
|
||||
ExoPlayerKt.configureForGifPlayback(fromPool);
|
||||
fromPool.addListener(this);
|
||||
|
||||
@@ -13,8 +13,8 @@ import androidx.annotation.Nullable;
|
||||
import androidx.lifecycle.DefaultLifecycleObserver;
|
||||
|
||||
import com.google.android.exoplayer2.C;
|
||||
import com.google.android.exoplayer2.ExoPlayer;
|
||||
import com.google.android.exoplayer2.MediaItem;
|
||||
import com.google.android.exoplayer2.SimpleExoPlayer;
|
||||
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout;
|
||||
import com.google.android.exoplayer2.ui.PlayerView;
|
||||
|
||||
@@ -31,10 +31,10 @@ public final class GiphyMp4VideoPlayer extends FrameLayout implements DefaultLif
|
||||
@SuppressWarnings("unused")
|
||||
private static final String TAG = Log.tag(GiphyMp4VideoPlayer.class);
|
||||
|
||||
private final PlayerView exoView;
|
||||
private SimpleExoPlayer exoPlayer;
|
||||
private CornerMask cornerMask;
|
||||
private MediaItem mediaItem;
|
||||
private final PlayerView exoView;
|
||||
private ExoPlayer exoPlayer;
|
||||
private CornerMask cornerMask;
|
||||
private MediaItem mediaItem;
|
||||
|
||||
public GiphyMp4VideoPlayer(Context context) {
|
||||
this(context, null);
|
||||
@@ -61,11 +61,11 @@ public final class GiphyMp4VideoPlayer extends FrameLayout implements DefaultLif
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable SimpleExoPlayer getExoPlayer() {
|
||||
@Nullable ExoPlayer getExoPlayer() {
|
||||
return exoPlayer;
|
||||
}
|
||||
|
||||
void setExoPlayer(@Nullable SimpleExoPlayer exoPlayer) {
|
||||
void setExoPlayer(@Nullable ExoPlayer exoPlayer) {
|
||||
exoView.setPlayer(exoPlayer);
|
||||
this.exoPlayer = exoPlayer;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user