VideoView setOnPreparedListener - 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 setOnPreparedListener method.

This code example shows how to use the following methods:requestFocus, setOnCompletionListener, setOnPreparedListener, setVideoURI
		sMovie = this;
		 
		RelativeLayout layout = new RelativeLayout ( this );
		layout.setGravity ( Gravity.CENTER );
		 
		mVideoView = new VideoView ( this );
		mVideoView.setOnPreparedListener ( this );
        mVideoView.setOnCompletionListener ( this );
 
		layout.addView ( mVideoView, new RelativeLayout.LayoutParams ( LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT ));
		setContentView ( layout );		
		 
		String url = this.getIntent ().getStringExtra ( "url" );
		 
		MoaiLog.i ( "MoaiMoviePlayer onCreate: Initializing video player with media URL " + url );
 
		mVideoView.setVideoURI ( Uri.parse ( url ));
		mVideoView.requestFocus ();
	}	 
 

9
CodeRank
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
This code example shows how to use the following methods:requestFocus, setMediaController, setOnPreparedListener, setVideoURI, start
	@AfterViews 
	void updateContents() { 
		setVideoOnBackground(); 
		 
		incomingInfoTextView.setText(incomingPhoneNumber);
		myVideoView.requestFocus();
		myVideoView.start();
	} 
	 
	@Background 
	void setVideoOnBackground() { 
		Uri defaultVideofile = Uri.parse("android.resource://" + this.getPackageName() + "/raw/a");
	    myVideoView.setVideoURI(defaultVideofile);
	     
	    myVideoView.setMediaController(new MediaController(this));
 
		myVideoView.setOnPreparedListener(new OnPreparedListener() {
		    @Override 
		    public void onPrepared(MediaPlayer mp) {
		    	mp.setLooping(true);

6
CodeRank
This code example shows how to use the following methods:setMediaController, setOnCompletionListener, setOnPreparedListener, setVideoPath
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		appMediaPlayerFunctionLayoutParams = new AppMediaPlayerFunctionLayoutParams(this);
		appMediaPlayerFunctionLayoutParams.initParams();
		initLayoutAndCompont(); 
		mVideoView.setOnCompletionListener(this);
		mVideoView.setOnPreparedListener(this);
		if(!(getIntent().getAction() != null && getIntent().getAction().equals(Intent.ACTION_VIEW ))){
			 mVideoFileName = getIntent().getExtras().getString("file_name");
			 AppLog.e("mVideoFileName", mVideoFileName);
			 mVideoFilePosition = getIntent().getExtras().getInt("file_position");
		} 
		if (mVideoFileName == null)
		{ 
			mVideoFileName = getRealPath(getIntent().getData());
		} 
		mVideoView.setVideoPath(mVideoFileName);
		mVideoView.setMediaController(mController);
	} 
	AppMediaPlayerFunctionLayoutParams appMediaPlayerFunctionLayoutParams;

8
CodeRank
This code example shows how to use the following methods:requestFocus, setMediaController, setOnPreparedListener, setVideoURI, start
	void updateContents() { 
		setVideoOnBackground(); 
		 
		incomingInfoTextView.setText(incomingPhoneNumber);
		 
	    myVideoView.setMediaController(new MediaController(this));
 
		myVideoView.setOnPreparedListener(new OnPreparedListener() {
		    @Override 
		    public void onPrepared(MediaPlayer mp) {
		    	mp.setLooping(true);
		    } 
		}); 
		 
		myVideoView.requestFocus();
		myVideoView.start();
		 
		windowManager.removeView(GlobalHolder.getCallReceiverImageView());
	} 
	 

6
CodeRank
This code example shows how to use the following methods:requestFocus, setMediaController, setOnPreparedListener, setVideoURI
                MediaController mediacontroller = new MediaController(
                        Play_Video.this);
                mediacontroller.setAnchorView(videoview);
                // Get the URL from String VideoURL 
                Uri video = Uri.parse(path);
                videoview.setMediaController(mediacontroller);
                videoview.setVideoURI(video);
  
                videoview.requestFocus();
                videoview.setOnPreparedListener(new OnPreparedListener() {
                    // Close the progress bar and play the video 
                    public void onPrepared(MediaPlayer mp) {
                        pDialog.dismiss();
                        videoview.start();
                    } 
                }); 
            } catch (Exception e) {
                pDialog.dismiss();
                Log.e("Error", e.getMessage());
                e.printStackTrace();
6
CodeRank
This code example shows how to use the following methods:requestFocus, setMediaController, setOnPreparedListener, setVideoURI, start
     
    @AfterViews 
	void updateContents() { 
		setVideoOnBackground(); 
		 
		introVideoView.setMediaController(new MediaController(this));
		introVideoView.setOnPreparedListener(new MainPreparedListner());
		 
		introVideoView.requestFocus();
		introVideoView.start();
	} 
	 
	@Background 
	void setVideoOnBackground() { 
		Uri defaultVideofile = Uri.parse("android.resource://" + this.getPackageName() + "/raw/a");
		introVideoView.setVideoURI(defaultVideofile);
	} 
	 
	private class MainPreparedListner implements OnPreparedListener {
		@Override 
		public void onPrepared(MediaPlayer mp) {
6
CodeRank
This code example shows how to use the following methods:requestFocus, setMediaController, setOnPreparedListener, setVideoURI
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
This code example shows how to use the following methods:requestFocus, setKeepScreenOn, setOnClickListener, setMediaController, setOnCompletionListener
    public void loadVideo(final String path) {
	/* 
	 * Alternatively,for streaming media you can use mVideoView.setVideoURI(Uri.parse(URLstring)); 
	 */ 
 
	mVideoView.setVideoPath(path);
	MediaController mediaController = new MediaController(getActivity());
	mediaController.setAnchorView(mVideoView);
	mVideoView.setMediaController(null);
 
	mVideoView.requestFocus();
	mVideoView.setKeepScreenOn(true);
 
	mVideoView.start();
 
	mVideoView.setOnClickListener(new OnClickListener() {
 
	    @Override 
	    public void onClick(View v) {
		close(); 

5
CodeRank

Related VideoView setOnPreparedListener Questions & Answers: