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

This code example shows how to use the following methods:requestFocus, setMediaController, setVideoPath
public class ExemploVideoView extends Activity {
	@Override 
	public void onCreate(Bundle b) {
		super.onCreate(b);
 
		VideoView v = new VideoView(this);
		setContentView(v);
 
		v.setVideoPath("/data/local/tmp/last_mohicans.3gp");
		v.setMediaController(new MediaController(this));
		v.requestFocus();
	} 
} 
6
CodeRank
This code example shows how to use the following methods:requestFocus, setMediaController, setVideoPath
This code example shows how to use the following methods:seekTo, setVideoPath
 
  @Override 
  public View onCreateView(LayoutInflater inflater,
                           ViewGroup container,
                           Bundle savedInstanceState) {
    VideoView result=new VideoView(getActivity());
 
    result.setVideoPath(getArguments().getString(ARG_PATH));
 
    if (savedInstanceState != null) {
      result.seekTo(savedInstanceState.getInt(STATE_POSITION));
    } 
 
    return(result);
  } 
 
  @Override 
  public void onResume() { 
    super.onResume(); 
 
6
CodeRank
This code example shows how to use the following methods:setOnCompletionListener, setVideoPath
			v.start();
		} 
	} 
	 
	public View createView(Context c) {
		v = new VideoView(c);
		v.setOnCompletionListener(this);
		v.setVideoPath(this.getResource() );
		this.layout = new RelativeLayout(c);
		this.layout.setPadding(getLeft(), getTop(), 0, 0);
		this.layout.addView(this.v, new RelativeLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT) );
		this.layout.setVisibility(View.GONE);
		return layout;
	} 
	 
	public View getView() {
		return layout;
	} 
	 
	public void onCompletion(MediaPlayer arg0) {
5
CodeRank
This code example shows how to use the following methods:requestFocus, setMediaController, setVideoPath, start
This code example shows how to use the following methods:isPlaying, setMediaController, setVideoPath, start, stopPlayback
		this.layoutVideo = (LinearLayout) v.findViewById(R.id.layoutVideo);
		return v;
	}// onCreateView 
 
	public void stopPlayback() { 
		videoView.stopPlayback();
	}// stopPlayback 
 
	public void hide() { 
		layoutVideo.setVisibility(View.GONE);
	} // hide 
 
	public void update(ContentUnit content_unit) {
		if (this.contentUnit != null) {
			if (this.contentUnit.getParent() == null
					&& content_unit.getParent() != null) {
				this.stopPlayback();
			} else if (this.contentUnit.getAncestors() != null
					&& content_unit.getParent() == null) {
				this.stopPlayback();

5
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, setVideoPath, start
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, setMinimumHeight, setMinimumWidth, setMediaController, setVideoPath

Related VideoView setVideoPath Questions & Answers:

Other VideoView setVideoPath Examples

225:	
226:				videoPreview.setVisibility(View.VISIBLE);
227:				videoPreview.setVideoPath(fileUri.getPath());
228:				// start playing
229:				videoPreview.start();

Read More