private void initVideoPath() { File file = new File(Environment.getExternalStorageDirectory(), "movie.mp4"); videoView.setVideoPath(file.getPath()); // 指定视频文件的路径 }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_recorder_playback); Intent intent = getIntent(); recorderFilePath = intent.getStringExtra("RecorderFilePath"); filePathTextView = (TextView) findViewById(R.id.textViewRecoderPlaybackFilePath); if (recorderFilePath != null) { filePathTextView.setText(recorderFilePath); } else { Log.i(Tag, "recorderFilePath is null"); } playVideoView = (VideoView) findViewById(R.id.VideoViewRecoderPlayback); if (recorderFilePath != null && !recorderFilePath.isEmpty()) { playVideoView.setVideoPath(recorderFilePath); playVideoView.setMediaController(new MediaController(this)); playVideoView.requestFocus(); playVideoView.start(); } } }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_recorder_playback); Intent intent = getIntent(); recorderFilePath = intent.getStringExtra("RecorderFilePath"); filePathTextView = (TextView) findViewById(R.id.textViewRecoderPlaybackFilePath); if (recorderFilePath != null) { filePathTextView.setText(recorderFilePath); } else { Log.i(Tag, "recorderFilePath is null"); } playVideoView = (VideoView) findViewById(R.id.VideoViewRecoderPlayback); if (recorderFilePath != null && !recorderFilePath.isEmpty()) { playVideoView.setVideoPath(recorderFilePath); playVideoView.setMediaController(new MediaController(this)); playVideoView.requestFocus(); playVideoView.start(); } } }
playVideoView.setVideoPath(recorderFilePath); playVideoView.setMediaController(new MediaController(this)); playVideoView.requestFocus();
playVideoView.setVideoPath(recorderFilePath); playVideoView.setMediaController(new MediaController(this)); playVideoView.requestFocus();
@Override public void onReady(Bundle state) { getWindow().setFormat(PixelFormat.TRANSLUCENT); setContentView(R.layout.main); File clip=new File(Environment.getExternalStorageDirectory(), "test.mp4"); if (clip.exists()) { video=(VideoView)findViewById(R.id.video); video.setVideoPath(clip.getAbsolutePath()); ctlr=new MediaController(this); ctlr.setMediaPlayer(video); video.setMediaController(ctlr); video.requestFocus(); video.start(); } } }
@Test public void shouldSetVideoPath() throws Exception { view.setVideoPath("video.mp4"); ShadowVideoView shadowVideoView = shadowOf(view); assertThat(shadowVideoView.getVideoPath()).isEqualTo("video.mp4"); view.setVideoPath(null); assertThat(shadowVideoView.getVideoPath()).isNull(); }
String _path = "/mnt/sdcard/Movies/video5.mp4"; videoView.setVideoPath(_path); videoView.setOnPreparedListener(PreparedListener);
mVideoView.setVideoPath(Environment.getExternalStorageDirectory() + "/1.flv");
mVideoView.setVideoPath(Environment.getExternalStorageDirectory() + "/1.flv");
public static void previewVideo(VideoView videoPreview) { try { videoPreview.setVideoPath(fileUri.getPath()); // start playing videoPreview.start(); } catch (Exception e) { e.printStackTrace(); } }
public static void previewVideo(VideoView videoPreview) { try { videoPreview.setVideoPath(fileUri.getPath()); // start playing videoPreview.start(); } catch (Exception e) { e.printStackTrace(); } }
private void initVideoPlayer() { mPreview.setVideoPath(mSrcVideoPath); mPreview.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mediaPlayer) { play(); } }); play(); }
ivPreview.setVisibility(View.GONE); Uri fileUri = data.getData(); vvVideo.setVideoPath(Common.getPath(PickCaptureActivity.this, fileUri)); vvVideo.start(); break;
videoView.setVideoPath(bufferFile.getAbsolutePath()); try { mp.reset(); videoView.setVideoPath(new File("mnt/sdcard/YoutubeBuff/" + mBufferFile).getAbsolutePath()); mp.seekTo(mPlayerPosition);
String _path = "/mnt/sdcard/Movies/video5.mp4"; videoView.setVideoPath(_path); videoView.setOnPreparedListener(PreparedListener);
private void init(String videoPath) { setContentView(R.layout.activity_trim); TextView duration = (TextView) findViewById(R.id.duration); mPreview = (VideoView) findViewById(R.id.preview); mShortVideoTrimmer = new PLShortVideoTrimmer(this, videoPath, Config.TRIM_FILE_PATH); mMediaFile = new PLMediaFile(videoPath); mSelectedEndMs = mDurationMs = mMediaFile.getDurationMs(); duration.setText("时长: " + formatTime(mDurationMs)); Log.i(TAG, "video duration: " + mDurationMs); mVideoFrameCount = mMediaFile.getVideoFrameCount(false); Log.i(TAG, "video frame count: " + mVideoFrameCount); mPreview.setVideoPath(videoPath); mPreview.setOnCompletionListener(new MediaPlayer.OnCompletionListener() { @Override public void onCompletion(MediaPlayer mediaPlayer) { play(); } }); initVideoFrameList(); }
VideoView videoView; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); videoView = (VideoView)findViewById(R.id.VideoView); videoView.setVideoPath("/sdcard/blonde_secretary.3gp"); videoView.start(); }
@ReactProp(name = "streamUrl") public void setStreamUrl(VideoView view, @Nullable String streamUrl) { if (!LibsChecker.checkVitamioLibs(mActivity)) return; view.setVideoPath(streamUrl); view.setMediaController(new MediaController(mContext)); view.requestFocus(); }
VideoView videoView = (VideoView) findViewById(R.id.videoView); final String MEDIA_PATH = new String(Environment.getExternalStorageDirectory()+"/sdcard/robot.avi"); MediaController mediaController = new MediaController(this); mediaController.setAnchorView(videoView); videoView.setVideoPath(MEDIA_PATH); videoView.setMediaController(mediaController); videoView.start();