Java Code Examples for android.media.MediaPlayer#MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

The following examples show how to use android.media.MediaPlayer#MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Signal.java    From react-native-audio-streaming with MIT License 7 votes vote down vote up
@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
    switch (what) {
        case MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK:
            //Log.v("ERROR", "MEDIA ERROR NOT VALID FOR PROGRESSIVE PLAYBACK "	+ extra);
            break;
        case MediaPlayer.MEDIA_ERROR_SERVER_DIED:
            //Log.v("ERROR", "MEDIA ERROR SERVER DIED " + extra);
            break;
        case MediaPlayer.MEDIA_ERROR_UNKNOWN:
            //Log.v("ERROR", "MEDIA ERROR UNKNOWN " + extra);
            break;
    }
    sendBroadcast(new Intent(Mode.ERROR));
    return false;
}
 
Example 2
Source File: AudioService.java    From CodenameOne with GNU General Public License v2.0 6 votes vote down vote up
@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
    MediaErrorEvent evt = fireMediaError(AndroidImplementation.createMediaException(extra));
    fireMediaStateChange(State.Playing);
    fireMediaStateChange(State.Paused);
    if (!evt.isConsumed()) {
        switch (what) {
            case MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK:
                Toast.makeText(AudioService.this,
                        "MEDIA ERROR NOT VALID FOR PROGRESSIVE PLAYBACK " + extra,
                        Toast.LENGTH_SHORT).show();
                break;
            case MediaPlayer.MEDIA_ERROR_SERVER_DIED:
                Toast.makeText(AudioService.this, "MEDIA ERROR SERVER DIED " + extra,
                        Toast.LENGTH_SHORT).show();
                break;
            case MediaPlayer.MEDIA_ERROR_UNKNOWN:
                Toast.makeText(AudioService.this, "MEDIA ERROR UNKNOWN " + extra,
                        Toast.LENGTH_SHORT).show();
                break;
        }
    }
    return false;
}
 
Example 3
Source File: Signal.java    From react-native-android-audio-streaming-aac with MIT License 6 votes vote down vote up
@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
	switch (what) {
	case MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK:
		//Log.v("ERROR", "MEDIA ERROR NOT VALID FOR PROGRESSIVE PLAYBACK "	+ extra);
		break;
	case MediaPlayer.MEDIA_ERROR_SERVER_DIED:
		//Log.v("ERROR", "MEDIA ERROR SERVER DIED " + extra);
		break;
	case MediaPlayer.MEDIA_ERROR_UNKNOWN:
		//Log.v("ERROR", "MEDIA ERROR UNKNOWN " + extra);
		break;
	}
   sendBroadcast(new Intent(Mode.ERROR));
	return false;
}
 
Example 4
Source File: ParsingPlayerProxy.java    From ParsingPlayer with GNU Lesser General Public License v2.1 6 votes vote down vote up
private String errToStr(int framework_err, int impl_err) {
    String msg = null;
    if (framework_err == MediaPlayer.MEDIA_ERROR_IO) {
        msg = "IO Error";
    } else if (framework_err == MediaPlayer.MEDIA_ERROR_MALFORMED) {
        msg = "Bitstream unsupported";
    } else if (framework_err == MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK) {
        msg = "Invalid progressive playback";
    } else if (framework_err == MediaPlayer.MEDIA_ERROR_TIMED_OUT) {
        msg = "Operation time out";
    } else if (framework_err == MediaPlayer.MEDIA_ERROR_SERVER_DIED) {
        msg = "MediaPlayer died";
    } else if (framework_err == MediaPlayer.MEDIA_ERROR_UNSUPPORTED) {
        msg = "File spec is not supported in the media framework";
    } else if (framework_err == MediaPlayer.MEDIA_ERROR_UNKNOWN) {
        msg = "Unknown error";
    }
    return msg;
}
 
