Code example for MediaPlayer

Methods: resetstop

0
            mAudioSrvState = BUFFERING;
        } 
         
        public void onCompletion(MediaPlayer mp) {
            Log.i(TAG, "Completed playback");
            mMediaPlayer.stop();
            mMediaPlayer.reset();
            mAudioSrvState = NOT_PLAYING;
        } 
         
        public boolean onError(MediaPlayer mp, int what, int extra) {
            switch(what){
                case MediaPlayer.MEDIA_ERROR_UNKNOWN:
                    Log.e(TAG, "unknown media error what=["+what+"] extra=["+extra+"]");
                    break; 
                case MediaPlayer.MEDIA_ERROR_SERVER_DIED:
                    Log.e(TAG, "Streaming source Server died what=["+what+"] extra=["+extra+"]");
                    break; 
                default: 
                    Log.e(TAG, "Default Problems what=["+ what +"] extra=["+extra+"]");
            }