Best code examples for Android VideoView class (android.widget.VideoView)

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android VideoView class.
You can now enable Codota on your own code to easily search and navigate your Java codebase.

Android VideoView examples from Open Source projects
Examples using Android VideoView setVideoURI method:
This code example shows how to use the following methods: setVideoURI, start
54:	mVideoView.setVideoURI(Uri.parse(url)); 
55:	mVideoView.start(); 
Full Snippet Info
8
CodeRank
This code example shows how to use the following methods: setVideoURI, start
112:	videoView.setVideoURI(Uri.parse(new File(video 
-
114:	videoView.start(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setMediaController, setVideoURI, start, requestFocus
48:	videoView1.setMediaController(new MediaController(this)); 
-
50:	videoView1.setVideoURI(Uri.parse(path+"/"+fileName)); 
-
52:	videoView1.requestFocus(); 
-
54:	videoView1.start(); 
Full Snippet Info
6
CodeRank
Examples using Android VideoView isPlaying method:
This code example shows how to use the following methods: isPlaying, start
138:	if ( mVideoView.isPlaying ()) { 
-
143:	mVideoView.start (); 
Full Snippet Info
7
CodeRank
This code example shows how to use the following methods: isPlaying
71:	if (mVideoView.isPlaying()) { 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: isPlaying, setMediaController, setVideoPath, start, stopPlayback
41:	videoView.stopPlayback(); 
-
70:	if (!this.videoView.isPlaying()) { 
71:	this.videoView.setVideoPath(content_unit.getMovieFile() 
-
73:	this.videoView.setMediaController(new MediaController(getActivity())); 
74:	this.videoView.start(); 
Full Snippet Info
6
CodeRank
Examples using Android VideoView canSeekForward method:
This code example shows how to use the following methods: canSeekForward, getDuration, isPlaying, seekTo, start
50:	if(videoPlayer.canSeekForward()) videoPlayer.seekTo(videoPlayer.getDuration()/5); 
51:	videoPlayer.start(); 
52:	Log.i("IS PLAYING", Boolean.toString(videoPlayer.isPlaying())); 
Full Snippet Info
6
CodeRank
Examples using Android VideoView setMediaController method:
This code example shows how to use the following methods: setMediaController, setOnCompletionListener, setVideoURI, start
19:	t = new VideoView(EpicAndroidActivity.getCurrentAndroidActivity()); 
20:	t.setOnCompletionListener(this); 
-
22:	t.setVideoURI(this.location); 
23:	t.setMediaController(new MediaController(EpicAndroidActivity.getCurrentAndroidActivity())); 
-
25:	t.start(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setMediaController, setOnCompletionListener, setOnErrorListener, setOnPreparedListener
112:	videoView.setOnPreparedListener(this); 
113:	videoView.setOnErrorListener(this); 
114:	videoView.setOnCompletionListener(this); 
-
116:	videoView.setMediaController(controller); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setMediaController, setVideoPath, requestFocus
27:	VideoView v = new VideoView(this); 
-
30:	v.setVideoPath(s); 
31:	v.setMediaController(new MediaController(this)); 
32:	v.requestFocus(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setOnCompletionListener, setVideoURI
39:	video = new VideoView(GameActivity.getContext()); 
40:	video.setOnCompletionListener(this); 
-
43:	GameActivity.pushView(video); 
-
52:	video.setVideoURI(Utils.buildResourceUri(GameActivity.getContext(), GameActivity.getResourceID(resourcePath))); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setOnCompletionListener, setVideoPath, start
49:	VideoView videoView = new VideoView(this); 
50:	videoView.setOnCompletionListener(new OnCompletionListener() { 
-
61:	videoView.setVideoPath(path); 
62:	videoView.start(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setMediaController, setOnCompletionListener, setOnPreparedListener, setVideoPath
26:	mVideoView.setOnCompletionListener(this); 
27:	mVideoView.setOnPreparedListener(this); 
-
37:	mVideoView.setVideoPath(mVideoFileName); 
38:	mVideoView.setMediaController(mController); 
-
85:	mVideoView = new VideoView(this); 
Full Snippet Info
8
CodeRank
Examples using Android VideoView getDuration method:
This code example shows how to use the following methods: getDuration, start
36:	int duration = mVideoView.getDuration(); 
-
42:	mVideoView.start(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getCurrentPosition, getDuration, isPlaying, pause, seekTo
177:	mVideoPosition = mVideoView.getCurrentPosition(); 
-
181:	mVideoView.seekTo(mTrimStartTime); 
-
188:	mVideoView.seekTo(mTrimEndTime); 
-
192:	mVideoView.pause(); 
-
195:	int duration = mVideoView.getDuration(); 
-
204:	mVideoView.start(); 
-
210:	mVideoView.pause(); 
-
287:	if (mVideoView.isPlaying()) { 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getDuration, seekTo, setVideoURI
36:	VideoView view = new VideoView(getActivity()); 
-
39:	view.setVideoURI(Uri.fromFile(new File(filePath))); 
-
41:	int duration = view.getDuration(); 
42:	view.seekTo(duration); 
Full Snippet Info
6
CodeRank
Examples using Android VideoView getCurrentPosition method:
This code example shows how to use the following methods: getCurrentPosition, isPlaying, stopPlayback
218:	setBookmark(mVideoView.getCurrentPosition()); 
-
220:	mPositionWhenPaused = mVideoView.getCurrentPosition(); 
221:	mWasPlayingWhenPaused = mVideoView.isPlaying(); 
222:	mVideoView.stopPlayback(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getCurrentPosition, getDuration, stopPlayback
52:	mPositionWhenPaused = mVideoView.getCurrentPosition(); 
53:	mVideoView.stopPlayback(); 
-
55:	Log.d(TAG, "OnStop: getDuration  = " + mVideoView.getDuration()); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: getCurrentPosition, getDuration, isPlaying, pause, seekTo
177:	mVideoPosition = mVideoView.getCurrentPosition(); 
-
181:	mVideoView.seekTo(mTrimStartTime); 
-
188:	mVideoView.seekTo(mTrimEndTime); 
-
192:	mVideoView.pause(); 
-
195:	int duration = mVideoView.getDuration(); 
-
204:	mVideoView.start(); 
-
210:	mVideoView.pause(); 
-
287:	if (mVideoView.isPlaying()) { 
Full Snippet Info
6
CodeRank
Examples using Android VideoView seekTo method:
This code example shows how to use the following methods: seekTo, setVideoPath
49:	VideoView result=new VideoView(getActivity()); 
-
51:	result.setVideoPath(getArguments().getString(ARG_PATH)); 
-
54:	result.seekTo(savedInstanceState.getInt(STATE_POSITION)); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: seekTo, setVideoPath, start
44:	vv.setVideoPath("android.resource://jp.alumican.speechdemo/"+video_src); 
45:	vv.seekTo(0); 
46:	vv.start(); 
Full Snippet Info
5
CodeRank
Examples using Android VideoView start method:
This code example shows how to use the following methods: setMediaController, setVideoURI, start, requestFocus
15:	VideoView videoHolder = new VideoView(this); 
-
17:	videoHolder.setMediaController(new MediaController(this)); 
-
19:	videoHolder.setVideoURI(Uri.parse(path+"/"+fileName)); 
-
21:	videoHolder.requestFocus(); 
-
23:	videoHolder.start(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setMediaController, setVideoURI, start
45:	videoView.setVideoURI(Uri.parse(videoPath)); 
-
47:	videoView.setMediaController(new MediaController(this)); 
-
49:	videoView.start(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setMediaController, setVideoURI, start, requestFocus
47:	videoView1.setMediaController(new MediaController(this)); 
-
49:	videoView1.setVideoURI(Uri.parse(path+"/"+fileName)); 
-
51:	videoView1.requestFocus(); 
-
54:	videoView1.start(); 
Full Snippet Info
6
CodeRank
Examples using Android VideoView setVideoPath method:
This code example shows how to use the following methods: setMediaController, setVideoPath, start, requestFocus
18:	VideoView vv = new VideoView(getApplicationContext()); 
-
20:	vv.setVideoPath(filename); 
21:	vv.setMediaController(new MediaController(this)); 
22:	vv.requestFocus(); 
23:	vv.start(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setMediaController, setVideoPath, start, requestFocus, setMinimumHeight
21:	VideoView vv = new VideoView(getApplicationContext()); 
-
23:	vv.setVideoPath(filename); 
24:	vv.setMinimumHeight(480); 
25:	vv.setMinimumWidth(800); 
26:	vv.setMediaController(new MediaController(this)); 
27:	vv.requestFocus(); 
28:	vv.start(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setMediaController, setVideoPath, start, requestFocus
19:	VideoView vv = new VideoView(getApplicationContext()); 
-
21:	vv.setVideoPath(filename); 
22:	vv.setMediaController(new MediaController(this)); 
23:	vv.requestFocus(); 
24:	vv.start(); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setMediaController, setOnPreparedListener, setVideoURI, start, requestFocus
50:	myVideoView.requestFocus(); 
51:	myVideoView.start(); 
-
57:	myVideoView.setVideoURI(defaultVideofile); 
-
59:	myVideoView.setMediaController(new MediaController(this)); 
-
61:	myVideoView.setOnPreparedListener(new OnPreparedListener() { 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setMediaController, setOnPreparedListener, setVideoURI, start, requestFocus
58:	myVideoView.setMediaController(new MediaController(this)); 
-
60:	myVideoView.setOnPreparedListener(new OnPreparedListener() { 
-
67:	myVideoView.requestFocus(); 
68:	myVideoView.start(); 
-
76:	myVideoView.setVideoURI(defaultVideofile); 
Full Snippet Info
6
CodeRank
This code example shows how to use the following methods: setMediaController, setOnPreparedListener, setVideoURI, start, requestFocus
64:	introVideoView.setMediaController(new MediaController(this)); 
65:	introVideoView.setOnPreparedListener(new MainPreparedListner()); 
-
67:	introVideoView.requestFocus(); 
68:	introVideoView.start(); 
-
74:	introVideoView.setVideoURI(defaultVideofile); 
Full Snippet Info
6
CodeRank
Examples using Android VideoView stopPlayback method:
This code example shows how to use the following methods: setOnCompletionListener, stopPlayback, setOnTouchListener
88:	travel.stopPlayback(); 
-
90:	travel.setOnTouchListener(null); 
91:	travel.setOnCompletionListener(null); 
Full Snippet Info
6
CodeRank
Examples using Android VideoView setOnErrorListener method:
This code example shows how to use the following methods: setMediaController, setOnErrorListener, setOnPreparedListener, setVideoURI
36:	player.setMediaController(controller); 
37:	player.setVideoURI(mediaPath); 
38:	player.setOnErrorListener(this); 
39:	player.setOnPreparedListener(this); 
Full Snippet Info
5
CodeRank
Examples for other Android VideoView methods:
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

VideoView Class Overview
Displays a video file. The VideoView class can load images from various sources (such as resources or content providers), takes care of computing its measurement from the video so that it can be used in any layout manager, and pro...
Methods
  • setOnCompletionListener
    Register a callback to be invoked when the end of a media file has been reached during playback.
  • setOnErrorListener
    Register a callback to be invoked when an error occurs during playback or setup.