Example 5
Source File: MediaPlayerListener.java    From android-chromium with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
    int errorType;
    switch (what) {
        case MediaPlayer.MEDIA_ERROR_UNKNOWN:
            switch (extra) {
                case MEDIA_ERROR_MALFORMED:
                    errorType = MEDIA_ERROR_DECODE;
                    break;
                case MEDIA_ERROR_TIMED_OUT:
                    errorType = MEDIA_ERROR_INVALID_CODE;
                    break;
                default:
                    errorType = MEDIA_ERROR_FORMAT;
                    break;
            }
            break;
        case MediaPlayer.MEDIA_ERROR_SERVER_DIED:
            errorType = MEDIA_ERROR_DECODE;
            break;
        case MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK:
            errorType = MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK;
            break;
        default:
            // There are some undocumented error codes for android media player.
            // For example, when surfaceTexture got deleted before we setVideoSuface
            // to NULL, mediaplayer will report error -38. These errors should be ignored
            // and not be treated as an error to webkit.
            errorType = MEDIA_ERROR_INVALID_CODE;
            break;
    }
    nativeOnMediaError(mNativeMediaPlayerListener, errorType);
    return true;
}
 
Example 6
Source File: StreamService.java    From example with Apache License 2.0 5 votes vote down vote up
@Override
public boolean onError(MediaPlayer mediaPlayer, int what, int extra) {
    switch (what) {
        case MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK:
            Toast.makeText(this, "Error not valid playback", Toast.LENGTH_SHORT).show();
            break;
        case MediaPlayer.MEDIA_ERROR_SERVER_DIED:
            Toast.makeText(this, "Error server died", Toast.LENGTH_SHORT).show();
            break;
        case MediaPlayer.MEDIA_ERROR_UNKNOWN:
            Toast.makeText(this, "Error unknown", Toast.LENGTH_SHORT).show();
            break;
    }
    return false;
}
 
Example 7
Source File: IjkVideoView.java    From TvPlayer with Apache License 2.0 4 votes vote down vote up
public boolean onError(IMediaPlayer mp, int framework_err, int impl_err) {
                    //Log.d(TAG, "Error: " + framework_err + "," + impl_err);
                    mCurrentState = STATE_ERROR;
                    mTargetState = STATE_ERROR;
                    if (mMediaController != null) {
                        mMediaController.hide();
                    }

                    /* If an error handler has been supplied, use it and finish. */
                    if (mOnErrorListener != null) {
                        if (mOnErrorListener.onError(mMediaPlayer, framework_err, impl_err)) {
                            return true;
                        }
                    }

                    /* Otherwise, pop up an error dialog so the user knows that
                     * something bad has happened. Only try and pop up the dialog
                     * if we're attached to a window. When we're going away and no
                     * longer have a window, don't bother showing the user an error.
                     */
                    if (getWindowToken() != null) {
                        Resources r = mAppContext.getResources();
                        int messageId;

                        if (framework_err == MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK) {
                            messageId = R.string.VideoView_error_text_invalid_progressive_playback;
                        } else {
                            messageId = R.string.VideoView_error_text_unknown;
                        }

//                        new AlertDialog.Builder(getContext())
//                                .setMessage(messageId)
//                                .setPositiveButton(R.string.VideoView_error_button,
//                                        new DialogInterface.OnClickListener() {
//                                            public void onClick(DialogInterface dialog, int whichButton) {
//                                            /* If we get here, there is no onError listener, so
//                                             * at least inform them that the video is over.
//                                             */
//                                                if (mOnCompletionListener != null) {
//                                                    mOnCompletionListener.onCompletion(mMediaPlayer);
//                                                }
//                                            }
//                                        })
//                                .setCancelable(false)
//                                .show();
                    }
                    return true;
                }
 
Example 8
Source File: IjkVideoView.java    From IjkPlayerDemo with Apache License 2.0 4 votes vote down vote up
public boolean onError(IMediaPlayer mp, int framework_err, int impl_err) {
    Log.d(TAG, "Error: " + framework_err + "," + impl_err);
    mCurrentState = STATE_ERROR;
    mTargetState = STATE_ERROR;
    if (mMediaController != null) {
        mMediaController.hide();
    }

    /* If an error handler has been supplied, use it and finish. */
    if (mOnErrorListener != null) {
        if (mOnErrorListener.onError(mMediaPlayer, framework_err, impl_err)) {
            return true;
        }
    }

    /* Otherwise, pop up an error dialog so the user knows that
     * something bad has happened. Only try and pop up the dialog
     * if we're attached to a window. When we're going away and no
     * longer have a window, don't bother showing the user an error.
     */
    if (getWindowToken() != null) {
        Resources r = mAppContext.getResources();
        String message="Unknown error";

        if (framework_err == MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK) {
            message="Invalid progressive playback";
        }

        new AlertDialog.Builder(getContext())
                .setMessage(message)
                .setPositiveButton("error",
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int whichButton) {
                            /* If we get here, there is no onError listener, so
                             * at least inform them that the video is over.
                             */
                                if (mOnCompletionListener != null) {
                                    mOnCompletionListener.onCompletion(mMediaPlayer);
                                }
                            }
                        })
                .setCancelable(false)
                .show();
    }
    return true;
}
 
