Skip to content

很痛苦哥们,你播放完成回调没有写 #32

Description

@Z-PENG-S

只能把你代码拉下来手动导包当做library引入了,依赖不是最新版,包括你现在的代码,只有onCompletion回调,具体实现你没有写。
我只用到了ExoPlayer,ijk的没用到没改,如果你看到了,可以去加上播放完成的回调:

BasePlayerImpl中加入:
protected void notifyOnCompletion() {
VideoProxyThreadUtils.runOnUiThread(() -> {
if (mOnCompletionListener != null) {
mOnCompletionListener.onCompletion();
}
});
}

ExoPlayerImpl中:

@OverRide
public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
LogUtils.i(TAG, "onPlayerStateChanged playWhenReady="+playWhenReady+", playbackState="+playbackState);
switch(playbackState) {
case Player.STATE_BUFFERING:
break;
case Player.STATE_IDLE:
break;
case Player.STATE_READY:
if (mPrepareState == PREPARING_STATE) {
notifyOnPrepared();
mPrepareState = PREPARED_STATE;
}
break;
case Player.STATE_ENDED:
//新加
notifyOnCompletion();
break;
default:
break;
}
}

好了,我要把你的代码引入我的项目了,我加班了哥们儿。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions