Example usage for android.media MediaPlayer MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

List of usage examples for android.media MediaPlayer MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

Introduction

In this page you can find the example usage for android.media MediaPlayer MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK.

Prototype

int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK

To view the source code for android.media MediaPlayer MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK.

Click Source Link

Document

The video is streamed and its container is not valid for progressive playback i.e the video's index (e.g moov atom) is not at the start of the file.

Usage

From source file:com.qweex.callisto.Live.java

/** Initiates the live player. Can be called across activities. */
static public void LIVE_Init() {
    String TAG = StaticBlob.TAG();
    Log.d(TAG, "Initiating the live player.");
    live_player = new MediaPlayer();
    Log.d(TAG, "Initiating the live player.");
    live_player.setAudioStreamType(AudioManager.STREAM_MUSIC);
    Log.d(TAG, "Initiating the live player.");
    live_player.setOnErrorListener(new MediaPlayer.OnErrorListener() {
        public boolean onError(MediaPlayer mp, int what, int extra) {
            if (LIVE_PreparedListener.pd != null)
                LIVE_PreparedListener.pd.hide();
            String whatWhat = "";
            switch (what) {
            case MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK:
                whatWhat = "MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK";
                break;
            case MediaPlayer.MEDIA_ERROR_SERVER_DIED:
                whatWhat = "MEDIA_ERROR_SERVER_DIED";
                break;
            case MediaPlayer.MEDIA_ERROR_UNKNOWN:
                whatWhat = "MEDIA_ERROR_UNKNOWN";
                break;
            default:
                whatWhat = "???";
                return true;
            }//from  ww  w .j  a va  2 s.co m
            try {
                if (StaticBlob.errorDialog != null)
                    StaticBlob.errorDialog.show();
            } catch (Exception e) {
            }

            try {
                SendErrorReport(whatWhat);
            } catch (Exception e) {
            }
            return true;
        }
    });
    Log.d(TAG, "Initiating the live player.");
}

From source file:com.owncloud.android.media.MediaService.java

