Do not autoplay in video editor.

This commit is contained in:
Alex Hart
2021-10-15 11:14:32 -03:00
committed by Greyson Parrelli
parent 731683ae09
commit 62f9f19540
2 changed files with 31 additions and 5 deletions

View File

@@ -93,6 +93,7 @@ public class VideoPlayer extends FrameLayout {
if (playerCallback != null) {
switch (playbackState) {
case Player.STATE_READY:
playerCallback.onReady();
if (playWhenReady) playerCallback.onPlaying();
break;
case Player.STATE_ENDED:
@@ -137,6 +138,14 @@ public class VideoPlayer extends FrameLayout {
exoView.setResizeMode(resizeMode);
}
public boolean isPlaying() {
if (this.exoPlayer != null) {
return this.exoPlayer.isPlaying();
} else {
return false;
}
}
public void pause() {
if (this.exoPlayer != null) {
this.exoPlayer.setPlayWhenReady(false);
@@ -332,6 +341,8 @@ public class VideoPlayer extends FrameLayout {
public interface PlayerCallback {
default void onReady() {}
void onPlaying();
void onStopped();