Unverified 提交 48776f46 authored 作者: Dokieyang's avatar Dokieyang 提交者: GitHub

Merge pull request #15 from Kongdy/main

安卓SuperPlayer补齐播放事件通知
...@@ -103,17 +103,32 @@ public class SuperPlatformPlayerView implements PlatformView, MethodChannel.Meth ...@@ -103,17 +103,32 @@ public class SuperPlatformPlayerView implements PlatformView, MethodChannel.Meth
@Override @Override
public void onClickFloatCloseBtn() { public void onClickFloatCloseBtn() {
mEventSink.success(getParams("onClickFloatCloseBtn",null));
} }
@Override @Override
public void onClickSmallReturnBtn() { public void onSuperPlayerBackAction() {
mEventSink.success(getParams("onSuperPlayerBackAction", null)); mEventSink.success(getParams("onSuperPlayerBackAction", null));
} }
@Override @Override
public void onStartFloatWindowPlay() { public void onStartFloatWindowPlay() {
mEventSink.success(getParams("onStartFloatWindowPlay",null));
}
@Override
public void onSuperPlayerDidStart() {
mEventSink.success(getParams("onSuperPlayerDidStart",null));
}
@Override
public void onSuperPlayerDidEnd() {
mEventSink.success(getParams("onSuperPlayerDidEnd",null));
}
@Override
public void onSuperPlayerError() {
mEventSink.success(getParams("onSuperPlayerError",null));
} }
@Override @Override
......
...@@ -446,7 +446,7 @@ public class SuperPlayerView extends RelativeLayout { ...@@ -446,7 +446,7 @@ public class SuperPlayerView extends RelativeLayout {
break; break;
case WINDOW:// 当前是窗口模式,返回退出播放器 case WINDOW:// 当前是窗口模式,返回退出播放器
if (mPlayerViewCallback != null) { if (mPlayerViewCallback != null) {
mPlayerViewCallback.onClickSmallReturnBtn(); mPlayerViewCallback.onSuperPlayerBackAction();
} }
break; break;
case FLOAT:// 当前是悬浮窗,退出 case FLOAT:// 当前是悬浮窗,退出
...@@ -628,12 +628,27 @@ public class SuperPlayerView extends RelativeLayout { ...@@ -628,12 +628,27 @@ public class SuperPlayerView extends RelativeLayout {
/** /**
* 点击小播放模式的返回按钮 * 点击小播放模式的返回按钮
*/ */
void onClickSmallReturnBtn(); void onSuperPlayerBackAction();
/** /**
* 开始悬浮窗播放 * 开始悬浮窗播放
*/ */
void onStartFloatWindowPlay(); void onStartFloatWindowPlay();
/**
* 播放开始通知
*/
void onSuperPlayerDidStart();
/**
* 播放结束通知
*/
void onSuperPlayerDidEnd();
/**
* 播放错误通知
*/
void onSuperPlayerError();
} }
public void release() { public void release() {
...@@ -694,6 +709,9 @@ public class SuperPlayerView extends RelativeLayout { ...@@ -694,6 +709,9 @@ public class SuperPlayerView extends RelativeLayout {
if (mWatcher != null) { if (mWatcher != null) {
mWatcher.exitLoading(); mWatcher.exitLoading();
} }
if(mPlayerViewCallback != null) {
mPlayerViewCallback.onSuperPlayerDidStart();
}
} }
@Override @Override
...@@ -710,6 +728,9 @@ public class SuperPlayerView extends RelativeLayout { ...@@ -710,6 +728,9 @@ public class SuperPlayerView extends RelativeLayout {
if (mWatcher != null) { if (mWatcher != null) {
mWatcher.stop(); mWatcher.stop();
} }
if(null != mPlayerViewCallback) {
mPlayerViewCallback.onSuperPlayerDidEnd();
}
} }
@Override @Override
...@@ -787,6 +808,9 @@ public class SuperPlayerView extends RelativeLayout { ...@@ -787,6 +808,9 @@ public class SuperPlayerView extends RelativeLayout {
@Override @Override
public void onError(int code, String message) { public void onError(int code, String message) {
showToast(message); showToast(message);
if(null != mPlayerViewCallback) {
mPlayerViewCallback.onSuperPlayerError();
}
} }
}; };
......
...@@ -145,6 +145,8 @@ class _TestSuperPlayerState extends State<TestSuperPlayer> { ...@@ -145,6 +145,8 @@ class _TestSuperPlayerState extends State<TestSuperPlayer> {
print("onStopFullScreenPlay"); print("onStopFullScreenPlay");
} else if (evtName == SuperPlayerViewEvent.onSuperPlayerBackAction) { } else if (evtName == SuperPlayerViewEvent.onSuperPlayerBackAction) {
print("onSuperPlayerBackAction"); print("onSuperPlayerBackAction");
} else {
print(evtName);
} }
} }
); );
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论