/**
 * Helper method to get an error message suitable to show to users for errors occurred in media playback,
 * /*from  ww  w . j ava2 s.c  o m*/
 * @param context   A context to access string resources.
 * @param what      See {@link MediaPlayer.OnErrorListener#onError(MediaPlayer, int, int)
 * @param extra     See {@link MediaPlayer.OnErrorListener#onError(MediaPlayer, int, int)
 * @return          Message suitable to users.
 */
public static String getMessageForMediaError(Context context, int what, int extra) {
    int messageId;

    if (what == OC_MEDIA_ERROR) {
        messageId = extra;

    } else if (extra == MediaPlayer.MEDIA_ERROR_UNSUPPORTED) {
        /*  Added in API level 17
        Bitstream is conforming to the related coding standard or file spec,
        but the media framework does not support the feature.
        Constant Value: -1010 (0xfffffc0e)
         */
        messageId = R.string.media_err_unsupported;

    } else if (extra == MediaPlayer.MEDIA_ERROR_IO) {
        /*  Added in API level 17
        File or network related operation errors.
        Constant Value: -1004 (0xfffffc14) 
         */
        messageId = R.string.media_err_io;

    } else if (extra == MediaPlayer.MEDIA_ERROR_MALFORMED) {
        /*  Added in API level 17
        Bitstream is not conforming to the related coding standard or file spec.
        Constant Value: -1007 (0xfffffc11) 
         */
        messageId = R.string.media_err_malformed;

    } else if (extra == MediaPlayer.MEDIA_ERROR_TIMED_OUT) {
        /*  Added in API level 17
        Some operation takes too long to complete, usually more than 3-5 seconds.
        Constant Value: -110 (0xffffff92)
        */
        messageId = R.string.media_err_timeout;

    } else if (what == MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK) {
        /*  Added in API level 3
        The video is streamed and its container is not valid for progressive playback i.e the video's index
        (e.g moov atom) is not at the start of the file.
        Constant Value: 200 (0x000000c8)
        */
        messageId = R.string.media_err_invalid_progressive_playback;

    } else {
        /*  MediaPlayer.MEDIA_ERROR_UNKNOWN
        Added in API level 1
        Unspecified media player error.
        Constant Value: 1 (0x00000001)
        */
        /*  MediaPlayer.MEDIA_ERROR_SERVER_DIED)
        Added in API level 1
        Media server died. In this case, the application must release the MediaPlayer
        object and instantiate a new one.
        Constant Value: 100 (0x00000064) 
         */
        messageId = R.string.media_err_unknown;
    }
    return context.getString(messageId);
}

From source file:at.wada811.app.fragment.VideoFragment.java

private void initMediaPlayer() {
    LogUtils.i();/* w w  w  .j ava  2  s.  c om*/
    if (getArguments().keySet().contains(KEY_RES_ID)) {
        mMediaPlayer = MediaPlayer.create(getActivity(), getArguments().getInt(KEY_RES_ID));
    } else {
        mMediaPlayer = new MediaPlayer();
    }
    mMediaPlayer.setOnVideoSizeChangedListener(this);
    mMediaPlayer.setOnBufferingUpdateListener(this);
    mMediaPlayer.setOnPreparedListener(this);
    mMediaPlayer.setOnCompletionListener(this);
    mMediaPlayer.setAudioStreamType(AudioManager.STREAM_MUSIC);
    mMediaPlayer.setOnInfoListener(new OnInfoListener() {
        @Override
        public boolean onInfo(MediaPlayer mp, int what, int extra) {
            switch (what) {
            case MediaPlayer.MEDIA_INFO_BAD_INTERLEAVING:
                LogUtils.i("MediaPlayer.MEDIA_INFO_BAD_INTERLEAVING");
                break;
            case MediaPlayer.MEDIA_INFO_BUFFERING_END:
                LogUtils.i("MediaPlayer.MEDIA_INFO_BUFFERING_END");
                break;
            case MediaPlayer.MEDIA_INFO_BUFFERING_START:
                LogUtils.i("MediaPlayer.MEDIA_INFO_BUFFERING_START");
                break;
            case MediaPlayer.MEDIA_INFO_METADATA_UPDATE:
                LogUtils.i("MediaPlayer.MEDIA_INFO_METADATA_UPDATE");
                break;
            case MediaPlayer.MEDIA_INFO_NOT_SEEKABLE:
                LogUtils.i("MediaPlayer.MEDIA_INFO_NOT_SEEKABLE");
                break;
            case MediaPlayer.MEDIA_INFO_SUBTITLE_TIMED_OUT:
                LogUtils.i("MediaPlayer.MEDIA_INFO_SUBTITLE_TIMED_OUT");
                break;
            case MediaPlayer.MEDIA_INFO_UNSUPPORTED_SUBTITLE:
                LogUtils.i("MediaPlayer.MEDIA_INFO_UNSUPPORTED_SUBTITLE");
                break;
            case MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START:
                LogUtils.i("MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START");
                break;
            case MediaPlayer.MEDIA_INFO_VIDEO_TRACK_LAGGING:
                LogUtils.i("MediaPlayer.MEDIA_INFO_VIDEO_TRACK_LAGGING");
                break;
            case MediaPlayer.MEDIA_INFO_UNKNOWN:
            default:
                LogUtils.i("MediaPlayer.MEDIA_INFO_UNKNOWN");
                break;
            }
            LogUtils.d("extra: " + extra);
            return false;
        }
    });
    mMediaPlayer.setOnErrorListener(new OnErrorListener() {
        @Override
        public boolean onError(MediaPlayer mp, int what, int extra) {
            switch (what) {
            case MediaPlayer.MEDIA_ERROR_SERVER_DIED:
                LogUtils.e("MediaPlayer.MEDIA_ERROR_SERVER_DIED");
                break;
            case MediaPlayer.MEDIA_ERROR_UNKNOWN:
            default:
                LogUtils.e("MediaPlayer.MEDIA_ERROR_UNKNOWN");
                break;
            }
            switch (extra) {
            case MediaPlayer.MEDIA_ERROR_IO:
                LogUtils.e("MediaPlayer.MEDIA_ERROR_IO");
                break;
            case MediaPlayer.MEDIA_ERROR_MALFORMED:
                LogUtils.e("MediaPlayer.MEDIA_ERROR_MALFORMED");
                break;
            case MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK:
                LogUtils.e("MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK");
                break;
            case MediaPlayer.MEDIA_ERROR_TIMED_OUT:
                LogUtils.e("MediaPlayer.MEDIA_ERROR_TIMED_OUT");
                break;
            case MediaPlayer.MEDIA_ERROR_UNSUPPORTED:
                LogUtils.e("MediaPlayer.MEDIA_ERROR_UNSUPPORTED");
                break;
            default:
                LogUtils.e("extra: " + extra);
                break;
            }
            return false;
        }
    });
    mCallback.onActivityCreated(this);
}

From source file:com.sourceauditor.sahomemonitor.MainActivity.java

@Override
public boolean onError(MediaPlayer mp, int what, int extra) {

    StringBuilder sb = new StringBuilder();
    sb.append("Error playing Audio stream from home: ");
    switch (what) {
    case MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK:
        sb.append("Not Valid for Progressive Playback");
        break;/* w  w w .  j av a 2s  .  co m*/
    case MediaPlayer.MEDIA_ERROR_SERVER_DIED:
        sb.append("Server Died");
        break;
    case MediaPlayer.MEDIA_ERROR_UNKNOWN:
        sb.append("Unknown");
        break;
    default:
        sb.append(" Unknow error (");
        sb.append(what);
        sb.append(")");
    }
    sb.append(extra);
    logAndDisplayError(sb.toString());
    return true;
}

From source file:leoisasmendi.android.com.suricatepodcast.services.MediaPlayerService.java

@Override
public boolean onError(MediaPlayer mp, int what, int extra) {
    //Invoked when there has been an error during an asynchronous operation
    Log.d(TAG, "onError: " + R.string.media_player_error_2);
    switch (what) {
    case MediaPlayer.MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK:
        Log.d("MediaPlayer Error", "MEDIA ERROR NOT VALID FOR PROGRESSIVE PLAYBACK " + extra);
        break;/*  w ww. j a  v a2 s  . c  o  m*/
    case MediaPlayer.MEDIA_ERROR_SERVER_DIED:
        Log.d("MediaPlayer Error", "MEDIA ERROR SERVER DIED " + extra);
        break;
    case MediaPlayer.MEDIA_ERROR_UNKNOWN:
        Log.d("MediaPlayer Error", "MEDIA ERROR UNKNOWN " + extra);
        break;
    }
    return false;
}