Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disable wifi & 3G,player異常回傳onCompletion #193

Closed
MoneyShih opened this issue Mar 19, 2015 · 5 comments
Closed

disable wifi & 3G,player異常回傳onCompletion #193

MoneyShih opened this issue Mar 19, 2015 · 5 comments

Comments

@MoneyShih
Copy link

在android手機上
播放https的hls
在播放時把wifi& 3g網路關閉
當player的buffer播完後
player會回傳onCompletion而不是error
但影片實際上還沒播放完畢

@bbcallen
Copy link
Contributor

bbcallen commented Jun 3, 2015

这是一个需要改ffmpeg的bug...

@bbcallen bbcallen added the bug label Jun 3, 2015
@lyqaiym
Copy link

lyqaiym commented Nov 16, 2015

解决了没有?

@MoneyShih
Copy link
Author

當時的作法是在 IjkMediaPlayer.java中的 case MEDIA_PLAYBACK_COMPLETE:
這一邊自行處理

        case MEDIA_PLAYBACK_COMPLETE:

            if (player != null) {
                long dur = player.getDuration();
                long pos = player.getCurrentPosition();
                if (dur >= 0 && pos - dur > -10 * 1000) {
                    Log.i("IjkMediaPlayer", "IjkMediaPlayer MEDIA_PLAYBACK_COMPLETE pos - dur > -10 * 1000");
                    player.notifyOnCompletion();
                    player.stayAwake(false);
                } else {
                    Log.i("IjkMediaPlayer", "IjkMediaPlayer MEDIA_PLAYBACK_COMPLETE network");
                    if (dur >= 0 && mContext != null && network.getInst(mContext).isConnected() && network.getInst(mContext).isAvailable()) {
                        Log.i("IjkMediaPlayer", "IjkMediaPlayer MEDIA_PLAYBACK_COMPLETE isAvailable");
                        player.notifyOnCompletion();
                        player.stayAwake(false);
                    } else {
                        //call error
                        int what = MEDIA_ERROR_IO;
                        int extra = MEDIA_ERROR_NETWORK_UNAVAILABLE;
                        DebugLog.e(TAG, "Error (" + what + "," + extra + ")");
                        if (!player.notifyOnError(what, extra)) {

                        }
                        player.stayAwake(false);
                    }
                }

            }

            //player.notifyOnCompletion();
            //player.stayAwake(false);
            return;

@feiyang1235
Copy link

好像并不管用

@heistings
Copy link

heistings commented Jun 17, 2021

當時的作法是在 IjkMediaPlayer.java中的 case MEDIA_PLAYBACK_COMPLETE:
這一邊自行處理

        case MEDIA_PLAYBACK_COMPLETE:

            if (player != null) {
                long dur = player.getDuration();
                long pos = player.getCurrentPosition();
                if (dur >= 0 && pos - dur > -10 * 1000) {
                    Log.i("IjkMediaPlayer", "IjkMediaPlayer MEDIA_PLAYBACK_COMPLETE pos - dur > -10 * 1000");
                    player.notifyOnCompletion();
                    player.stayAwake(false);
                } else {
                    Log.i("IjkMediaPlayer", "IjkMediaPlayer MEDIA_PLAYBACK_COMPLETE network");
                    if (dur >= 0 && mContext != null && network.getInst(mContext).isConnected() && network.getInst(mContext).isAvailable()) {
                        Log.i("IjkMediaPlayer", "IjkMediaPlayer MEDIA_PLAYBACK_COMPLETE isAvailable");
                        player.notifyOnCompletion();
                        player.stayAwake(false);
                    } else {
                        //call error
                        int what = MEDIA_ERROR_IO;
                        int extra = MEDIA_ERROR_NETWORK_UNAVAILABLE;
                        DebugLog.e(TAG, "Error (" + what + "," + extra + ")");
                        if (!player.notifyOnError(what, extra)) {

                        }
                        player.stayAwake(false);
                    }
                }

            }

            //player.notifyOnCompletion();
            //player.stayAwake(false);
            return;

@ MoneyShih 对于直播来说,这样改是有问题的。

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

No branches or pull requests

5 participants