Example 9
Source File: IjkVideoView.java    From ZZShow with Apache License 2.0 4 votes vote down vote up
public boolean onError(IMediaPlayer mp, int framework_err, int impl_err) {
    Log.d(TAG, "Error: " + framework_err + "," + impl_err);
    mCurrentState = STATE_ERROR;
    mTargetState = STATE_ERROR;
    if (mMediaController != null) {
        mMediaController.hide();
    }

    /* If an error handler has been supplied, use it and finish. */
    if (mOnErrorListener != null) {
        if (mOnErrorListener.onError(mMediaPlayer, framework_err, impl_err)) {
            return true;
        }
    }

    /* Otherwise, pop up an error dialog so the user knows that
     * something bad has happened. Only try and pop up the dialog
     * if we're attached to a window. When we're going away and no
     * longer have a window, don't bother showing the user an error.
     */
    if (getWindowToken() != null) {
        Resources r = mAppContext.getResources();
        int messageId;

        if (framework_err == MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK) {
            messageId = R.string.VideoView_error_text_invalid_progressive_playback;
        } else {
            messageId = R.string.VideoView_error_text_unknown;
        }

        new AlertDialog.Builder(getContext())
                .setMessage(messageId)
                .setPositiveButton(R.string.VideoView_error_button,
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int whichButton) {
                            /* If we get here, there is no onError listener, so
                             * at least inform them that the video is over.
                             */
                                if (mOnCompletionListener != null) {
                                    mOnCompletionListener.onCompletion(mMediaPlayer);
                                }
                            }
                        })
                .setCancelable(false)
                .show();
    }
    return true;
}
 
Example 10
Source File: IjkVideoView.java    From MD with Apache License 2.0 4 votes vote down vote up
public boolean onError(IMediaPlayer mp, int framework_err, int impl_err) {
    Log.d(TAG, "Error: " + framework_err + "," + impl_err);
    mCurrentState = STATE_ERROR;
    mTargetState = STATE_ERROR;
    if (mMediaController != null) {
        mMediaController.hide();
    }

    /* If an error handler has been supplied, use it and finish. */
    if (mOnErrorListener != null) {
        if (mOnErrorListener.onError(mMediaPlayer, framework_err, impl_err)) {
            return true;
        }
    }

    /* Otherwise, pop up an error dialog so the user knows that
     * something bad has happened. Only try and pop up the dialog
     * if we're attached to a window. When we're going away and no
     * longer have a window, don't bother showing the user an error.
     */
    if (getWindowToken() != null) {
        Resources r = mAppContext.getResources();
        int messageId;

        if (framework_err == MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK) {
            messageId = R.string.VideoView_error_text_invalid_progressive_playback;
        } else {
            messageId = R.string.VideoView_error_text_unknown;
        }

        new AlertDialog.Builder(getContext())
                .setMessage(messageId)
                .setPositiveButton(R.string.VideoView_error_button,
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int whichButton) {
                            /* If we get here, there is no onError listener, so
                             * at least inform them that the video is over.
                             */
                                if (mOnCompletionListener != null) {
                                    mOnCompletionListener.onCompletion(mMediaPlayer);
                                }
                            }
                        })
                .setCancelable(false)
                .show();
    }
    return true;
}
 
