Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
NotesChapter
GSYVideoPlayer
提交
a9b56917
G
GSYVideoPlayer
项目概览
NotesChapter
/
GSYVideoPlayer
与 Fork 源项目一致
从无法访问的项目Fork
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
GSYVideoPlayer
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
a9b56917
编写于
7月 03, 2017
作者:
S
shuyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加统一配置类GSYVideoBuilder,增加了一些类型判断 (2017-07-03)
上级
19a8d0b1
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
591 addition
and
109 deletion
+591
-109
app/src/main/java/com/example/gsyvideoplayer/DetailPlayer.java
...rc/main/java/com/example/gsyvideoplayer/DetailPlayer.java
+52
-49
app/src/main/java/com/example/gsyvideoplayer/video/LandLayoutVideo.java
...ava/com/example/gsyvideoplayer/video/LandLayoutVideo.java
+9
-7
app/src/main/res/layout/sample_video_land.xml
app/src/main/res/layout/sample_video_land.xml
+0
-21
app/src/main/res/layout/sample_video_normal.xml
app/src/main/res/layout/sample_video_normal.xml
+0
-10
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/GSYVideoPlayer.java
...rc/main/java/com/shuyu/gsyvideoplayer/GSYVideoPlayer.java
+5
-3
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/builder/GSYVideoBuilder.java
...ava/com/shuyu/gsyvideoplayer/builder/GSYVideoBuilder.java
+502
-0
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/video/GSYBaseVideoPlayer.java
...va/com/shuyu/gsyvideoplayer/video/GSYBaseVideoPlayer.java
+1
-1
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/video/NormalGSYVideoPlayer.java
.../com/shuyu/gsyvideoplayer/video/NormalGSYVideoPlayer.java
+9
-7
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/video/StandardGSYVideoPlayer.java
...om/shuyu/gsyvideoplayer/video/StandardGSYVideoPlayer.java
+13
-11
未找到文件。
app/src/main/java/com/example/gsyvideoplayer/DetailPlayer.java
浏览文件 @
a9b56917
...
...
@@ -15,6 +15,7 @@ import com.shuyu.gsyvideoplayer.GSYPreViewManager;
import
com.shuyu.gsyvideoplayer.GSYVideoManager
;
import
com.shuyu.gsyvideoplayer.GSYVideoPlayer
;
import
com.shuyu.gsyvideoplayer.builder.GSYVideoBuilder
;
import
com.shuyu.gsyvideoplayer.listener.LockClickListener
;
import
com.shuyu.gsyvideoplayer.model.VideoOptionModel
;
import
com.shuyu.gsyvideoplayer.utils.OrientationUtils
;
...
...
@@ -63,7 +64,7 @@ public class DetailPlayer extends AppCompatActivity {
//String url = "http://pl-ali.youku.com/playlist/m3u8?type=mp4&ts=1490185963&keyframe=0&vid=XMjYxOTQ1Mzg2MA==&ep=ciadGkiFU8cF4SvajD8bYyuwJiYHXJZ3rHbN%2FrYDAcZuH%2BrC6DPcqJ21TPs%3D&sid=04901859548541247bba8&token=0524&ctype=12&ev=1&oip=976319194";
//String url = "http://hls.ciguang.tv/hdtv/video.m3u8";
//String url = "https://res.exexm.com/cw_145225549855002";
detailPlayer
.
setUp
(
url
,
false
,
null
,
"测试视频"
);
//
detailPlayer.setUp(url, false, null, "测试视频");
//detailPlayer.setLooping(true);
//detailPlayer.setShowPauseCover(false);
/*VideoOptionModel videoOptionModel =
...
...
@@ -78,7 +79,8 @@ public class DetailPlayer extends AppCompatActivity {
ImageView
imageView
=
new
ImageView
(
this
);
imageView
.
setScaleType
(
ImageView
.
ScaleType
.
CENTER_CROP
);
imageView
.
setImageResource
(
R
.
mipmap
.
xxx1
);
detailPlayer
.
setThumbImageView
(
imageView
);
//detailPlayer.setThumbImageView(imageView);
resolveNormalVideoUI
();
...
...
@@ -87,15 +89,54 @@ public class DetailPlayer extends AppCompatActivity {
//初始化不打开外部的旋转
orientationUtils
.
setEnable
(
false
);
detailPlayer
.
setIsTouchWiget
(
true
);
//detailPlayer.setIsTouchWigetFull(false);
//关闭自动旋转
detailPlayer
.
setRotateViewAuto
(
false
);
detailPlayer
.
setLockLand
(
false
);
detailPlayer
.
setShowFullAnimation
(
false
);
detailPlayer
.
setNeedLockFull
(
true
);
detailPlayer
.
setSeekRatio
(
1
);
//detailPlayer.setOpenPreView(false);
GSYVideoBuilder
gsyVideoBuilder
=
new
GSYVideoBuilder
();
gsyVideoBuilder
.
setThumbImageView
(
imageView
)
.
setIsTouchWiget
(
true
)
.
setRotateViewAuto
(
false
)
.
setLockLand
(
false
)
.
setShowFullAnimation
(
false
)
.
setNeedLockFull
(
true
)
.
setSeekRatio
(
1
)
.
setUrl
(
url
)
.
setCacheWithPlay
(
false
)
.
setVideoTitle
(
"测试视频"
)
.
setStandardVideoAllCallBack
(
new
SampleListener
()
{
@Override
public
void
onPrepared
(
String
url
,
Object
...
objects
)
{
super
.
onPrepared
(
url
,
objects
);
//开始播放了才能旋转和全屏
orientationUtils
.
setEnable
(
true
);
isPlay
=
true
;
}
@Override
public
void
onAutoComplete
(
String
url
,
Object
...
objects
)
{
super
.
onAutoComplete
(
url
,
objects
);
}
@Override
public
void
onClickStartError
(
String
url
,
Object
...
objects
)
{
super
.
onClickStartError
(
url
,
objects
);
}
@Override
public
void
onQuitFullscreen
(
String
url
,
Object
...
objects
)
{
super
.
onQuitFullscreen
(
url
,
objects
);
if
(
orientationUtils
!=
null
)
{
orientationUtils
.
backToProtVideo
();
}
}
})
.
setLockClickListener
(
new
LockClickListener
()
{
@Override
public
void
onClick
(
View
view
,
boolean
lock
)
{
if
(
orientationUtils
!=
null
)
{
//配合下方的onConfigurationChanged
orientationUtils
.
setEnable
(!
lock
);
}
}
}).
build
(
detailPlayer
);
detailPlayer
.
getFullscreenButton
().
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
...
...
@@ -107,44 +148,6 @@ public class DetailPlayer extends AppCompatActivity {
}
});
detailPlayer
.
setStandardVideoAllCallBack
(
new
SampleListener
()
{
@Override
public
void
onPrepared
(
String
url
,
Object
...
objects
)
{
super
.
onPrepared
(
url
,
objects
);
//开始播放了才能旋转和全屏
orientationUtils
.
setEnable
(
true
);
isPlay
=
true
;
}
@Override
public
void
onAutoComplete
(
String
url
,
Object
...
objects
)
{
super
.
onAutoComplete
(
url
,
objects
);
}
@Override
public
void
onClickStartError
(
String
url
,
Object
...
objects
)
{
super
.
onClickStartError
(
url
,
objects
);
}
@Override
public
void
onQuitFullscreen
(
String
url
,
Object
...
objects
)
{
super
.
onQuitFullscreen
(
url
,
objects
);
if
(
orientationUtils
!=
null
)
{
orientationUtils
.
backToProtVideo
();
}
}
});
detailPlayer
.
setLockClickListener
(
new
LockClickListener
()
{
@Override
public
void
onClick
(
View
view
,
boolean
lock
)
{
if
(
orientationUtils
!=
null
)
{
//配合下方的onConfigurationChanged
orientationUtils
.
setEnable
(!
lock
);
}
}
});
}
@Override
...
...
app/src/main/java/com/example/gsyvideoplayer/video/LandLayoutVideo.java
浏览文件 @
a9b56917
...
...
@@ -41,13 +41,15 @@ public class LandLayoutVideo extends StandardGSYVideoPlayer {
@Override
protected
void
updateStartImage
()
{
if
(
mIfCurrentIsFullscreen
)
{
ImageView
imageView
=
(
ImageView
)
mStartButton
;
if
(
mCurrentState
==
CURRENT_STATE_PLAYING
)
{
imageView
.
setImageResource
(
R
.
drawable
.
video_click_pause_selector
);
}
else
if
(
mCurrentState
==
CURRENT_STATE_ERROR
)
{
imageView
.
setImageResource
(
R
.
drawable
.
video_click_play_selector
);
}
else
{
imageView
.
setImageResource
(
R
.
drawable
.
video_click_play_selector
);
if
(
mStartButton
instanceof
ImageView
)
{
ImageView
imageView
=
(
ImageView
)
mStartButton
;
if
(
mCurrentState
==
CURRENT_STATE_PLAYING
)
{
imageView
.
setImageResource
(
R
.
drawable
.
video_click_pause_selector
);
}
else
if
(
mCurrentState
==
CURRENT_STATE_ERROR
)
{
imageView
.
setImageResource
(
R
.
drawable
.
video_click_play_selector
);
}
else
{
imageView
.
setImageResource
(
R
.
drawable
.
video_click_play_selector
);
}
}
}
else
{
super
.
updateStartImage
();
...
...
app/src/main/res/layout/sample_video_land.xml
浏览文件 @
a9b56917
...
...
@@ -82,16 +82,6 @@
android:text=
"00:00"
android:textColor=
"#ffffff"
/>
<TextView
android:id=
"@+id/switchSize"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_marginRight=
"16dp"
android:gravity=
"center"
android:minEms=
"2"
android:text=
"标准"
android:textColor=
"#ffffff"
/>
<ImageView
android:id=
"@+id/fullscreen"
android:layout_width=
"wrap_content"
...
...
@@ -174,17 +164,6 @@
android:paddingLeft=
"10dp"
android:textColor=
"@android:color/white"
android:textSize=
"18sp"
/>
<TextView
android:id=
"@+id/moreScale"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:gravity=
"center"
android:minEms=
"5"
android:paddingLeft=
"10dp"
android:text=
"默认比例"
android:textColor=
"@android:color/white"
android:textSize=
"13sp"
/>
</LinearLayout>
...
...
app/src/main/res/layout/sample_video_normal.xml
浏览文件 @
a9b56917
...
...
@@ -73,16 +73,6 @@
android:text=
"00:00"
android:textColor=
"#ffffff"
/>
<TextView
android:id=
"@+id/switchSize"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_marginRight=
"16dp"
android:gravity=
"center"
android:minEms=
"2"
android:text=
"标准"
android:textColor=
"#ffffff"
/>
<ImageView
android:id=
"@+id/fullscreen"
android:layout_width=
"wrap_content"
...
...
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/GSYVideoPlayer.java
浏览文件 @
a9b56917
...
...
@@ -264,7 +264,7 @@ public abstract class GSYVideoPlayer extends GSYBaseVideoPlayer implements View.
(
System
.
currentTimeMillis
()
-
CLICK_QUIT_FULLSCREEN_TIME
)
<
FULL_SCREEN_NORMAL_DELAY
)
return
false
;
mCurrentState
=
CURRENT_STATE_NORMAL
;
if
(
cacheWithPlay
&&
url
.
startsWith
(
"http"
)
&&
!
url
.
contains
(
"127.0.0.1"
))
{
if
(
cacheWithPlay
&&
url
.
startsWith
(
"http"
)
&&
!
url
.
contains
(
"127.0.0.1"
)
&&
!
url
.
contains
(
".m3u8"
)
)
{
HttpProxyCacheServer
proxy
=
GSYVideoManager
.
getProxy
(
getContext
().
getApplicationContext
(),
cachePath
);
//此处转换了url,然后再赋值给mUrl。
url
=
proxy
.
getProxyUrl
(
url
);
...
...
@@ -273,7 +273,8 @@ public abstract class GSYVideoPlayer extends GSYBaseVideoPlayer implements View.
if
(!
mCacheFile
&&
GSYVideoManager
.
instance
()
!=
null
)
{
proxy
.
registerCacheListener
(
GSYVideoManager
.
instance
(),
mOriginUrl
);
}
}
else
if
(!
cacheWithPlay
&&
(!
url
.
startsWith
(
"http"
)
&&
!
url
.
startsWith
(
"rtmp"
)
&&
!
url
.
startsWith
(
"rtsp"
)))
{
}
else
if
(!
cacheWithPlay
&&
(!
url
.
startsWith
(
"http"
)
&&
!
url
.
startsWith
(
"rtmp"
)
&&
!
url
.
startsWith
(
"rtsp"
)
&&
!
url
.
contains
(
".m3u8"
)))
{
mCacheFile
=
true
;
}
this
.
mUrl
=
url
;
...
...
@@ -1041,7 +1042,8 @@ public abstract class GSYVideoPlayer extends GSYBaseVideoPlayer implements View.
* 清除当前缓存
*/
public
void
clearCurrentCache
()
{
if
(
mCacheFile
)
{
//只有都为true时,才是缓存文件
if
(
mCacheFile
&&
mCache
)
{
//是否为缓存文件
Debuger
.
printfError
(
" mCacheFile Local Error "
+
mUrl
);
//可能是因为缓存文件除了问题
...
...
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/builder/GSYVideoBuilder.java
0 → 100644
浏览文件 @
a9b56917
package
com.shuyu.gsyvideoplayer.builder
;
import
android.graphics.drawable.Drawable
;
import
android.view.View
;
import
com.shuyu.gsyvideoplayer.GSYVideoPlayer
;
import
com.shuyu.gsyvideoplayer.listener.LockClickListener
;
import
com.shuyu.gsyvideoplayer.listener.StandardVideoAllCallBack
;
import
com.shuyu.gsyvideoplayer.listener.VideoAllCallBack
;
import
com.shuyu.gsyvideoplayer.video.GSYBaseVideoPlayer
;
import
com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
;
import
java.io.File
;
import
java.util.Map
;
/**
* Created by guoshuyu on 2017/7/3.
* <p>
* 配置工具类吧。
* <p>
* 不是一个正常的Builder,这只是集合了所有设置配置而已.
* 每个配置其实可以在对应的video接口中找到单独设置
* 这只是方便使用
*/
public
class
GSYVideoBuilder
{
/******************************* GSYBaseVideoPlayer *****************************************/
protected
boolean
mHideKey
=
true
;
//是否隐藏虚拟按键
protected
boolean
mShowFullAnimation
=
true
;
//是否使用全屏动画效果
protected
boolean
mNeedShowWifiTip
=
true
;
//是否需要显示流量提示
protected
boolean
mRotateViewAuto
=
true
;
//是否自动旋转
protected
boolean
mLockLand
=
false
;
//当前全屏是否锁定全屏
protected
boolean
mLooping
=
false
;
//循环
protected
boolean
mIsTouchWiget
=
true
;
//是否支持非全屏滑动触摸有效
protected
boolean
mIsTouchWigetFull
=
true
;
//是否支持全屏滑动触摸有效
protected
boolean
mShowPauseCover
=
true
;
//是否显示暂停图片
protected
boolean
mRotateWithSystem
=
true
;
//旋转使能后是否跟随系统设置
protected
float
mSeekRatio
=
1
;
//触摸滑动进度的比例系数
protected
float
mSpeed
=
1
;
//播放速度
protected
int
mShrinkImageRes
=
-
1
;
//退出全屏显示的案件图片
protected
int
mEnlargeImageRes
=
-
1
;
//全屏显示的案件图片
protected
VideoAllCallBack
mVideoAllCallBack
;
/**
* 全屏动画
*
* @param showFullAnimation 是否使用全屏动画效果
*/
public
GSYVideoBuilder
setShowFullAnimation
(
boolean
showFullAnimation
)
{
this
.
mShowFullAnimation
=
showFullAnimation
;
return
this
;
}
/**
* 设置循环
*/
public
GSYVideoBuilder
setLooping
(
boolean
looping
)
{
this
.
mLooping
=
looping
;
return
this
;
}
/**
* 设置播放过程中的回调
*
* @param mVideoAllCallBack
*/
public
GSYVideoBuilder
setVideoAllCallBack
(
VideoAllCallBack
mVideoAllCallBack
)
{
this
.
mVideoAllCallBack
=
mVideoAllCallBack
;
return
this
;
}
/**
* 是否开启自动旋转
*/
public
GSYVideoBuilder
setRotateViewAuto
(
boolean
rotateViewAuto
)
{
this
.
mRotateViewAuto
=
rotateViewAuto
;
return
this
;
}
/**
* 一全屏就锁屏横屏,默认false竖屏,可配合setRotateViewAuto使用
*/
public
GSYVideoBuilder
setLockLand
(
boolean
lockLand
)
{
this
.
mLockLand
=
lockLand
;
return
this
;
}
/**
* 播放速度
*/
public
GSYVideoBuilder
setSpeed
(
float
speed
)
{
this
.
mSpeed
=
speed
;
return
this
;
}
/**
* 全屏隐藏虚拟按键,默认打开
*/
public
GSYVideoBuilder
setHideKey
(
boolean
hideKey
)
{
this
.
mHideKey
=
hideKey
;
return
this
;
}
/**
* 是否可以滑动界面改变进度,声音等
* 默认true
*/
public
GSYVideoBuilder
setIsTouchWiget
(
boolean
isTouchWiget
)
{
this
.
mIsTouchWiget
=
isTouchWiget
;
return
this
;
}
/**
* 是否可以全屏滑动界面改变进度,声音等
* 默认 true
*/
public
GSYVideoBuilder
setIsTouchWigetFull
(
boolean
isTouchWigetFull
)
{
this
.
mIsTouchWigetFull
=
isTouchWigetFull
;
return
this
;
}
/**
* 是否需要显示流量提示,默认true
*/
public
GSYVideoBuilder
setNeedShowWifiTip
(
boolean
needShowWifiTip
)
{
this
.
mNeedShowWifiTip
=
needShowWifiTip
;
return
this
;
}
/**
* 设置右下角 显示切换到全屏 的按键资源
* 必须在setUp之前设置
* 不设置使用默认
*/
public
GSYVideoBuilder
setEnlargeImageRes
(
int
mEnlargeImageRes
)
{
this
.
mEnlargeImageRes
=
mEnlargeImageRes
;
return
this
;
}
/**
* 设置右下角 显示退出全屏 的按键资源
* 必须在setUp之前设置
* 不设置使用默认
*/
public
GSYVideoBuilder
setShrinkImageRes
(
int
mShrinkImageRes
)
{
this
.
mShrinkImageRes
=
mShrinkImageRes
;
return
this
;
}
/**
* 是否需要加载显示暂停的cover图片
* 打开状态下,暂停退到后台,再回到前台不会显示黑屏,但可以对某些机型有概率出现OOM
* 关闭情况下,暂停退到后台,再回到前台显示黑屏
*
* @param showPauseCover 默认true
*/
public
GSYVideoBuilder
setShowPauseCover
(
boolean
showPauseCover
)
{
this
.
mShowPauseCover
=
showPauseCover
;
return
this
;
}
/**
* 调整触摸滑动快进的比例
*
* @param seekRatio 滑动快进的比例,默认1。数值越大,滑动的产生的seek越小
*/
public
GSYVideoBuilder
setSeekRatio
(
float
seekRatio
)
{
if
(
seekRatio
<
0
)
{
return
this
;
}
this
.
mSeekRatio
=
seekRatio
;
return
this
;
}
/**
* 是否更新系统旋转,false的话,系统禁止旋转也会跟着旋转
*
* @param rotateWithSystem 默认true
*/
public
GSYVideoBuilder
setRotateWithSystem
(
boolean
rotateWithSystem
)
{
this
.
mRotateWithSystem
=
rotateWithSystem
;
return
this
;
}
/******************************* GSYVideoPlayer *****************************************/
protected
String
mPlayTag
=
""
;
//播放的tag,防止错误,因为普通的url也可能重复
protected
String
mUrl
;
protected
String
mVideoTitle
=
null
;
protected
int
mPlayPosition
=
-
22
;
//播放的tag,防止错误,因为普通的url也可能重复
protected
long
mSeekOnStart
=
-
1
;
//从哪个开始播放
protected
boolean
mCacheWithPlay
;
protected
File
mCachePath
;
protected
Map
<
String
,
String
>
mMapHeadData
;
/**
* 播放tag防止错误,因为普通的url也可能重复
*
* @param playTag 保证不重复就好
*/
public
GSYVideoBuilder
setPlayTag
(
String
playTag
)
{
this
.
mPlayTag
=
playTag
;
return
this
;
}
/**
* 设置播放位置防止错位
*/
public
GSYVideoBuilder
setPlayPosition
(
int
playPosition
)
{
this
.
mPlayPosition
=
playPosition
;
return
this
;
}
/**
* 从哪里开始播放
* 目前有时候前几秒有跳动问题,毫秒
* 需要在startPlayLogic之前,即播放开始之前
*/
public
GSYVideoBuilder
setSeekOnStart
(
long
seekOnStart
)
{
this
.
mSeekOnStart
=
seekOnStart
;
return
this
;
}
/**
* 播放url
*
* @param url
*/
public
GSYVideoBuilder
setUrl
(
String
url
)
{
this
.
mUrl
=
url
;
return
this
;
}
/**
* 视频title
*
* @param videoTitle
*/
public
GSYVideoBuilder
setVideoTitle
(
String
videoTitle
)
{
this
.
mVideoTitle
=
videoTitle
;
return
this
;
}
/**
* 是否边缓存,m3u8等无效
*
* @param cacheWithPlay
*/
public
GSYVideoBuilder
setCacheWithPlay
(
boolean
cacheWithPlay
)
{
this
.
mCacheWithPlay
=
cacheWithPlay
;
return
this
;
}
/**
* 自定指定缓存路径,推荐不设置,使用默认路径
*
* @param cachePath
*/
public
GSYVideoBuilder
setCachePath
(
File
cachePath
)
{
this
.
mCachePath
=
cachePath
;
return
this
;
}
/**
* 设置请求的头信息
*
* @param mapHeadData
*/
public
GSYVideoBuilder
setMapHeadData
(
Map
<
String
,
String
>
mapHeadData
)
{
this
.
mMapHeadData
=
mapHeadData
;
return
this
;
}
/******************************* StandardGSYVideoPlayer *****************************************/
protected
View
mThumbImageView
;
//封面
protected
StandardVideoAllCallBack
mStandardVideoAllCallBack
;
//标准播放器的回调
protected
LockClickListener
mLockClickListener
;
//点击锁屏的回调
protected
Drawable
mBottomProgressDrawable
;
protected
Drawable
mBottomShowProgressDrawable
;
protected
Drawable
mBottomShowProgressThumbDrawable
;
protected
Drawable
mVolumeProgressDrawable
;
protected
Drawable
mDialogProgressBarDrawable
;
protected
int
mDialogProgressHighLightColor
=
-
11
;
protected
int
mDialogProgressNormalColor
=
-
11
;
protected
int
mDismissControlTime
=
2500
;
protected
boolean
mNeedLockFull
;
//是否需要锁定屏幕
protected
boolean
mThumbPlay
;
public
GSYVideoBuilder
setStandardVideoAllCallBack
(
StandardVideoAllCallBack
standardVideoAllCallBack
)
{
this
.
mStandardVideoAllCallBack
=
standardVideoAllCallBack
;
return
this
;
}
/***
* 设置封面
*/
public
GSYVideoBuilder
setThumbImageView
(
View
view
)
{
mThumbImageView
=
view
;
return
this
;
}
/**
* 底部进度条-弹出的
*/
public
GSYVideoBuilder
setBottomShowProgressBarDrawable
(
Drawable
drawable
,
Drawable
thumb
)
{
mBottomShowProgressDrawable
=
drawable
;
mBottomShowProgressThumbDrawable
=
thumb
;
return
this
;
}
/**
* 底部进度条-非弹出
*/
public
GSYVideoBuilder
setBottomProgressBarDrawable
(
Drawable
drawable
)
{
mBottomProgressDrawable
=
drawable
;
return
this
;
}
/**
* 声音进度条
*/
public
GSYVideoBuilder
setDialogVolumeProgressBar
(
Drawable
drawable
)
{
mVolumeProgressDrawable
=
drawable
;
return
this
;
}
/**
* 中间进度条
*/
public
GSYVideoBuilder
setDialogProgressBar
(
Drawable
drawable
)
{
mDialogProgressBarDrawable
=
drawable
;
return
this
;
}
/**
* 中间进度条字体颜色
*/
public
GSYVideoBuilder
setDialogProgressColor
(
int
highLightColor
,
int
normalColor
)
{
mDialogProgressHighLightColor
=
highLightColor
;
mDialogProgressNormalColor
=
normalColor
;
return
this
;
}
/**
* 是否点击封面可以播放
*/
public
GSYVideoBuilder
setThumbPlay
(
boolean
thumbPlay
)
{
this
.
mThumbPlay
=
thumbPlay
;
return
this
;
}
/**
* 是否需要全屏锁定屏幕功能
* 如果单独使用请设置setIfCurrentIsFullscreen为true
*/
public
GSYVideoBuilder
setNeedLockFull
(
boolean
needLoadFull
)
{
this
.
mNeedLockFull
=
needLoadFull
;
return
this
;
}
/**
* 锁屏点击
*/
public
GSYVideoBuilder
setLockClickListener
(
LockClickListener
lockClickListener
)
{
this
.
mLockClickListener
=
lockClickListener
;
return
this
;
}
/**
* 设置触摸显示控制ui的消失时间
*
* @param dismissControlTime 毫秒,默认2500
*/
public
GSYVideoBuilder
setDismissControlTime
(
int
dismissControlTime
)
{
this
.
mDismissControlTime
=
dismissControlTime
;
return
this
;
}
public
void
build
(
StandardGSYVideoPlayer
gsyVideoPlayer
)
{
if
(
mStandardVideoAllCallBack
!=
null
)
{
gsyVideoPlayer
.
setStandardVideoAllCallBack
(
mStandardVideoAllCallBack
);
}
if
(
mThumbImageView
!=
null
)
{
gsyVideoPlayer
.
setThumbImageView
(
mThumbImageView
);
}
if
(
mBottomShowProgressDrawable
!=
null
&&
mBottomShowProgressThumbDrawable
!=
null
)
{
gsyVideoPlayer
.
setBottomShowProgressBarDrawable
(
mBottomShowProgressDrawable
,
mBottomShowProgressThumbDrawable
);
}
if
(
mBottomProgressDrawable
!=
null
)
{
gsyVideoPlayer
.
setBottomProgressBarDrawable
(
mBottomProgressDrawable
);
}
if
(
mVolumeProgressDrawable
!=
null
)
{
gsyVideoPlayer
.
setDialogVolumeProgressBar
(
mVolumeProgressDrawable
);
}
if
(
mDialogProgressBarDrawable
!=
null
)
{
gsyVideoPlayer
.
setDialogProgressBar
(
mDialogProgressBarDrawable
);
}
if
(
mDialogProgressHighLightColor
>
0
&&
mDialogProgressNormalColor
>
0
)
{
gsyVideoPlayer
.
setDialogProgressColor
(
mDialogProgressHighLightColor
,
mDialogProgressNormalColor
);
}
gsyVideoPlayer
.
setThumbPlay
(
mThumbPlay
);
gsyVideoPlayer
.
setNeedLockFull
(
mNeedLockFull
);
if
(
mLockClickListener
!=
null
)
{
gsyVideoPlayer
.
setLockClickListener
(
mLockClickListener
);
}
gsyVideoPlayer
.
setDismissControlTime
(
mDismissControlTime
);
build
((
GSYVideoPlayer
)
gsyVideoPlayer
);
}
public
void
build
(
GSYVideoPlayer
gsyVideoPlayer
)
{
build
((
GSYBaseVideoPlayer
)
gsyVideoPlayer
);
gsyVideoPlayer
.
setPlayTag
(
mPlayTag
);
gsyVideoPlayer
.
setPlayPosition
(
mPlayPosition
);
if
(
mSeekOnStart
>
0
)
{
gsyVideoPlayer
.
setSeekOnStart
(
mSeekOnStart
);
}
gsyVideoPlayer
.
setUp
(
mUrl
,
mCacheWithPlay
,
mCachePath
,
mMapHeadData
,
mVideoTitle
);
}
public
void
build
(
GSYBaseVideoPlayer
gsyVideoPlayer
)
{
gsyVideoPlayer
.
setShowFullAnimation
(
mShowFullAnimation
);
gsyVideoPlayer
.
setLooping
(
mLooping
);
if
(
mStandardVideoAllCallBack
==
null
)
{
gsyVideoPlayer
.
setVideoAllCallBack
(
mVideoAllCallBack
);
}
gsyVideoPlayer
.
setRotateViewAuto
(
mRotateViewAuto
);
gsyVideoPlayer
.
setLockLand
(
mLockLand
);
gsyVideoPlayer
.
setSpeed
(
mSpeed
);
gsyVideoPlayer
.
setHideKey
(
mHideKey
);
gsyVideoPlayer
.
setIsTouchWiget
(
mIsTouchWiget
);
gsyVideoPlayer
.
setIsTouchWigetFull
(
mIsTouchWigetFull
);
gsyVideoPlayer
.
setNeedShowWifiTip
(
mNeedShowWifiTip
);
if
(
mEnlargeImageRes
>
0
)
{
gsyVideoPlayer
.
setEnlargeImageRes
(
mEnlargeImageRes
);
}
if
(
mShrinkImageRes
>
0
)
{
gsyVideoPlayer
.
setShrinkImageRes
(
mShrinkImageRes
);
}
gsyVideoPlayer
.
setShowPauseCover
(
mShowPauseCover
);
gsyVideoPlayer
.
setSeekRatio
(
mSeekRatio
);
gsyVideoPlayer
.
setRotateWithSystem
(
mRotateWithSystem
);
}
}
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/video/GSYBaseVideoPlayer.java
浏览文件 @
a9b56917
...
...
@@ -81,7 +81,7 @@ public abstract class GSYBaseVideoPlayer extends FrameLayout implements GSYMedia
protected
float
mSeekRatio
=
1
;
//触摸滑动进度的比例系数
protected
float
mSpeed
=
1
;
//播放速度
,只支持6.0以上
protected
float
mSpeed
=
1
;
//播放速度
protected
boolean
mRotateViewAuto
=
true
;
//是否自动旋转
...
...
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/video/NormalGSYVideoPlayer.java
浏览文件 @
a9b56917
...
...
@@ -35,13 +35,15 @@ public class NormalGSYVideoPlayer extends StandardGSYVideoPlayer {
@Override
protected
void
updateStartImage
()
{
ImageView
imageView
=
(
ImageView
)
mStartButton
;
if
(
mCurrentState
==
CURRENT_STATE_PLAYING
)
{
imageView
.
setImageResource
(
R
.
drawable
.
video_click_pause_selector
);
}
else
if
(
mCurrentState
==
CURRENT_STATE_ERROR
)
{
imageView
.
setImageResource
(
R
.
drawable
.
video_click_play_selector
);
}
else
{
imageView
.
setImageResource
(
R
.
drawable
.
video_click_play_selector
);
if
(
mStartButton
instanceof
ImageView
)
{
ImageView
imageView
=
(
ImageView
)
mStartButton
;
if
(
mCurrentState
==
CURRENT_STATE_PLAYING
)
{
imageView
.
setImageResource
(
R
.
drawable
.
video_click_pause_selector
);
}
else
if
(
mCurrentState
==
CURRENT_STATE_ERROR
)
{
imageView
.
setImageResource
(
R
.
drawable
.
video_click_play_selector
);
}
else
{
imageView
.
setImageResource
(
R
.
drawable
.
video_click_play_selector
);
}
}
}
}
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/video/StandardGSYVideoPlayer.java
浏览文件 @
a9b56917
...
...
@@ -609,17 +609,19 @@ public class StandardGSYVideoPlayer extends GSYVideoPlayer {
}
protected
void
updateStartImage
()
{
ENPlayView
enPlayView
=
(
ENPlayView
)
mStartButton
;
enPlayView
.
setDuration
(
500
);
if
(
mCurrentState
==
CURRENT_STATE_PLAYING
)
{
enPlayView
.
play
();
//mStartButton.setImageResource(R.drawable.video_click_pause_selector);
}
else
if
(
mCurrentState
==
CURRENT_STATE_ERROR
)
{
enPlayView
.
pause
();
//mStartButton.setImageResource(R.drawable.video_click_error_selector);
}
else
{
enPlayView
.
pause
();
//mStartButton.setImageResource(R.drawable.video_click_play_selector);
if
(
mStartButton
instanceof
ENPlayView
)
{
ENPlayView
enPlayView
=
(
ENPlayView
)
mStartButton
;
enPlayView
.
setDuration
(
500
);
if
(
mCurrentState
==
CURRENT_STATE_PLAYING
)
{
enPlayView
.
play
();
//mStartButton.setImageResource(R.drawable.video_click_pause_selector);
}
else
if
(
mCurrentState
==
CURRENT_STATE_ERROR
)
{
enPlayView
.
pause
();
//mStartButton.setImageResource(R.drawable.video_click_error_selector);
}
else
{
enPlayView
.
pause
();
//mStartButton.setImageResource(R.drawable.video_click_play_selector);
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录