當前位置: 首頁>>代碼示例>>Java>>正文


Java OnErrorListener類代碼示例

本文整理匯總了Java中android.media.MediaPlayer.OnErrorListener的典型用法代碼示例。如果您正苦於以下問題:Java OnErrorListener類的具體用法?Java OnErrorListener怎麽用?Java OnErrorListener使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


OnErrorListener類屬於android.media.MediaPlayer包,在下文中一共展示了OnErrorListener類的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initPlayer

import android.media.MediaPlayer.OnErrorListener; //導入依賴的package包/類
public static void initPlayer(VideoView videoView, OnPreparedListener onPreparedListener,
                              OnCompletionListener onCompletionListener, OnErrorListener
                                      onErrorListener) {
    if (onPreparedListener != null) {
        videoView.setOnPreparedListener(onPreparedListener);
    }
    if (onCompletionListener != null) {
        videoView.setOnCompletionListener(onCompletionListener);
    }
    if (onErrorListener != null) {
        videoView.setOnErrorListener(onErrorListener);
    }
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:14,代碼來源:VideoPlayerManager.java

示例2: initVideoData

import android.media.MediaPlayer.OnErrorListener; //導入依賴的package包/類
private void initVideoData() {
    if (this.mentionIndex >= this.totalMetionCount) {
        lessonFinish();
        return;
    }
    this.currentMention = (Mention) this.mentionList.get(this.mentionIndex);
    this.videoPath = this.videoDownloadHelper.getVideoName(this.ctx, this.currentMention.id);
    this.videoView.setVideoPath(this.videoPath);
    this.videoView.setOnErrorListener(new OnErrorListener() {
        public boolean onError(MediaPlayer mediaPlayer, int i, int i1) {
            VideoPlayActivity.this.onPlayError();
            return true;
        }
    });
    this.videoView.setOnCompletionListener(new OnCompletionListener() {
        public void onCompletion(MediaPlayer mp) {
            if (VideoPlayActivity.this.currentMention.is_times && !VideoPlayActivity.this
                    .isMentionComplete() && VideoPlayActivity.this.isCounting) {
                VideoPlayActivity.this.handler.post(VideoPlayActivity.this.countDownRunnable);
                VideoPlayActivity.this.playCountNum = VideoPlayActivity.this.playCountNum + 1;
            }
            VideoPlayActivity.this.videoView.seekTo(0);
            VideoPlayActivity.this.videoView.start();
        }
    });
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:27,代碼來源:VideoPlayActivity.java

示例3: a

import android.media.MediaPlayer.OnErrorListener; //導入依賴的package包/類
public final void a(MediaPlayer.OnErrorListener paramOnErrorListener)
{
  this.e = paramOnErrorListener;
  if (this.c != null) {
    this.c.setOnErrorListener(this.e);
  }
}
 
開發者ID:ChiangC,項目名稱:FMTech,代碼行數:8,代碼來源:duy.java

示例4: resetVideoErrorListener

import android.media.MediaPlayer.OnErrorListener; //導入依賴的package包/類
public void resetVideoErrorListener() {
	videoView.setOnErrorListener(new OnErrorListener() {
		@Override
		public boolean onError(MediaPlayer mp, int what, int extra) {
			Log.wtf("Video error", "what:" + what + " extra:" + extra);
			videoError = true;
			return true;
		}
	});
}
 
開發者ID:BotLibre,項目名稱:BotLibre,代碼行數:11,代碼來源:ChatActivity.java

示例5: setOnErrorListener

import android.media.MediaPlayer.OnErrorListener; //導入依賴的package包/類
public void setOnErrorListener(OnErrorListener listener) {
	System.out.println("OnErrorList...");
	Platform.runLater(new Runnable() {
		@Override
		public void run() {
			try {
				if (mediaPlayer != null) {
					mediaPlayer.stop();
				}
			} catch (Exception e) {
				System.out.println("SetOnErrorListener\nError Player Video: " + e.toString());
			}
		}
	});
}
 
開發者ID:BotLibre,項目名稱:BotLibre,代碼行數:16,代碼來源:VideoView.java

示例6: resetVideoErrorListener2

import android.media.MediaPlayer.OnErrorListener; //導入依賴的package包/類
public void resetVideoErrorListener2() {
	video2View.setOnErrorListener(new OnErrorListener() {
		@Override
		public boolean onError(MediaPlayer mp, int what, int extra) {
			Log.wtf("Video error", "what:" + what + " extra:" + extra);
			videoError = true;
			return true;
		}
	});
}
 
開發者ID:BotLibre,項目名稱:BotLibre,代碼行數:11,代碼來源:WarActivity.java

示例7: init

import android.media.MediaPlayer.OnErrorListener; //導入依賴的package包/類
private void init() {
    MediaController mediaController = new MediaController(getContext());
    mediaController.setAnchorView(this);

    // Set OnCompletionListener to notify our listeners when the video is completed.
    super.setOnCompletionListener(new OnCompletionListener() {

        @Override
        public void onCompletion(MediaPlayer mediaPlayer) {
            // Reset the MediaPlayer.
            // This prevents a race condition which occasionally results in the media
            // player crashing when switching between videos.
            mediaPlayer.reset();
            mediaPlayer.setDisplay(getHolder());

            for (OnVideoCompletedListener listener : mOnVideoCompletedListeners) {
                listener.onVideoCompleted();
            }
        }
    });

    // Set OnErrorListener to notify our listeners if the video errors.
    super.setOnErrorListener(new OnErrorListener() {

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

            // Returning true signals to MediaPlayer that we handled the error. This will
            // prevent the completion handler from being called.
            return true;
        }
    });
}
 
開發者ID:googleads,項目名稱:googleads-ima-android,代碼行數:34,代碼來源:SampleVideoPlayer.java

示例8: init

import android.media.MediaPlayer.OnErrorListener; //導入依賴的package包/類
private void init(Context ctx, int resId) {
		name = ctx.getResources().getResourceName(resId);

		mPlayer = MediaPlayer.create(ctx, resId);
		// TODO: Quick hack! So that game won't crash if something weird is
		// going on... but find more robust way!
		if (mPlayer != null) {
			mPlayer.setOnErrorListener(new OnErrorListener() {
				@Override
				public boolean onError(MediaPlayer arg0, int arg1, int arg2) {
					Log.d("AudioClip", "MediaPlayer Error::arg1=" + arg1 + "   arg2=" + arg2);
					return false;
				}
			});
			mPlayer.setVolume(1000, 1000);

			mPlayer.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {

				public void onCompletion(MediaPlayer mp) {
					mPlaying = false;
//					if (mLoop) {
//						//Log.d("AudioClip","AudioClip loop " + name);
//						mPlaying = true;
//						mp.start();
//					}
				}

			});
		} else {

		}
	}
 
開發者ID:laurion,項目名稱:wabbit-client,代碼行數:33,代碼來源:AudioClip.java

示例9: setOnErrorListener

import android.media.MediaPlayer.OnErrorListener; //導入依賴的package包/類
public void setOnErrorListener(OnErrorListener l) {
    this.mOnErrorListener = l;
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:4,代碼來源:VideoViewH264m3u8.java

示例10: setOnErrorListener

import android.media.MediaPlayer.OnErrorListener; //導入依賴的package包/類
public void setOnErrorListener(OnErrorListener listener) {
    this.mOnErrorListener = listener;
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:4,代碼來源:FFMpegPlayer.java

示例11: setOnErrorListener

import android.media.MediaPlayer.OnErrorListener; //導入依賴的package包/類
public void setOnErrorListener(OnErrorListener l) {
}
 
開發者ID:pedroSG94,項目名稱:vlc-example-streamplayer,代碼行數:3,代碼來源:VideoView.java


注:本文中的android.media.MediaPlayer.OnErrorListener類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。