Example 11
Source File: ErrorFactory.java    From no-player with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings({"PMD.StdCyclomaticComplexity", "PMD.CyclomaticComplexity"})
public static NoPlayer.PlayerError createErrorFrom(int type, int extra) {
    String message = String.valueOf(extra);
    switch (type) {
        case MediaPlayer.MEDIA_ERROR_IO:
            return new NoPlayerError(PlayerErrorType.SOURCE, DetailErrorType.MEDIA_PLAYER_IO, message);
        case MediaPlayer.MEDIA_ERROR_MALFORMED:
            return new NoPlayerError(PlayerErrorType.SOURCE, DetailErrorType.MEDIA_PLAYER_MALFORMED, message);
        case MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK:
            return new NoPlayerError(PlayerErrorType.SOURCE, DetailErrorType.MEDIA_PLAYER_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK, message);
        case MediaPlayer.MEDIA_INFO_NOT_SEEKABLE:
            return new NoPlayerError(PlayerErrorType.SOURCE, DetailErrorType.MEDIA_PLAYER_INFO_NOT_SEEKABLE, message);
        case MediaPlayer.MEDIA_INFO_SUBTITLE_TIMED_OUT:
            return new NoPlayerError(PlayerErrorType.SOURCE, DetailErrorType.MEDIA_PLAYER_SUBTITLE_TIMED_OUT, message);
        case MediaPlayer.MEDIA_INFO_UNSUPPORTED_SUBTITLE:
            return new NoPlayerError(PlayerErrorType.SOURCE, DetailErrorType.MEDIA_PLAYER_UNSUPPORTED_SUBTITLE, message);

        case MediaPlayer.MEDIA_ERROR_SERVER_DIED:
            return new NoPlayerError(PlayerErrorType.DRM, DetailErrorType.MEDIA_PLAYER_SERVER_DIED, message);
        case MediaPlayer.PREPARE_DRM_STATUS_PREPARATION_ERROR:
            return new NoPlayerError(PlayerErrorType.DRM, DetailErrorType.MEDIA_PLAYER_PREPARE_DRM_STATUS_PREPARATION_ERROR, message);
        case MediaPlayer.PREPARE_DRM_STATUS_PROVISIONING_NETWORK_ERROR:
            return new NoPlayerError(PlayerErrorType.DRM, DetailErrorType.MEDIA_PLAYER_PREPARE_DRM_STATUS_PROVISIONING_NETWORK_ERROR, message);
        case MediaPlayer.PREPARE_DRM_STATUS_PROVISIONING_SERVER_ERROR:
            return new NoPlayerError(PlayerErrorType.DRM, DetailErrorType.MEDIA_PLAYER_PREPARE_DRM_STATUS_PROVISIONING_SERVER_ERROR, message);

        case MediaPlayer.MEDIA_ERROR_TIMED_OUT:
            return new NoPlayerError(PlayerErrorType.CONNECTIVITY, DetailErrorType.MEDIA_PLAYER_TIMED_OUT, message);

        case MediaPlayer.MEDIA_INFO_AUDIO_NOT_PLAYING:
            return new NoPlayerError(PlayerErrorType.RENDERER_DECODER, DetailErrorType.MEDIA_PLAYER_INFO_AUDIO_NOT_PLAYING, message);
        case MediaPlayer.MEDIA_INFO_BAD_INTERLEAVING:
            return new NoPlayerError(PlayerErrorType.RENDERER_DECODER, DetailErrorType.MEDIA_PLAYER_BAD_INTERLEAVING, message);
        case MediaPlayer.MEDIA_INFO_VIDEO_NOT_PLAYING:
            return new NoPlayerError(PlayerErrorType.RENDERER_DECODER, DetailErrorType.MEDIA_PLAYER_INFO_VIDEO_NOT_PLAYING, message);
        case MediaPlayer.MEDIA_INFO_VIDEO_TRACK_LAGGING:
            return new NoPlayerError(PlayerErrorType.RENDERER_DECODER, DetailErrorType.MEDIA_PLAYER_INFO_VIDEO_TRACK_LAGGING, message);
        default:
            return new NoPlayerError(PlayerErrorType.UNKNOWN, DetailErrorType.MEDIA_PLAYER_UNKNOWN, message);

    }
}
 
