VideoView setOnErrorListener - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for VideoView setOnErrorListener method.

This code example shows how to use the following methods:setOnCompletionListener, setOnErrorListener
    public RhoVideoView(ViewGroup view, CustomViewCallback viewCallback) {
        mCustomView = view;
        mVideoView = (VideoView)view.getFocusedChild();
        mCustomViewCallback = viewCallback;
         
        mVideoView.setOnCompletionListener(this);
        mVideoView.setOnErrorListener(this);
    } 
     
    @Override 
    public boolean onError(MediaPlayer mp, int what, int extra) {
        Logger.E(TAG, "Media player error: " + ((what == MediaPlayer.MEDIA_ERROR_SERVER_DIED) ? "media server died" : "unknown"));
        return false; 
    } 
 
    @Override 
    public void onCompletion(MediaPlayer player) {
        player.stop();
    } 
 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setMediaController, setOnCompletionListener, setOnErrorListener, setOnPreparedListener
  public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) {
    final View view = inflater.inflate(R.layout.video_surface, container, false);
    this.progress = view.findViewById(R.id.progress);
    final VideoView videoView = (VideoView)view.findViewById(R.id.video);
    this.videoView = videoView;
    videoView.setOnPreparedListener(this);
    videoView.setOnErrorListener(this);
    videoView.setOnCompletionListener(this);
    this.controller = new MediaController(getOwnerActivity());
    videoView.setMediaController(controller);
    return view;
  } 
 
  @Override 
  public void onActivityCreated(final Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    openVideo(); 
  } 
 
  @Override 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setMediaController, setOnErrorListener, setOnPreparedListener, setVideoURI
 
		// Attach the controller to the video view 
		controller.setAnchorView(player);
		 
		// Setup the video player 
		player.setMediaController(controller);
		player.setVideoURI(mediaPath);
		player.setOnErrorListener(this);
		player.setOnPreparedListener(this);
	} 
	 
	public void pause() 
	{ 
		savedPosition = player.getCurrentPosition();
		player.pause();
	} 
	 
	public void resume() 
	{ 
		player.seekTo(savedPosition);
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:requestFocus, setMediaController, setOnCompletionListener, setOnErrorListener, setVideoPath
	 * @param 
	 */ 
	private void reproducirVideoView(String path){
		 
		//Elementos comunes a Audio/Video. 
		VVvideo.setVideoPath(path);
		 
		VVvideo.setMediaController(controlador);
		VVvideo.requestFocus();
		 
		VVvideo.setOnErrorListener(new OnErrorListener() {
			 
			public boolean onError(MediaPlayer mp, int what, int extra) {
				// TODO Auto-generated method stub 
				Toast.makeText(getActivity().getApplicationContext(), "Error al reproducir el video.",Toast.LENGTH_LONG).show();
				return false; 
			} 
		}); 
		 
		VVvideo.start();

5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setOnCompletionListener, setOnErrorListener, setOnPreparedListener
 
	} 
 
	private void addListener() 
	{ 
		mVideoView.setOnPreparedListener(new OnPreparedListener()
		{ 
			@Override 
			public void onPrepared(MediaPlayer mp)
			{ 
				// mVideoView.setBackgroundColor(Color.argb(0, 0, 255, 0)); 
				mVideoView.requestFocus();
 
			} 
		}); 
		mVideoView.setOnErrorListener(new OnErrorListener()
		{ 
			@Override 
			public boolean onError(MediaPlayer arg0, int arg1, int arg2)
			{ 

5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java

Related VideoView setOnErrorListener Questions & Answers: