mirror of
https://github.com/oxen-io/session-android.git
synced 2025-12-03 08:32:34 +00:00
Added support for multi-image receive.
This commit is contained in:
@@ -21,6 +21,7 @@ import android.os.Build;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.FrameLayout;
|
||||
@@ -46,6 +47,7 @@ import com.google.android.exoplayer2.trackselection.DefaultTrackSelector;
|
||||
import com.google.android.exoplayer2.trackselection.TrackSelection;
|
||||
import com.google.android.exoplayer2.trackselection.TrackSelectionArray;
|
||||
import com.google.android.exoplayer2.trackselection.TrackSelector;
|
||||
import com.google.android.exoplayer2.ui.PlayerControlView;
|
||||
import com.google.android.exoplayer2.ui.PlayerView;
|
||||
import com.google.android.exoplayer2.ui.SimpleExoPlayerView;
|
||||
import com.google.android.exoplayer2.upstream.BandwidthMeter;
|
||||
@@ -70,6 +72,7 @@ public class VideoPlayer extends FrameLayout {
|
||||
@Nullable private final PlayerView exoView;
|
||||
|
||||
@Nullable private SimpleExoPlayer exoPlayer;
|
||||
@Nullable private PlayerControlView exoControls;
|
||||
@Nullable private AttachmentServer attachmentServer;
|
||||
@Nullable private Window window;
|
||||
|
||||
@@ -89,6 +92,8 @@ public class VideoPlayer extends FrameLayout {
|
||||
if (Build.VERSION.SDK_INT >= 16) {
|
||||
this.exoView = ViewUtil.findById(this, R.id.video_view);
|
||||
this.videoView = null;
|
||||
this.exoControls = new PlayerControlView(getContext());
|
||||
this.exoControls.setShowTimeoutMs(-1);
|
||||
} else {
|
||||
this.videoView = ViewUtil.findById(this, R.id.video_view);
|
||||
this.exoView = null;
|
||||
@@ -111,6 +116,19 @@ public class VideoPlayer extends FrameLayout {
|
||||
}
|
||||
}
|
||||
|
||||
public void hideControls() {
|
||||
if (this.exoView != null) {
|
||||
this.exoView.hideController();
|
||||
}
|
||||
}
|
||||
|
||||
public @Nullable View getControlView() {
|
||||
if (this.exoControls != null) {
|
||||
return this.exoControls;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void cleanup() {
|
||||
if (this.attachmentServer != null) {
|
||||
this.attachmentServer.stop();
|
||||
@@ -137,6 +155,8 @@ public class VideoPlayer extends FrameLayout {
|
||||
exoPlayer.addListener(new ExoPlayerListener(window));
|
||||
//noinspection ConstantConditions
|
||||
exoView.setPlayer(exoPlayer);
|
||||
//noinspection ConstantConditions
|
||||
exoControls.setPlayer(exoPlayer);
|
||||
|
||||
DefaultDataSourceFactory defaultDataSourceFactory = new DefaultDataSourceFactory(getContext(), "GenericUserAgent", null);
|
||||
AttachmentDataSourceFactory attachmentDataSourceFactory = new AttachmentDataSourceFactory(getContext(), defaultDataSourceFactory, null);
|
||||
|
||||
Reference in New Issue
Block a user