Example 12
Source File: IjkVideoView.java    From LivePlayback with Apache License 2.0 4 votes vote down vote up
public boolean onError(IMediaPlayer mp, int framework_err, int impl_err) {
                    //Log.d(TAG, "Error: " + framework_err + "," + impl_err);
                    mCurrentState = STATE_ERROR;
                    mTargetState = STATE_ERROR;
                    if (mMediaController != null) {
                        mMediaController.hide();
                    }

                    /* If an error handler has been supplied, use it and finish. */
                    if (mOnErrorListener != null) {
                        if (mOnErrorListener.onError(mMediaPlayer, framework_err, impl_err)) {
                            return true;
                        }
                    }

                    /* Otherwise, pop up an error dialog so the user knows that
                     * something bad has happened. Only try and pop up the dialog
                     * if we're attached to a window. When we're going away and no
                     * longer have a window, don't bother showing the user an error.
                     */
                    if (getWindowToken() != null) {
                        Resources r = mAppContext.getResources();
                        int messageId;

                        if (framework_err == MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK) {
                            messageId = R.string.VideoView_error_text_invalid_progressive_playback;
                        } else {
                            messageId = R.string.VideoView_error_text_unknown;
                        }

//                        new AlertDialog.Builder(getContext())
//                                .setMessage(messageId)
//                                .setPositiveButton(R.string.VideoView_error_button,
//                                        new DialogInterface.OnClickListener() {
//                                            public void onClick(DialogInterface dialog, int whichButton) {
//                                            /* If we get here, there is no onError listener, so
//                                             * at least inform them that the video is over.
//                                             */
//                                                if (mOnCompletionListener != null) {
//                                                    mOnCompletionListener.onCompletion(mMediaPlayer);
//                                                }
//                                            }
//                                        })
//                                .setCancelable(false)
//                                .show();
                    }
                    return true;
                }
 
Example 13
Source File: MediaPlayerView.java    From HeroVideo-master with Apache License 2.0 4 votes vote down vote up
public boolean onError(IMediaPlayer mp, int framework_err, int impl_err) {
    Log.d(TAG, "Error: " + framework_err + "," + impl_err);
    mCurrentState = STATE_ERROR;
    mTargetState = STATE_ERROR;
    if (mMediaController != null) {
        mMediaController.hide();
    }

    /* If an error handler has been supplied, use it and finish. */
    if (mOnErrorListener != null) {
        if (mOnErrorListener.onError(mMediaPlayer, framework_err, impl_err)) {
            return true;
        }
    }

    /* Otherwise, pop up an error dialog so the user knows that
     * something bad has happened. Only try and pop up the dialog
     * if we're attached to a window. When we're going away and no
     * longer have a window, don't bother showing the user an error.
     */
    if (getWindowToken() != null) {
        Resources r = mAppContext.getResources();
        String message="Unknown error";

        if (framework_err == MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK) {
            message="Invalid progressive playback";
        }

        new AlertDialog.Builder(getContext())
                .setMessage(message)
                .setPositiveButton("error",
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int whichButton) {
                            /* If we get here, there is no onError listener, so
                             * at least inform them that the video is over.
                             */
                                if (mOnCompletionListener != null) {
                                    mOnCompletionListener.onCompletion(mMediaPlayer);
                                }
                            }
                        })
                .setCancelable(false)
                .show();
    }
    return true;
}
 
Example 14
Source File: IjkVideoView.java    From MKVideoPlayer with MIT License 4 votes vote down vote up
public boolean onError(IMediaPlayer mp, int framework_err, int impl_err) {
    Log.d(TAG, "Error: " + framework_err + "," + impl_err);
    mCurrentState = STATE_ERROR;
    mTargetState = STATE_ERROR;
    if (mMediaController != null) {
        mMediaController.hide();
    }

    /* If an error handler has been supplied, use it and finish. */
    if (mOnErrorListener != null) {
        if (mOnErrorListener.onError(mMediaPlayer, framework_err, impl_err)) {
            return true;
        }
    }

    /* Otherwise, pop up an error dialog so the user knows that
     * something bad has happened. Only try and pop up the dialog
     * if we're attached to a window. When we're going away and no
     * longer have a window, don't bother showing the user an error.
     */
    if (getWindowToken() != null) {
        Resources r = mAppContext.getResources();
        String message="Unknown error";

        if (framework_err == MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK) {
            message="Invalid progressive playback";
        }

        new AlertDialog.Builder(getContext())
                .setMessage(message)
                .setPositiveButton("error",
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int whichButton) {
                            /* If we get here, there is no onError listener, so
                             * at least inform them that the video is over.
                             */
                                if (mOnCompletionListener != null) {
                                    mOnCompletionListener.onCompletion(mMediaPlayer);
                                }
                            }
                        })
                .setCancelable(false)
                .show();
    }
    return true;
}
 
