Added support for multi-image receive.

This commit is contained in:
Greyson Parrelli
2018-11-08 23:33:37 -08:00
parent e665252b86
commit 47a10a0288
55 changed files with 1277 additions and 186 deletions

View File

@@ -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);