Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_26386469
GSYVideoPlayer
提交
a59f8071
G
GSYVideoPlayer
项目概览
qq_26386469
/
GSYVideoPlayer
与 Fork 源项目一致
从无法访问的项目Fork
通知
5
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 搜索 >>
提交
a59f8071
编写于
9月 14, 2017
作者:
S
shuyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加 GSYBaseActivityDetail DEMO (2017-09-14)
上级
08188d00
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
37 addition
and
107 deletion
+37
-107
app/src/main/java/com/example/gsyvideoplayer/WebDetailActivity.java
...in/java/com/example/gsyvideoplayer/WebDetailActivity.java
+37
-107
未找到文件。
app/src/main/java/com/example/gsyvideoplayer/WebDetailActivity.java
浏览文件 @
a59f8071
package
com.example.gsyvideoplayer
;
package
com.example.gsyvideoplayer
;
import
android.content.pm.ActivityInfo
;
import
android.content.res.Configuration
;
import
android.content.res.Configuration
;
import
android.graphics.Point
;
import
android.graphics.Point
;
import
android.os.Bundle
;
import
android.os.Bundle
;
...
@@ -11,15 +10,18 @@ import android.webkit.WebSettings;
...
@@ -11,15 +10,18 @@ import android.webkit.WebSettings;
import
android.widget.ImageView
;
import
android.widget.ImageView
;
import
android.widget.RelativeLayout
;
import
android.widget.RelativeLayout
;
import
com.bumptech.glide.Glide
;
import
com.bumptech.glide.request.RequestOptions
;
import
com.example.gsyvideoplayer.listener.SampleListener
;
import
com.example.gsyvideoplayer.listener.SampleListener
;
import
com.example.gsyvideoplayer.video.PreViewGSYVideoPlayer
;
import
com.example.gsyvideoplayer.video.PreViewGSYVideoPlayer
;
import
com.example.gsyvideoplayer.view.ScrollWebView
;
import
com.example.gsyvideoplayer.view.ScrollWebView
;
import
com.shuyu.gsyvideoplayer.GSYBaseActivityDetail
;
import
com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
;
import
com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
;
import
com.shuyu.gsyvideoplayer.video.base.GSYBaseVideoPlayer
;
import
com.shuyu.gsyvideoplayer.video.base.GSYVideoPlayer
;
import
com.shuyu.gsyvideoplayer.video.base.GSYVideoPlayer
;
import
com.shuyu.gsyvideoplayer.listener.LockClickListener
;
import
com.shuyu.gsyvideoplayer.listener.LockClickListener
;
import
com.shuyu.gsyvideoplayer.utils.CommonUtil
;
import
com.shuyu.gsyvideoplayer.utils.CommonUtil
;
import
com.shuyu.gsyvideoplayer.utils.OrientationUtils
;
import
com.shuyu.gsyvideoplayer.utils.OrientationUtils
;
import
com.shuyu.gsyvideoplayer.video.NormalGSYVideoPlayer
;
import
com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
;
import
com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
;
import
butterknife.BindView
;
import
butterknife.BindView
;
...
@@ -29,7 +31,7 @@ import butterknife.ButterKnife;
...
@@ -29,7 +31,7 @@ import butterknife.ButterKnife;
* Created by shuyu on 2016/12/26.
* Created by shuyu on 2016/12/26.
*/
*/
public
class
WebDetailActivity
extends
AppCompatActivity
{
public
class
WebDetailActivity
extends
GSYBaseActivityDetail
{
@BindView
(
R
.
id
.
scroll_webView
)
@BindView
(
R
.
id
.
scroll_webView
)
ScrollWebView
webView
;
ScrollWebView
webView
;
...
@@ -40,80 +42,19 @@ public class WebDetailActivity extends AppCompatActivity {
...
@@ -40,80 +42,19 @@ public class WebDetailActivity extends AppCompatActivity {
@BindView
(
R
.
id
.
web_top_layout_video
)
@BindView
(
R
.
id
.
web_top_layout_video
)
RelativeLayout
webTopLayoutVideo
;
RelativeLayout
webTopLayoutVideo
;
private
boolean
isPlay
;
private
boolean
isPause
;
private
boolean
isSamll
;
private
boolean
isSamll
;
private
OrientationUtils
orientationUtils
;
@Override
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_web_detail
);
setContentView
(
R
.
layout
.
activity_web_detail
);
ButterKnife
.
bind
(
this
);
ButterKnife
.
bind
(
this
);
String
url
=
"http://baobab.wdjcdn.com/14564977406580.mp4"
;
//String url = "https://d131x7vzzf85jg.cloudfront.net/upload/documents/paper/b2/61/00/00/20160420_115018_b544.mp4";
//增加封面
ImageView
imageView
=
new
ImageView
(
this
);
imageView
.
setScaleType
(
ImageView
.
ScaleType
.
CENTER_CROP
);
imageView
.
setImageResource
(
R
.
mipmap
.
xxx1
);
resolveNormalVideoUI
();
resolveNormalVideoUI
();
//外部辅助的旋转,帮助全屏
initVideoBuilderMode
();
orientationUtils
=
new
OrientationUtils
(
this
,
webPlayer
);
//初始化不打开外部的旋转
orientationUtils
.
setEnable
(
false
);
new
GSYVideoOptionBuilder
()
.
setThumbImageView
(
imageView
)
.
setUrl
(
url
)
.
setCacheWithPlay
(
false
)
.
setVideoTitle
(
"测试视频"
)
.
setIsTouchWiget
(
true
)
.
setRotateViewAuto
(
false
)
.
setLockLand
(
false
)
.
setShowFullAnimation
(
false
)
.
setNeedLockFull
(
true
)
.
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
();
}
}
}).
build
(
webPlayer
);
webPlayer
.
getFullscreenButton
().
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
//直接横屏
orientationUtils
.
resolveByClick
();
//第一个true是否需要隐藏actionbar,第二个true是否需要隐藏statusbar
webPlayer
.
startWindowFullscreen
(
WebDetailActivity
.
this
,
true
,
true
);
}
});
webPlayer
.
setLockClickListener
(
new
LockClickListener
()
{
webPlayer
.
setLockClickListener
(
new
LockClickListener
()
{
@Override
@Override
...
@@ -163,60 +104,49 @@ public class WebDetailActivity extends AppCompatActivity {
...
@@ -163,60 +104,49 @@ public class WebDetailActivity extends AppCompatActivity {
}
}
@Override
@Override
public
void
onBackPressed
()
{
public
GSYBaseVideoPlayer
getGSYVideoPlayer
()
{
return
webPlayer
;
if
(
orientationUtils
!=
null
)
{
orientationUtils
.
backToProtVideo
();
}
if
(
StandardGSYVideoPlayer
.
backFromWindowFull
(
this
))
{
return
;
}
super
.
onBackPressed
();
}
}
@Override
@Override
protected
void
onPause
()
{
public
GSYVideoOptionBuilder
getGSYVideoOptionBuilder
()
{
getCurPlay
().
onVideoPause
();
String
url
=
"http://baobab.wdjcdn.com/14564977406580.mp4"
;
super
.
onPause
();
//String url = "https://d131x7vzzf85jg.cloudfront.net/upload/documents/paper/b2/61/00/00/20160420_115018_b544.mp4";
isPause
=
true
;
//增加封面
ImageView
imageView
=
new
ImageView
(
this
);
loadCover
(
imageView
,
url
);
return
new
GSYVideoOptionBuilder
()
.
setThumbImageView
(
imageView
)
.
setUrl
(
url
)
.
setCacheWithPlay
(
false
)
.
setVideoTitle
(
"测试视频"
)
.
setIsTouchWiget
(
true
)
.
setRotateViewAuto
(
false
)
.
setLockLand
(
false
)
.
setShowFullAnimation
(
false
)
.
setNeedLockFull
(
true
);
}
}
@Override
@Override
protected
void
onResume
()
{
public
void
clickForFullScreen
()
{
getCurPlay
().
onVideoResume
();
super
.
onResume
();
isPause
=
false
;
}
@Override
protected
void
onDestroy
()
{
super
.
onDestroy
();
if
(
isPlay
)
{
getCurPlay
().
release
();
}
//GSYPreViewManager.instance().releaseMediaPlayer();
if
(
orientationUtils
!=
null
)
orientationUtils
.
releaseListener
();
}
}
@Override
public
void
onConfigurationChanged
(
Configuration
newConfig
)
{
super
.
onConfigurationChanged
(
newConfig
);
//如果旋转了就全屏
if
(
isPlay
&&
!
isPause
&&
!
isSamll
)
{
webPlayer
.
onConfigurationChanged
(
this
,
newConfig
,
orientationUtils
);
}
}
private
void
loadCover
(
ImageView
imageView
,
String
url
)
{
imageView
.
setScaleType
(
ImageView
.
ScaleType
.
CENTER_CROP
);
imageView
.
setImageResource
(
R
.
mipmap
.
xxx1
);
private
GSYVideoPlayer
getCurPlay
()
{
Glide
.
with
(
this
.
getApplicationContext
())
if
(
webPlayer
.
getFullWindowPlayer
()
!=
null
)
{
.
setDefaultRequestOptions
(
return
webPlayer
.
getFullWindowPlayer
();
new
RequestOptions
()
}
.
frame
(
3000000
)
return
webPlayer
;
.
centerCrop
()
.
error
(
R
.
mipmap
.
xxx2
)
.
placeholder
(
R
.
mipmap
.
xxx1
))
.
load
(
url
)
.
into
(
imageView
);
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录