Example 15
Source File: IjkVideoView.java    From WliveTV with Apache License 2.0 4 votes vote down vote up
public boolean onError(IMediaPlayer mp, int framework_err, int impl_err) {
                    //Log.d(TAG, "Error: " + framework_err + "," + impl_err);
                    mCurrentState = STATE_ERROR;
                    mTargetState = STATE_ERROR;
                    if (mMediaController != null) {
                        mMediaController.hide();
                    }

                    /* If an error handler has been supplied, use it and finish. */
                    if (mOnErrorListener != null) {
                        if (mOnErrorListener.onError(mMediaPlayer, framework_err, impl_err)) {
                            return true;
                        }
                    }

                    /* Otherwise, pop up an error dialog so the user knows that
                     * something bad has happened. Only try and pop up the dialog
                     * if we're attached to a window. When we're going away and no
                     * longer have a window, don't bother showing the user an error.
                     */
                    if (getWindowToken() != null) {
                        Resources r = mAppContext.getResources();
                        int messageId;

                        if (framework_err == MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK) {
                            messageId = R.string.VideoView_error_text_invalid_progressive_playback;
                        } else {
                            messageId = R.string.VideoView_error_text_unknown;
                        }

//                        new AlertDialog.Builder(getContext())
//                                .setMessage(messageId)
//                                .setPositiveButton(R.string.VideoView_error_button,
//                                        new DialogInterface.OnClickListener() {
//                                            public void onClick(DialogInterface dialog, int whichButton) {
//                                            /* If we get here, there is no onError listener, so
//                                             * at least inform them that the video is over.
//                                             */
//                                                if (mOnCompletionListener != null) {
//                                                    mOnCompletionListener.onCompletion(mMediaPlayer);
//                                                }
//                                            }
//                                        })
//                                .setCancelable(false)
//                                .show();
                    }
                    return true;
                }
 
Example 16
Source File: IjkVideoView.java    From ShareBox with Apache License 2.0 4 votes vote down vote up
public boolean onError(IMediaPlayer mp, int framework_err, int impl_err) {
    Log.d(TAG, "Error: " + framework_err + "," + impl_err);
    mCurrentState = STATE_ERROR;
    mTargetState = STATE_ERROR;
    if (mMediaController != null) {
        mMediaController.hide();
    }

    /* If an error handler has been supplied, use it and finish. */
    if (mOnErrorListener != null) {
        if (mOnErrorListener.onError(mMediaPlayer, framework_err, impl_err)) {
            return true;
        }
    }

    /* Otherwise, pop up an error dialog so the user knows that
     * something bad has happened. Only try and pop up the dialog
     * if we're attached to a window. When we're going away and no
     * longer have a window, don't bother showing the user an error.
     */
    if (getWindowToken() != null) {
        Resources r = mAppContext.getResources();
        int messageId;

        if (framework_err == MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK) {
            messageId = R.string.VideoView_error_text_invalid_progressive_playback;
        } else {
            messageId = R.string.VideoView_error_text_unknown;
        }

        new AlertDialog.Builder(getContext())
                .setMessage(messageId)
                .setPositiveButton(R.string.VideoView_error_button,
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int whichButton) {
                            /* If we get here, there is no onError listener, so
                             * at least inform them that the video is over.
                             */
                                if (mOnCompletionListener != null) {
                                    mOnCompletionListener.onCompletion(mMediaPlayer);
                                }
                            }
                        })
                .setCancelable(false)
                .show();
    }
    return true;
}
 
