利用VideoView播放视频
来源:互联网 发布:八宝茶的软件 编辑:程序博客网 时间:2024/09/21 08:57
利用VideoView播放视频简单代码
[1].[代码] [Java]代码 跳至 [1]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
package
com.qianhua.ui;
import
android.app.Activity;
import
android.content.Intent;
import
android.media.MediaPlayer;
import
android.net.Uri;
import
android.os.Bundle;
import
android.os.Environment;
import
android.widget.MediaController;
import
android.widget.MediaController.MediaPlayerControl;
import
android.widget.VideoView;
import
com.qianhua.R;
public
class
VideoActivity
extends
Activity
implements
MediaPlayerControl {
VideoView videoView;
@Override
protected
void
onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super
.onCreate(savedInstanceState);
setContentView(R.layout.activity_video);
videoView = (VideoView) findViewById(R.id.video_view);
if
(Environment.getExternalStorageState().equals( android.os.Environment.MEDIA_MOUNTED)) {
// 可播放格式3.3gp m.mp4 a.avi ;不可播放格式f.flv
videoView.setVideoURI(Uri.parse(Environment.getExternalStorageDirectory().getPath() +
"/"
+
"mm.mp4"
));
MediaController mediaController =
new
MediaController(
this
);
videoView.setMediaController(mediaController);
videoView.start();
videoView.requestFocus();
videoView.setOnCompletionListener(
new
MediaPlayer.OnCompletionListener() {
@Override
public
void
onCompletion(MediaPlayer arg0) {
// TODO Auto-generated method stub
Intent intent=
new
Intent(VideoActivity.
this
,PersonLoginUI.
class
);
startActivity(intent);
}
});
}
}
@Override
public
boolean
canPause() {
// TODO Auto-generated method stub
videoView.canPause();
return
false
;
}
@Override
public
boolean
canSeekBackward() {
// TODO Auto-generated method stub
return
false
;
}
@Override
public
boolean
canSeekForward() {
// TODO Auto-generated method stub
return
false
;
}
@Override
public
int
getBufferPercentage() {
// TODO Auto-generated method stub
return
0
;
}
@Override
public
int
getCurrentPosition() {
// TODO Auto-generated method stub
return
0
;
}
@Override
public
int
getDuration() {
// TODO Auto-generated method stub
return
0
;
}
@Override
public
boolean
isPlaying() {
// TODO Auto-generated method stub
return
false
;
}
@Override
public
void
pause() {
// TODO Auto-generated method stub
if
(videoView.isPlaying()){
videoView.pause();
}
}
@Override
public
void
seekTo(
int
arg0) {
// TODO Auto-generated method stub
videoView.seekTo(arg0);
}
@Override
public
void
start() {
// TODO Auto-generated method stub
if
(!videoView.isPlaying()) {
videoView.start();
}
}
}
0 0
- 利用VideoView播放视频
- 利用VideoView播放视频
- android利用VideoView实现视频全屏播放
- Android:利用VideoView实现视频播放器
- Android VideoView播放视频
- VideoView播放视频
- Android VideoView播放视频
- 使用VideoView播放视频
- 播放视频-VideoView用法
- VideoView简单视频播放
- Android VideoView播放视频
- Android VideoView播放视频
- Android VideoView播放视频
- VideoView播放视频
- android videoview播放视频
- android---视频播放---VideoView
- 使用VideoView播放视频
- videoview实现视频播放
- 哇靠百科 - 一款聚合了众多笑话段子、妹子图、微信公众号文章的Android App
- 告诉你一个事实 缓冲区也是windows的一种资源 必须通过句柄来间接Access
- 时间显示
- PHP正则表达式替换所有HTML标签
- JAVA实现简单四则混合运算
- 利用VideoView播放视频
- ubuntu 14.04 编译 android 4.2出错总结
- rk3128 camera sensor的注册
- RK3188上运行Ubuntu系统
- 仿网易新闻客户端
- HTML基础知识总结
- android 框架,注解式获取控件,网络模块。
- 事件委托反射程序集小总结
- springMVC表单提交地址跳转引出的问题