Android VideoView - top ranked examples from Open Source projects

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

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();
    } 
 
Full Snippet Info
8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
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 ();
	} 
 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
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){
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setMediaController, setOnCompletionListener, setVideoURI, start
	Uri location;
	private EpicClickListener listener;
 
	public EpicNativeVideoWidget(String stringLocation, EpicClickListener l) {
		this.listener = l;
		t = new VideoView(EpicAndroidActivity.getCurrentAndroidActivity());
		t.setOnCompletionListener(this);
		this.location = Uri.parse(stringLocation);
		t.setVideoURI(this.location);
        t.setMediaController(new MediaController(EpicAndroidActivity.getCurrentAndroidActivity()));
//      t.requestFocus(); 
        t.start();
	} 
 
	View getAndroidView() {
		return t;
	} 
 
	public void onCompletion(MediaPlayer arg0) {
		this.listener.onClick();
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: setOnCompletionListener, setVideoURI
        } 
    } 
    public VideoView createVideoView(String resourcePath) {
        if(video==null){
            Log.i(TAG, "Creating video view");
            video = new VideoView(GameActivity.getContext());
            video.setOnCompletionListener(this);
            Log.i(TAG, "Setting...");
			try{ 
				GameActivity.pushView(video);
			}catch(Exception e){
				Log.e(TAG,"Ruh roh");
			} 
            Log.i(TAG, "Video view set as current");
        }else{ 
            video.stopPlayback();
        } 
        Log.i(TAG, "Setting video uri");
        video.setVideoURI(Utils.buildResourceUri(GameActivity.getContext(), GameActivity.getResourceID(resourcePath)));
        return video;

6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Android VideoView Questions & Answers:

Other Android VideoView Examples

12:	
13:		private ImageView imgPreview;
14:		private VideoView videoPreview;
15:		private Button btnCapturePicture, btnRecordVideo;
16:	
-
21:	
22:			imgPreview = (ImageView) findViewById(R.id.imgPreview);
23:			videoPreview = (VideoView) findViewById(R.id.videoPreview);
24:			btnCapturePicture = (Button) findViewById(R.id.btnCapturePicture);
25:			btnRecordVideo = (Button) findViewById(R.id.btnRecordVideo);

Read More

35:	
36:		private ImageView imgPreview;
37:		private VideoView videoPreview;
38:		private Button btnCapturePicture, btnRecordVideo;
39:	
-
44:	
45:			imgPreview = (ImageView) findViewById(R.id.imgPreview);
46:			videoPreview = (VideoView) findViewById(R.id.videoPreview);
47:			btnCapturePicture = (Button) findViewById(R.id.btnCapturePicture);
48:			btnRecordVideo = (Button) findViewById(R.id.btnRecordVideo);

Read More

See Code Examples for Android VideoView Methods: