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

This code example shows how to use the following methods:setVideoURI, start
        return mCustomView;
    } 
 
    @Override 
    public void navigate(String url) {
        mVideoView.setVideoURI(Uri.parse(url));
        mVideoView.start();
    } 
 
    @Override 
    public void stop() { 
        mVideoView.stopPlayback();
    } 
 
    @Override 
    public void destroyView() { 
        mVideoView.stopPlayback();
        mCustomViewCallback.onCustomViewHidden();
    } 
 
8
CodeRank
This code example shows how to use the following methods:isPlaying, start
	} 
	 
	//----------------------------------------------------------------// 
	public void startPlayback () { 
		 
		if ( mVideoView.isPlaying ()) {
 
			mVideoView.resume ();
		} else { 
 
			mVideoView.start ();
		} 
	} 
	 
	//----------------------------------------------------------------// 
	public void pausePlayback () { 
		 
		mVideoView.pause ();
	} 
 
7
CodeRank
This code example shows how to use the following methods:getDuration, start
            public void onPrepared(MediaPlayer mp) {
                // 3,4秒でMediaControllerが消えちゃうので 
                // 常に表示させておきたいんだけど 
                // showメソッドが期待通りに動作してくれない 
                // durationは正しく取得できてる。 
                int duration = mVideoView.getDuration();
                mMediaController.show(duration);
                // リファレンスを信じて0にしてもダメ 
//                mMediaController.show(0); 
 
                // まぁ気にせず再生スタート! 
                mVideoView.start();
            } 
        }); 
    } 
 
    public void onPickAndVideoViewButton(View view) {
        startVideoPicker(1); 
    } 
 
6
CodeRank
This code example shows how to use the following methods:requestFocus, setMediaController, setVideoURI, start
    } 
    public void videoPlayer(String path, String fileName, boolean autoplay){
        //get current window information, and set format, set it up differently, if you need some special effects 
        getWindow().setFormat(PixelFormat.JPEG);
        //MediaController is the UI control howering above the video to control the video 
        videoView1.setMediaController(new MediaController(this));
        //accessing a video file to the video holder 
        videoView1.setVideoURI(Uri.parse(path+"/"+fileName));
        //get focus, before playing the video. 
        videoView1.requestFocus();
        if(autoplay){
            videoView1.start();
        } 
}} 
6
CodeRank
This code example shows how to use the following methods:canSeekForward, getDuration, isPlaying, seekTo, start
              
       // Don't start until ready to play.  The arg of seekTo(arg) is the start point in 
       // milliseconds from the beginning. In this example we start playing 1/5 of 
       // the way through the video if the player can do forward seeks on the video. 
        
       if(videoPlayer.canSeekForward()) videoPlayer.seekTo(videoPlayer.getDuration()/5);
       videoPlayer.start();
       Log.i("IS PLAYING", Boolean.toString(videoPlayer.isPlaying()));
    } 
     
    /** This callback will be invoked when the file is finished playing */ 
    @Override 
    public void onCompletion(MediaPlayer  mp) {
       // Statements to be executed when the video finishes. 
       this.finish();	
    } 
     
    /**  Use screen touches to toggle the video between playing and paused. */ 
    @Override 
    public boolean onTouchEvent (MotionEvent ev){
6
CodeRank
This code example shows how to use the following methods:requestFocus, setMediaController, setVideoURI, start
    } 
    public void videoPlayer(String path, String fileName, boolean autoplay){
        //get current window information, and set format, set it up differently, if you need some special effects 
        getWindow().setFormat(PixelFormat.JPEG);
        //MediaController is the UI control howering above the video. 
        videoView1.setMediaController(new MediaController(this));
        //accessing a video file to the video holder 
        videoView1.setVideoURI(Uri.parse(path+"/"+fileName));
        //get focus, before playing the video. 
        videoView1.requestFocus();
       // autoplay on activity call 
        if(autoplay){
            videoView1.start();
        } 
}} 
6
CodeRank
This code example shows how to use the following methods:setVideoURI, start
 
			@Override 
			public void run() { 
				pbar.setVisibility(View.GONE);
				if (video != null) {
					videoView.setVideoURI(Uri.parse(new File(video
							.getVideoFilePath()).toString()));
					videoView.start();
					imageViewThumb.setImageURI(Uri.parse(new File(video
							.getThumbnailPath()).toString()));
					imageViewThumbSmall.setImageURI(Uri.parse(new File(video
							.getThumbnailSmallPath()).toString()));
				} 
			} 
		}); 
	} 
 
	@Override 
	public void onError(final String reason) {
		runOnUiThread(new Runnable() {
6
CodeRank
This code example shows how to use the following methods:requestFocus, setMediaController, setVideoURI, start
    } 
    public void videoPlayer(String path, String fileName, boolean autoplay){
        //get current window information, and set format, set it up differently, if you need some special effects 
        getWindow().setFormat(PixelFormat.JPEG);
        //MediaController is the UI control howering above the video. 
        videoView1.setMediaController(new MediaController(this));
        //accessing a video file to the video holder 
        videoView1.setVideoURI(Uri.parse(path+"/"+fileName));
        //get focus, before playing the video. 
        videoView1.requestFocus();
       // autoplay on activity call 
        if(autoplay){
            videoView1.start();
        } 
}} 
6
CodeRank
This code example shows how to use the following methods:requestFocus, setMediaController, setVideoPath, start
	 * @param video 
	 *            File object that points to a video on your filesystem. 
	 */ 
	private void playVideo(File video) {
		if (video != null) {
			videoView.setVideoPath(video.getPath());
			videoView.setMediaController(new MediaController(this));
			videoView.requestFocus();
			videoView.start();
		} else { 
			Log.i("Tv Activity",
					"Trying to play a video that is not specified."); 
		} 
	} 
 
	/** 
	 * A simple inner class used for finding files that end with .mp4 or .avi 
	 *  
	 */ 
	class VideoFilter implements FilenameFilter {
5
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

Related VideoView start Questions & Answers:

Other VideoView start Examples

227:				videoPreview.setVideoPath(fileUri.getPath());
228:				// start playing
229:				videoPreview.start();
230:			} catch (Exception e) {
231:				e.printStackTrace();

Read More