version:1.7
fix: update:修改布局,爱心守护播放视频,
This commit is contained in:
82
app/src/main/java/com/uiui/os/view/JzvdStdAssert.java
Normal file
82
app/src/main/java/com/uiui/os/view/JzvdStdAssert.java
Normal file
@@ -0,0 +1,82 @@
|
||||
package com.uiui.os.view;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
|
||||
import cn.jzvd.JzvdStd;
|
||||
|
||||
|
||||
public class JzvdStdAssert extends JzvdStd {
|
||||
private onVideoCompletionListener onVideoCompletionListener;
|
||||
private ScreenOrientationChangeListener changeListener;
|
||||
private GotoFullScreenListener gotoFullScreenListener;
|
||||
|
||||
public JzvdStdAssert(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public JzvdStdAssert(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onPrepared() {
|
||||
Log.e("onStateChanged", "onPrepared");
|
||||
state = STATE_PREPARED;
|
||||
if (!preloading) {
|
||||
mediaInterface.start();
|
||||
preloading = false;
|
||||
}
|
||||
onStatePlaying();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onCompletion() {
|
||||
super.onCompletion();
|
||||
onVideoCompletionListener.onVideoComplet();
|
||||
Log.e("onStateChanged", "onCompletion");
|
||||
}
|
||||
|
||||
public void setOnCompletionListener(onVideoCompletionListener listener) {
|
||||
this.onVideoCompletionListener = listener;
|
||||
}
|
||||
|
||||
public void setScreenOrientationChangeListener(ScreenOrientationChangeListener listener) {
|
||||
this.changeListener = listener;
|
||||
}
|
||||
|
||||
public void setGotoFullScreenListener(GotoFullScreenListener listener) {
|
||||
this.gotoFullScreenListener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void gotoNormalScreen() {
|
||||
super.gotoNormalScreen();
|
||||
changeListener.onOrientationChange();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void gotoFullscreen() {
|
||||
super.gotoFullscreen();
|
||||
gotoFullScreenListener.onGotoFullScreen();
|
||||
}
|
||||
|
||||
//视频播放完成回调
|
||||
public interface onVideoCompletionListener {
|
||||
void onVideoComplet();
|
||||
}
|
||||
|
||||
//退出全屏回调
|
||||
public interface ScreenOrientationChangeListener {
|
||||
void onOrientationChange();
|
||||
}
|
||||
|
||||
//进入全屏回调
|
||||
public interface GotoFullScreenListener {
|
||||
void onGotoFullScreen();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user