Example 17
Source File: PlayerView.java    From VRPlayer with Apache License 2.0 4 votes vote down vote up
public boolean onError(IMediaPlayer mp, int framework_err, int impl_err) {
    Log.d(TAG, "Error: " + framework_err + "," + impl_err);
    mCurrentState = STATE_ERROR;
    mTargetState = STATE_ERROR;
    if (mMediaController != null) {
        mMediaController.hide();
    }

    /* If an error handler has been supplied, use it and finish. */
    if (mOnErrorListener != null) {
        if (mOnErrorListener.onError(mMediaPlayer, framework_err, impl_err)) {
            return true;
        }
    }

    /* Otherwise, pop up an error dialog so the user knows that
     * something bad has happened. Only try and pop up the dialog
     * if we're attached to a window. When we're going away and no
     * longer have a window, don't bother showing the user an error.
     */
    if (getWindowToken() != null) {
        Resources r = mAppContext.getResources();
        int messageId;

        if (framework_err == MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK) {
            messageId = R.string.VideoView_error_text_invalid_progressive_playback;
        } else {
            messageId = R.string.VideoView_error_text_unknown;
        }

        new AlertDialog.Builder(getContext())
                .setMessage(messageId)
                .setPositiveButton(R.string.VideoView_error_button,
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int whichButton) {
                            /* If we get here, there is no onError listener, so
                             * at least inform them that the video is over.
                             */
                                if (mOnCompletionListener != null) {
                                    mOnCompletionListener.onCompletion(mMediaPlayer);
                                }
                            }
                        })
                .setCancelable(false)
                .show();
    }
    return true;
}
 
Example 18
Source File: IjkVideoView.java    From GiraffePlayer with Apache License 2.0 4 votes vote down vote up
public boolean onError(IMediaPlayer mp, int framework_err, int impl_err) {
    Log.d(TAG, "Error: " + framework_err + "," + impl_err);
    mCurrentState = STATE_ERROR;
    mTargetState = STATE_ERROR;
    if (mMediaController != null) {
        mMediaController.hide();
    }

    /* If an error handler has been supplied, use it and finish. */
    if (mOnErrorListener != null) {
        if (mOnErrorListener.onError(mMediaPlayer, framework_err, impl_err)) {
            return true;
        }
    }

    /* Otherwise, pop up an error dialog so the user knows that
     * something bad has happened. Only try and pop up the dialog
     * if we're attached to a window. When we're going away and no
     * longer have a window, don't bother showing the user an error.
     */
    if (getWindowToken() != null) {
        Resources r = mAppContext.getResources();
        String message="Unknown error";

        if (framework_err == MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK) {
            message="Invalid progressive playback";
        }

        new AlertDialog.Builder(getContext())
                .setMessage(message)
                .setPositiveButton("error",
                        new DialogInterface.OnClickListener() {
                            public void onClick(DialogInterface dialog, int whichButton) {
                            /* If we get here, there is no onError listener, so
                             * at least inform them that the video is over.
                             */
                                if (mOnCompletionListener != null) {
                                    mOnCompletionListener.onCompletion(mMediaPlayer);
                                }
                            }
                        })
                .setCancelable(false)
                .show();
    }
    return true;
}
 
Example 19
Source File: TextureVideoView.java    From texturevideoview with Apache License 2.0 4 votes vote down vote up
public boolean onError(MediaPlayer mp, int framework_err, int impl_err) {
        Log.d(TAG, "Error: " + framework_err + "," + impl_err);
        mCurrentState = STATE_ERROR;
        mTargetState = STATE_ERROR;
        if (mMediaController != null) {
            mMediaController.hide();
        }

/* If an error handler has been supplied, use it and finish. */
        if (mOnErrorListener != null) {
            if (mOnErrorListener.onError(mMediaPlayer, framework_err, impl_err)) {
                return true;
            }
        }

/* Otherwise, pop up an error dialog so the user knows that
 * something bad has happened. Only try and pop up the dialog
 * if we're attached to a window. When we're going away and no
 * longer have a window, don't bother showing the user an error.
 */
        if (getWindowToken() != null) {
            Resources r = getContext().getResources();
            int messageId;

            if (framework_err == MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK) {
                messageId = android.R.string.VideoView_error_text_invalid_progressive_playback;
            } else {
                messageId = android.R.string.VideoView_error_text_unknown;
            }

            new AlertDialog.Builder(getContext())
                    .setMessage(messageId)
                    .setPositiveButton(android.R.string.VideoView_error_button,
                            new DialogInterface.OnClickListener() {
                                public void onClick(DialogInterface dialog, int whichButton) {
                            /* If we get here, there is no onError listener, so
                             * at least inform them that the video is over.
                             */
                                    if (mOnCompletionListener != null) {
                                        mOnCompletionListener.onCompletion(mMediaPlayer);
                                    }
                                }
                            })
                    .setCancelable(false)
                    .show();
        }
        return true;
    }