Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_25606643
ijkplayer
提交
e732f7a5
I
ijkplayer
项目概览
qq_25606643
/
ijkplayer
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
ijkplayer
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e732f7a5
编写于
6月 29, 2013
作者:
Z
Zhang Rui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
MediaController: fix position/duration show
上级
f6d3585b
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
22 addition
and
18 deletion
+22
-18
ijkmediawidget/src/tv/danmaku/ijk/media/widget/MediaController.java
...dget/src/tv/danmaku/ijk/media/widget/MediaController.java
+11
-11
ijkmediawidget/src/tv/danmaku/ijk/media/widget/VideoView.java
...ediawidget/src/tv/danmaku/ijk/media/widget/VideoView.java
+11
-7
未找到文件。
ijkmediawidget/src/tv/danmaku/ijk/media/widget/MediaController.java
浏览文件 @
e732f7a5
...
...
@@ -83,7 +83,7 @@ public class MediaController extends FrameLayout {
private
TextView
mFileName
;
private
OutlineTextView
mInfoView
;
private
String
mTitle
;
private
long
mDuration
;
private
int
mDuration
;
private
boolean
mShowing
;
private
boolean
mDragging
;
private
boolean
mInstantSeeking
=
true
;
...
...
@@ -364,8 +364,8 @@ public class MediaController extends FrameLayout {
if
(
mPlayer
==
null
||
mDragging
)
return
0
;
long
position
=
mPlayer
.
getCurrentPosition
();
long
duration
=
mPlayer
.
getDuration
();
int
position
=
mPlayer
.
getCurrentPosition
();
int
duration
=
mPlayer
.
getDuration
();
if
(
mProgress
!=
null
)
{
if
(
duration
>
0
)
{
long
pos
=
1000L
*
position
/
duration
;
...
...
@@ -385,12 +385,12 @@ public class MediaController extends FrameLayout {
return
position
;
}
private
static
String
generateTime
(
long
position
)
{
long
totalSeconds
=
position
/
1000
;
private
static
String
generateTime
(
int
position
)
{
int
totalSeconds
=
position
/
1000
;
long
seconds
=
totalSeconds
%
60
;
long
minutes
=
(
totalSeconds
/
60
)
%
60
;
long
hours
=
totalSeconds
/
3600
;
int
seconds
=
totalSeconds
%
60
;
int
minutes
=
(
totalSeconds
/
60
)
%
60
;
int
hours
=
totalSeconds
/
3600
;
if
(
hours
>
0
)
{
return
String
.
format
(
Locale
.
US
,
"%02d:%02d:%02d"
,
hours
,
minutes
,
...
...
@@ -485,7 +485,7 @@ public class MediaController extends FrameLayout {
if
(!
fromuser
)
return
;
long
newposition
=
(
mDuration
*
progress
)
/
1000
;
int
newposition
=
(
mDuration
*
progress
)
/
1000
;
String
time
=
generateTime
(
newposition
);
if
(
mInstantSeeking
)
mPlayer
.
seekTo
(
newposition
);
...
...
@@ -525,9 +525,9 @@ public class MediaController extends FrameLayout {
void
pause
();
long
getDuration
();
int
getDuration
();
long
getCurrentPosition
();
int
getCurrentPosition
();
void
seekTo
(
long
pos
);
...
...
ijkmediawidget/src/tv/danmaku/ijk/media/widget/VideoView.java
浏览文件 @
e732f7a5
...
...
@@ -594,21 +594,25 @@ public class VideoView extends SurfaceView implements
}
@Override
public
long
getDuration
()
{
public
int
getDuration
()
{
if
(
isInPlaybackState
())
{
if
(
mDuration
>
0
)
return
mDuration
;
return
(
int
)
mDuration
;
mDuration
=
mMediaPlayer
.
getDuration
();
return
mDuration
;
DebugLog
.
efmt
(
TAG
,
"duration:%d"
,
(
int
)
mDuration
);
return
(
int
)
mDuration
;
}
mDuration
=
-
1
;
return
mDuration
;
return
(
int
)
mDuration
;
}
@Override
public
long
getCurrentPosition
()
{
if
(
isInPlaybackState
())
return
mMediaPlayer
.
getCurrentPosition
();
public
int
getCurrentPosition
()
{
if
(
isInPlaybackState
())
{
long
position
=
mMediaPlayer
.
getCurrentPosition
();
DebugLog
.
efmt
(
TAG
,
"position:%d"
,
(
int
)
position
);
return
(
int
)
position
;
}
return
0
;
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录