Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
ac13
GSYVideoPlayer
提交
18d2a091
G
GSYVideoPlayer
项目概览
ac13
/
GSYVideoPlayer
与 Fork 源项目一致
从无法访问的项目Fork
通知
7
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 搜索 >>
提交
18d2a091
编写于
12月 01, 2016
作者:
S
shuyu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1.3.7 优化了暂停的时候全屏/恢复全屏会是黑色的问题
上级
3b17371f
变更
6
显示空白变更内容
内联
并排
Showing
6 changed file
with
96 addition
and
12 deletion
+96
-12
README.md
README.md
+2
-0
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/GSYVideoPlayer.java
...rc/main/java/com/shuyu/gsyvideoplayer/GSYVideoPlayer.java
+36
-2
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/video/GSYBaseVideoPlayer.java
...va/com/shuyu/gsyvideoplayer/video/GSYBaseVideoPlayer.java
+49
-5
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/video/StandardGSYVideoPlayer.java
...om/shuyu/gsyvideoplayer/video/StandardGSYVideoPlayer.java
+1
-3
gsyVideoPlayer/src/main/res/drawable/empty_drawable.xml
gsyVideoPlayer/src/main/res/drawable/empty_drawable.xml
+7
-0
gsyVideoPlayer/src/main/res/layout/video_layout_standard.xml
gsyVideoPlayer/src/main/res/layout/video_layout_standard.xml
+1
-2
未找到文件。
README.md
浏览文件 @
18d2a091
...
...
@@ -15,6 +15,8 @@
## [简书详解入口](http://www.jianshu.com/p/9fe377dd9750)
## 下方个版本说明,可以当做简单的wiki使用~。
```
<dependency>
<groupId>com.shuyu</groupId>
...
...
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/GSYVideoPlayer.java
浏览文件 @
18d2a091
...
...
@@ -77,10 +77,10 @@ public abstract class GSYVideoPlayer extends GSYBaseVideoPlayer implements View.
protected
ImageView
mFullscreenButton
;
protected
TextView
mCurrentTimeTextView
,
mTotalTimeTextView
;
protected
ViewGroup
mTopContainer
,
mBottomContainer
;
protected
GSYTextureView
mTextureView
;
protected
Surface
mSurface
;
protected
ImageView
mBackButton
;
protected
ProgressTimerTask
mProgressTimerTask
;
protected
AudioManager
mAudioManager
;
//音频焦点的监听
...
...
@@ -160,6 +160,7 @@ public abstract class GSYVideoPlayer extends GSYBaseVideoPlayer implements View.
mStartButton
=
findViewById
(
R
.
id
.
start
);
mSmallClose
=
findViewById
(
R
.
id
.
small_close
);
mBackButton
=
(
ImageView
)
findViewById
(
R
.
id
.
back
);
mCoverImageView
=
(
ImageView
)
findViewById
(
R
.
id
.
cover
);
mFullscreenButton
=
(
ImageView
)
findViewById
(
R
.
id
.
fullscreen
);
mProgressBar
=
(
SeekBar
)
findViewById
(
R
.
id
.
progress
);
mCurrentTimeTextView
=
(
TextView
)
findViewById
(
R
.
id
.
current
);
...
...
@@ -489,6 +490,8 @@ public abstract class GSYVideoPlayer extends GSYBaseVideoPlayer implements View.
public
void
onSurfaceTextureAvailable
(
SurfaceTexture
surface
,
int
width
,
int
height
)
{
mSurface
=
new
Surface
(
surface
);
GSYVideoManager
.
instance
().
setDisplay
(
mSurface
);
//显示暂停切换显示的图片
showPauseCover
();
}
@Override
...
...
@@ -506,7 +509,8 @@ public abstract class GSYVideoPlayer extends GSYBaseVideoPlayer implements View.
@Override
public
void
onSurfaceTextureUpdated
(
SurfaceTexture
surface
)
{
//如果播放的是暂停全屏了
releasePauseCover
();
}
/**
...
...
@@ -638,6 +642,36 @@ public abstract class GSYVideoPlayer extends GSYBaseVideoPlayer implements View.
return
false
;
}
/**
* 显示暂停切换显示的bitmap
*/
protected
void
showPauseCover
()
{
try
{
if
(
mCurrentState
==
CURRENT_STATE_PAUSE
&&
mFullPauseBitmap
!=
null
&&
!
mFullPauseBitmap
.
isRecycled
())
{
mCoverImageView
.
setImageBitmap
(
mFullPauseBitmap
);
mCoverImageView
.
setVisibility
(
VISIBLE
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
/**
* 销毁暂停切换显示的bitmap
*/
protected
void
releasePauseCover
()
{
try
{
if
(
mCurrentState
!=
CURRENT_STATE_PAUSE
&&
mFullPauseBitmap
!=
null
&&
!
mFullPauseBitmap
.
isRecycled
())
{
mCoverImageView
.
setImageResource
(
R
.
drawable
.
empty_drawable
);
mCoverImageView
.
setVisibility
(
GONE
);
mFullPauseBitmap
=
null
;
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
protected
void
showProgressDialog
(
float
deltaX
,
String
seekTime
,
int
seekTimePosition
,
...
...
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/video/GSYBaseVideoPlayer.java
浏览文件 @
18d2a091
...
...
@@ -2,6 +2,7 @@ package com.shuyu.gsyvideoplayer.video;
import
android.app.Activity
;
import
android.content.Context
;
import
android.graphics.Bitmap
;
import
android.graphics.Color
;
import
android.graphics.Point
;
import
android.os.Handler
;
...
...
@@ -10,10 +11,10 @@ import android.view.Gravity;
import
android.view.View
;
import
android.view.ViewGroup
;
import
android.view.Window
;
import
android.view.WindowManager
;
import
android.widget.FrameLayout
;
import
android.widget.ImageView
;
import
com.shuyu.gsyvideoplayer.GSYTextureView
;
import
com.shuyu.gsyvideoplayer.GSYVideoManager
;
import
com.shuyu.gsyvideoplayer.GSYVideoPlayer
;
import
com.shuyu.gsyvideoplayer.R
;
...
...
@@ -65,6 +66,8 @@ public abstract class GSYBaseVideoPlayer extends FrameLayout implements GSYMedia
protected
int
mCurrentState
=
-
1
;
//当前的播放状态
private
int
mSystemUiVisibility
;
protected
float
mSpeed
=
1
;
//播放速度,只支持6.0以上
protected
boolean
mRotateViewAuto
=
true
;
//是否自动旋转
...
...
@@ -93,13 +96,18 @@ public abstract class GSYBaseVideoPlayer extends FrameLayout implements GSYMedia
protected
VideoAllCallBack
mVideoAllCallBack
;
private
OrientationUtils
mOrientationUtils
;
//旋转工具类
protected
Map
<
String
,
String
>
mMapHeadData
=
new
HashMap
<>();
pr
ivate
Handler
mHandler
=
new
Handler
()
;
pr
otected
GSYTextureView
mTextureView
;
private
int
mSystemUiVisibility
;
protected
ImageView
mCoverImageView
;
//内部使用,请勿操作哟~
protected
Bitmap
mFullPauseBitmap
=
null
;
//暂停时的全屏图片;
private
OrientationUtils
mOrientationUtils
;
//旋转工具类
private
Handler
mHandler
=
new
Handler
();
public
GSYBaseVideoPlayer
(
Context
context
)
{
...
...
@@ -186,6 +194,7 @@ public abstract class GSYBaseVideoPlayer extends FrameLayout implements GSYMedia
* 恢复
*/
private
void
resolveNormalVideoShow
(
View
oldF
,
ViewGroup
vp
,
GSYVideoPlayer
gsyVideoPlayer
)
{
if
(
oldF
!=
null
&&
oldF
.
getParent
()
!=
null
)
{
ViewGroup
viewGroup
=
(
ViewGroup
)
oldF
.
getParent
();
vp
.
removeView
(
viewGroup
);
...
...
@@ -238,6 +247,9 @@ public abstract class GSYBaseVideoPlayer extends FrameLayout implements GSYMedia
removeVideo
(
vp
,
FULLSCREEN_ID
);
//处理暂停的逻辑
pauseFullCoverLogic
();
if
(
mTextureViewContainer
.
getChildCount
()
>
0
)
{
mTextureViewContainer
.
removeAllViews
();
}
...
...
@@ -277,6 +289,7 @@ public abstract class GSYBaseVideoPlayer extends FrameLayout implements GSYMedia
resolveFullVideoShow
(
context
,
gsyVideoPlayer
);
}
gsyVideoPlayer
.
mHadPlay
=
mHadPlay
;
gsyVideoPlayer
.
mFullPauseBitmap
=
mFullPauseBitmap
;
gsyVideoPlayer
.
setUp
(
mUrl
,
mCache
,
mCachePath
,
mMapHeadData
,
mObjects
);
gsyVideoPlayer
.
setStateAndUi
(
mCurrentState
);
gsyVideoPlayer
.
addTextureView
();
...
...
@@ -336,6 +349,8 @@ public abstract class GSYBaseVideoPlayer extends FrameLayout implements GSYMedia
final
GSYVideoPlayer
gsyVideoPlayer
;
if
(
oldF
!=
null
)
{
gsyVideoPlayer
=
(
GSYVideoPlayer
)
oldF
;
//如果暂停了
pauseFullBackCoverLogic
(
gsyVideoPlayer
);
if
(
mShowFullAnimation
)
{
TransitionManager
.
beginDelayedTransition
(
vp
);
...
...
@@ -362,6 +377,35 @@ public abstract class GSYBaseVideoPlayer extends FrameLayout implements GSYMedia
}
}
/**
* 全屏的暂停的时候返回页面不黑色
*/
private
void
pauseFullCoverLogic
()
{
if
(
mCurrentState
==
GSYVideoPlayer
.
CURRENT_STATE_PAUSE
&&
mTextureView
!=
null
&&
(
mFullPauseBitmap
==
null
||
mFullPauseBitmap
.
isRecycled
()))
{
mFullPauseBitmap
=
mTextureView
.
getBitmap
();
}
}
/**
* 全屏的暂停返回的时候返回页面不黑色
*/
private
void
pauseFullBackCoverLogic
(
GSYBaseVideoPlayer
gsyVideoPlayer
)
{
//如果是暂停状态
if
(
gsyVideoPlayer
.
mCurrentState
==
GSYVideoPlayer
.
CURRENT_STATE_PAUSE
&&
gsyVideoPlayer
.
mTextureView
!=
null
)
{
//全屏的位图还在,说明没播放,直接用原来的
if
(
gsyVideoPlayer
.
mFullPauseBitmap
!=
null
&&
!
gsyVideoPlayer
.
mFullPauseBitmap
.
isRecycled
())
{
mFullPauseBitmap
=
gsyVideoPlayer
.
mFullPauseBitmap
;
}
else
{
//不在了说明已经播放过,还是暂停的话,我们拿回来就好
mFullPauseBitmap
=
gsyVideoPlayer
.
mTextureView
.
getBitmap
();
}
}
}
/**
* 显示小窗口
*/
...
...
gsyVideoPlayer/src/main/java/com/shuyu/gsyvideoplayer/video/StandardGSYVideoPlayer.java
浏览文件 @
18d2a091
...
...
@@ -57,8 +57,6 @@ public class StandardGSYVideoPlayer extends GSYVideoPlayer {
protected
RelativeLayout
mThumbImageViewLayout
;
//封面父布局
protected
ImageView
mCoverImageView
;
//未使用
private
View
mThumbImageView
;
//封面
protected
Dialog
mBrightnessDialog
;
...
...
@@ -110,7 +108,7 @@ public class StandardGSYVideoPlayer extends GSYVideoPlayer {
mBottomProgressBar
=
(
ProgressBar
)
findViewById
(
R
.
id
.
bottom_progressbar
);
mTitleTextView
=
(
TextView
)
findViewById
(
R
.
id
.
title
);
mThumbImageViewLayout
=
(
RelativeLayout
)
findViewById
(
R
.
id
.
thumb
);
mCoverImageView
=
(
ImageView
)
findViewById
(
R
.
id
.
cover
);
mLoadingProgressBar
=
(
ENDownloadView
)
findViewById
(
R
.
id
.
loading
);
mThumbImageViewLayout
.
setVisibility
(
GONE
);
...
...
gsyVideoPlayer/src/main/res/drawable/empty_drawable.xml
0 → 100644
浏览文件 @
18d2a091
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<gradient
android:angle=
"90"
android:endColor=
"#00000000"
android:startColor=
"#00000000"
/>
</shape>
\ No newline at end of file
gsyVideoPlayer/src/main/res/layout/video_layout_standard.xml
浏览文件 @
18d2a091
...
...
@@ -21,8 +21,7 @@
android:layout_alignParentLeft=
"true"
android:layout_alignParentRight=
"true"
android:layout_alignParentStart=
"true"
android:layout_alignParentTop=
"true"
android:background=
"#222222"
/>
android:layout_alignParentTop=
"true"
/>
<RelativeLayout
android:id=
"@+id/thumb"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录