本文整理汇总了Java中android.widget.VideoView.setVideoURI方法的典型用法代码示例。如果您正苦于以下问题:Java VideoView.setVideoURI方法的具体用法?Java VideoView.setVideoURI怎么用?Java VideoView.setVideoURI使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.widget.VideoView
的用法示例。
在下文中一共展示了VideoView.setVideoURI方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: go
import android.widget.VideoView; //导入方法依赖的package包/类
private void go() {
VideoView v=(VideoView)findViewById(R.id.videoView) ;
final ProgressBar p=(ProgressBar)findViewById(R.id.progressBar3);
v.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
p.setVisibility(View.GONE);
}
});
String s="https://firebasestorage.googleapis.com/v0/b/lifesaver-18f28.appspot.com/o/flood.mp4?alt=media&token=179d7e4e-7171-4a87-b1f8-b1fc3d976c60";
Uri uri=Uri.parse(s);
v.setVideoURI(uri);
v.setVideoPath(s);
v.requestFocus();
v.start();
}
示例2: go
import android.widget.VideoView; //导入方法依赖的package包/类
private void go() {
final ProgressBar p=(ProgressBar)findViewById(R.id.progressBar2);
VideoView v=(VideoView)findViewById(R.id.videoView2) ;
v.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
p.setVisibility(View.GONE);
}
});
String s="https://firebasestorage.googleapis.com/v0/b/lifesaver-18f28.appspot.com/o/earthquake.mp4?alt=media&token=98993371-823d-4b81-adc7-d9d87ec841a9";
Uri uri=Uri.parse(s);
v.setVideoURI(uri);
v.setVisibility(View.VISIBLE);
v.setVideoPath(s);
v.requestFocus();
v.start();
}
示例3: onCreate
import android.widget.VideoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String url = getIntent().getExtras().getString(Constants.URL);
setContentView(R.layout.fragment_video_gallery);
final VideoView videoView = (VideoView) findViewById(R.id.videoView);
videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
View progress = findViewById(R.id.videoProgress);
progress.setVisibility(View.GONE);
videoView.requestFocus();
MediaController vidControl = new MediaController(VideoPlayerActivity.this);
vidControl.setAnchorView(videoView);
videoView.setMediaController(vidControl);
videoView.start();
}
});
videoView.setVideoURI(Uri.parse(url));
}
示例4: onCreate
import android.widget.VideoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.video_full);
videofull=(VideoView)findViewById(R.id.videofull);
videofull.setVideoURI(Uri.parse("android.resource://" + getPackageName() + "/" + R.raw.video));
videofull.setMediaController(new MediaController(VideoFull.this));
videofull.start();
videofull.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mp.setLooping(true);
}
});
videofull.requestFocus();
}
示例5: onCreate
import android.widget.VideoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String url = getIntent().getExtras().getString(Constants.URL);
setContentView(R.layout.video_fragment);
final VideoView videoView = (VideoView) findViewById(R.id.videoView);
videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
View progress = findViewById(R.id.videoProgress);
progress.setVisibility(View.GONE);
videoView.requestFocus();
MediaController vidControl = new MediaController(VideoPlayerActivity.this);
vidControl.setAnchorView(videoView);
videoView.setMediaController(vidControl);
videoView.start();
}
});
videoView.setVideoURI(Uri.parse(url));
}
示例6: onViewCreated
import android.widget.VideoView; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
adapter = new MyPagerAdapter(getChildFragmentManager());
DexShiftingPagerLayout dexShiftingView = (DexShiftingPagerLayout) view.findViewById(R.id.dexshiftingview);
dexShiftingView.setOnShiftListener(onShiftListener);
dexShiftingView.setToolbar(onShiftListener.getToolbar(), getResources().getColor(R.color.primary), getResources().getColor(R.color.secondary));
dexShiftingView.setAdapter(adapter);
switch (subsection) {
case VIDEO_VIEW:
VideoView videoView = (VideoView) view.findViewById(R.id.video);
videoView.setVideoURI(Uri.parse("android.resource://" + getActivity().getPackageName() + "/"
+ R.raw.video));
videoView.start();
break;
}
}
示例7: onCreate
import android.widget.VideoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
VideoView v = (VideoView) findViewById(R.id.videoView);
// v.setVideoPath("/sdcard/video.mp4");
v.setVideoURI(Uri.parse(String.format(
"android.resource://%s/%s",
getPackageName(),
R.raw.video
)));
v.setMediaController(new MediaController(this));
v.requestFocus();
v.start();
}
示例8: onCreate
import android.widget.VideoView; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
//Get the ViewView
vv = (VideoView) this.findViewById( R.id.videoView);
//add media controls to it.
vv.setMediaController(new MediaController(this));
//Setup where the file to play is
//on the SDcard in the root directory. Not you need permissions to read the external storage.
//Uri videoUri = Uri.parse(Environment.getExternalStorageDirectory().getPath() + "/the-empire.3gp");
//Log.v("path",Environment.getExternalStorageDirectory().getPath() );
//via the web. Note you need Internet permissions.
Uri videoUri = Uri.parse("http://www.cs.uwyo.edu/~seker/courses/4730/example/the-empire.3gp");
vv.setVideoURI(videoUri);
//play the video
vv.start();
}
示例9: onCreateView
import android.widget.VideoView; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View myView = inflater.inflate(R.layout.fragment_main, container, false);
//Get the ViewView
vv = (VideoView) myView.findViewById( R.id.videoView);
//add media controls to it. //note, in a fragment, this dies... don't know why.
// in both frag and activity these are are wrong: getApplicationContext() and getBaseContext()
//It's not context, actually needs the activity, so it can display the controls to the screen.
vv.setMediaController(new MediaController(getActivity()));
//Setup where the file to play is
//on the SDcard in the root directory. Now you need permissions to read the external storage.
//Uri videoUri = Uri.parse(Environment.getExternalStorageDirectory().getPath() + "/the-empire.3gp");
//Log.v("path",Environment.getExternalStorageDirectory().getPath() );
//via the web. Note you need Internet permissions.
Uri videoUri = Uri.parse("http://www.cs.uwyo.edu/~seker/courses/4730/example/the-empire.3gp");
vv.setVideoURI(videoUri);
//play the video
vv.start();
return myView;
}
示例10: onCreate
import android.widget.VideoView; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
PreferencesState.getInstance().initalizateActivityDependencies();
setContentView(R.layout.video_activity);
//Displays a video file.
MediaController mediaController = new MediaController(VideoActivity.this);
mVideoView = (VideoView) findViewById(R.id.videoview);
String videoPathParam = getIntent().getStringExtra(VIDEO_PATH_PARAM);
File file = new File(videoPathParam);
if (file.exists()) {
mVideoView.setVideoPath(videoPathParam);
} else {
mVideoView.setVideoURI(FileIOUtils.getRawUri(videoPathParam));
}
mVideoView.setMediaController(mediaController);
mediaController.setAnchorView(mVideoView);
mVideoView.requestFocus();
if (savedInstanceState != null) {
mVideoView.seekTo(savedInstanceState.getInt("video", 0));
}
mVideoView.start();
}
示例11: onCreate
import android.widget.VideoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_video);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
VideoView videoView = (VideoView) findViewById(R.id.video_view);
final String uri = "android.resource://" + getPackageName() + "/" + R.raw.fix_429;
videoView.setVideoURI(Uri.parse(uri));
// Loop
videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mp.setLooping(true);
}
});
// Play
videoView.start();
}
示例12: onCreate
import android.widget.VideoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mVideoContainer = new VideoContainer(this);
this.setContentView(mVideoContainer);
VideoView videoView = mVideoContainer.getVideoView();
mExtra = new VideoExtra();
if (mExtra.getFrom(getIntent())) {
videoView.setVideoURI(Uri.parse(mExtra.mUrl));
if (mExtra.mAutoPlay) {
videoView.start();
}
}
videoView.requestFocus();
}
示例13: onCreate
import android.widget.VideoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_video_bmx);
String uriPath = "android.resource://mx.ambmultimedia.brillamexico/raw/bmx_video";
Uri uri = Uri.parse(uriPath);
video = (VideoView) findViewById(R.id.videoView);
video.setVideoURI(uri);
MediaController mediaController = new MediaController(this);
mediaController.setAnchorView(video);
video.setMediaController(mediaController);
video.start();
video.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
@Override
public void onCompletion(MediaPlayer vmp) {
Intent intent = new Intent(VideoBMX.this, LoginStep1.class);
startActivity(intent);
}
});
}
示例14: onCreate
import android.widget.VideoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
vv=new VideoView(this, null);
setContentView(vv,
new FrameLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT,
Gravity.CENTER));
vv.setVideoURI(getIntent().getData());
vv.setOnCompletionListener(this);
vv.start();
if (savedInstanceState!=null) {
vv.seekTo(savedInstanceState.getInt(STATE_OFFSET, 0));
}
}
示例15: onCreate
import android.widget.VideoView; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_video_view);
ActionBar ab = getSupportActionBar();
if (ab != null) {
ab.setDisplayHomeAsUpEnabled(true);
}
String imageUrl = getIntent().getStringExtra("videoUrl");
Uri uri = Uri.parse(imageUrl);
vidMessageVideo = (VideoView)findViewById(R.id.vidMessageVideo);
vidMessageVideo.setMediaController(new MediaController(this));
vidMessageVideo.setVideoURI(uri);
vidMessageVideo.requestFocus();
vidMessageVideo.start();
}