Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
tx_player_fork
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
蒋俊
tx_player_fork
Commits
872bdf49
提交
872bdf49
authored
6月 14, 2023
作者:
kongdywang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix the issue of black screen appearing in pip window on some devices & pip…
fix the issue of black screen appearing in pip window on some devices & pip window can adjust window radio by video radio
上级
10bb5beb
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
60 行增加
和
10 行删除
+60
-10
AndroidManifest.xml
Flutter/android/src/main/AndroidManifest.xml
+2
-2
FTXPIPManager.java
.../src/main/java/com/tencent/vod/flutter/FTXPIPManager.java
+22
-0
FTXVodPlayer.java
...d/src/main/java/com/tencent/vod/flutter/FTXVodPlayer.java
+3
-0
FlutterPipImplActivity.java
...va/com/tencent/vod/flutter/ui/FlutterPipImplActivity.java
+32
-8
activity_flutter_pip_impl.xml
...android/src/main/res/layout/activity_flutter_pip_impl.xml
+1
-0
没有找到文件。
Flutter/android/src/main/AndroidManifest.xml
浏览文件 @
872bdf49
...
...
@@ -10,10 +10,10 @@
android:supportsPictureInPicture=
"true"
android:screenOrientation=
"portrait"
android:excludeFromRecents=
"true"
android:configChanges=
"orientation|keyboardHidden|screenSize|smallestScreenSize|screenLayout"
android:exported=
"true"
android:resizeableActivity=
"true"
android:launchMode=
"singleTask"
android:
configChanges=
"orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMod
e"
android:
resizeableActivity=
"tru
e"
android:windowSoftInputMode=
"stateHidden"
tools:ignore=
"UnusedAttribute"
>
<intent-filter>
...
...
Flutter/android/src/main/java/com/tencent/vod/flutter/FTXPIPManager.java
浏览文件 @
872bdf49
...
...
@@ -23,6 +23,8 @@ import android.os.Parcel;
import
android.os.Parcelable
;
import
android.text.TextUtils
;
import
android.util.Log
;
import
android.util.Rational
;
import
androidx.annotation.RequiresApi
;
import
com.tencent.vod.flutter.model.PipResult
;
import
com.tencent.vod.flutter.model.VideoModel
;
...
...
@@ -261,6 +263,8 @@ public class FTXPIPManager {
private
final
boolean
mIsNeedPlayControl
;
private
boolean
mIsPlaying
=
false
;
private
float
mCurrentPlayTime
=
0
;
private
int
mViewWith
=
16
;
private
int
mViewHeight
=
9
;
/**
* 画中画参数
...
...
@@ -334,6 +338,19 @@ public class FTXPIPManager {
this
.
mCurrentPlayTime
=
mCurrentPlayTime
;
}
public
void
setRadio
(
int
width
,
int
height
)
{
mViewWith
=
width
;
mViewHeight
=
height
;
}
public
int
geiRadioWith
()
{
return
mViewWith
;
}
public
int
getRadioHeight
()
{
return
mViewHeight
;
}
/**
* 构造画中画参数
*/
...
...
@@ -382,6 +399,11 @@ public class FTXPIPManager {
Builder
mPipParams
=
new
Builder
();
mPipParams
.
setActions
(
actions
);
mPipParams
.
setAspectRatio
(
new
Rational
(
mViewWith
,
mViewHeight
));
if
(
Build
.
VERSION
.
SDK_INT
>=
VERSION_CODES
.
S
)
{
mPipParams
.
setAutoEnterEnabled
(
false
);
mPipParams
.
setSeamlessResizeEnabled
(
false
);
}
return
mPipParams
.
build
();
}
...
...
Flutter/android/src/main/java/com/tencent/vod/flutter/FTXVodPlayer.java
浏览文件 @
872bdf49
...
...
@@ -651,6 +651,9 @@ public class FTXVodPlayer extends FTXBasePlayer implements ITXVodPlayListener, F
getPlayerId
());
mPipParams
.
setIsPlaying
(
isPlayerPlaying
());
mPipParams
.
setCurrentPlayTime
(
getPlayerCurrentPlaybackTime
());
if
(
null
!=
mVodPlayer
)
{
mPipParams
.
setRadio
(
mVodPlayer
.
getWidth
(),
mVodPlayer
.
getHeight
());
}
int
pipResult
=
mPipManager
.
enterPip
(
mPipParams
,
mVideoModel
);
// 启动成功之后,暂停当前界面视频
if
(
pipResult
==
FTXEvent
.
NO_ERROR
)
{
...
...
Flutter/android/src/main/java/com/tencent/vod/flutter/ui/FlutterPipImplActivity.java
浏览文件 @
872bdf49
...
...
@@ -12,10 +12,12 @@ import android.content.Intent;
import
android.content.IntentFilter
;
import
android.content.ServiceConnection
;
import
android.content.res.Configuration
;
import
android.graphics.PixelFormat
;
import
android.os.Build
;
import
android.os.Build.VERSION
;
import
android.os.Build.VERSION_CODES
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.IBinder
;
import
android.text.TextUtils
;
import
android.util.Log
;
...
...
@@ -25,7 +27,9 @@ import android.view.SurfaceHolder.Callback;
import
android.view.SurfaceView
;
import
android.view.View
;
import
android.widget.ProgressBar
;
import
androidx.annotation.NonNull
;
import
com.tencent.rtmp.ITXLivePlayListener
;
import
com.tencent.rtmp.ITXVodPlayListener
;
import
com.tencent.rtmp.TXLiveConstants
;
...
...
@@ -63,6 +67,7 @@ public class FlutterPipImplActivity extends Activity implements Callback, ITXVod
private
VideoModel
mVideoModel
;
private
boolean
mIsRegisterReceiver
=
false
;
private
PipParams
mCurrentParams
;
private
Handler
mMainHandler
;
private
final
BroadcastReceiver
pipActionReceiver
=
new
BroadcastReceiver
()
{
@Override
...
...
@@ -94,6 +99,8 @@ public class FlutterPipImplActivity extends Activity implements Callback, ITXVod
@Override
protected
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
mMainHandler
=
new
Handler
(
getMainLooper
());
bindAndroid12BugServiceIfNeed
();
Intent
intent
=
getIntent
();
PipParams
params
=
intent
.
getParcelableExtra
(
FTXEvent
.
EXTRA_NAME_PARAMS
);
if
(
null
==
params
)
{
...
...
@@ -108,7 +115,6 @@ public class FlutterPipImplActivity extends Activity implements Callback, ITXVod
}
}
registerPipBroadcast
();
handleIntent
(
intent
);
setContentView
(
R
.
layout
.
activity_flutter_pip_impl
);
mVodPlayer
=
new
TXVodPlayer
(
this
);
mLivePlayer
=
new
TXLivePlayer
(
this
);
...
...
@@ -117,7 +123,7 @@ public class FlutterPipImplActivity extends Activity implements Callback, ITXVod
mVideoSurface
.
getHolder
().
addCallback
(
this
);
setVodPlayerListener
();
setLivePlayerListener
();
bindAndroid12BugServiceIfNeed
(
);
handleIntent
(
intent
);
}
private
void
setVodPlayerListener
()
{
...
...
@@ -272,23 +278,27 @@ public class FlutterPipImplActivity extends Activity implements Callback, ITXVod
* @param closeImmediately 立刻关闭,不执行延迟,在android 12以上,如果画中画处于非当前app界面下,立刻关闭可能会造成无法返回app问题
*/
private
void
exitPip
(
boolean
closeImmediately
)
{
if
(!
is
Finishing
()
&&
!
is
Destroyed
())
{
if
(!
isDestroyed
())
{
// 由于android 12 的前台服务启动限制,导致画中画返回后,过早关闭activity界面的话,无法正常拉起app。所以这里增加延时处理
if
(
Build
.
VERSION
.
SDK_INT
>=
VERSION_CODES
.
S
&&
!
closeImmediately
)
{
if
(
VERSION
.
SDK_INT
>=
VERSION_CODES
.
S
&&
!
closeImmediately
)
{
mVodPlayer
.
stopPlay
(
true
);
mLivePlayer
.
stopPlay
(
true
);
mVideoSurface
.
setVisibility
(
View
.
GONE
);
mVideoProgress
.
setVisibility
(
View
.
GONE
);
m
VideoProgress
.
postDelayed
(
new
Runnable
()
{
m
MainHandler
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
overridePendingTransition
(
0
,
0
);
finish
();
finish
AndRemoveTask
();
}
},
400
);
}
else
{
overridePendingTransition
(
0
,
0
);
finish
();
if
(
VERSION
.
SDK_INT
>=
VERSION_CODES
.
LOLLIPOP
)
{
finishAndRemoveTask
();
}
else
{
finish
();
}
}
}
...
...
@@ -332,6 +342,7 @@ public class FlutterPipImplActivity extends Activity implements Callback, ITXVod
@Override
public
void
surfaceCreated
(
SurfaceHolder
holder
)
{
mIsSurfaceCreated
=
true
;
holder
.
setFormat
(
PixelFormat
.
TRANSLUCENT
);
attachSurface
(
holder
.
getSurface
());
startPlay
();
}
...
...
@@ -453,6 +464,13 @@ public class FlutterPipImplActivity extends Activity implements Callback, ITXVod
mVideoProgress
.
setVisibility
(
View
.
VISIBLE
);
}
private
void
controlPipPlayStatus
(
boolean
isPlaying
)
{
if
(
null
!=
mCurrentParams
)
{
mCurrentParams
.
setIsPlaying
(
isPlaying
);
updatePip
(
mCurrentParams
);
}
}
@Override
public
void
onPlayEvent
(
TXVodPlayer
txVodPlayer
,
int
event
,
Bundle
bundle
)
{
if
(
VERSION
.
SDK_INT
>=
VERSION_CODES
.
N
&&
isInPictureInPictureMode
())
{
...
...
@@ -466,7 +484,13 @@ public class FlutterPipImplActivity extends Activity implements Callback, ITXVod
}
updatePip
(
mCurrentParams
);
}
if
(
event
==
TXLiveConstants
.
PLAY_EVT_PLAY_PROGRESS
)
{
if
(
event
==
TXLiveConstants
.
PLAY_EVT_PLAY_END
)
{
// 播放完毕的时候,自动将播放按钮置为播放
controlPipPlayStatus
(
false
);
}
else
if
(
event
==
TXLiveConstants
.
PLAY_EVT_PLAY_BEGIN
)
{
// 播放开始的时候,自动将播放按钮置为暂停
controlPipPlayStatus
(
true
);
}
else
if
(
event
==
TXLiveConstants
.
PLAY_EVT_PLAY_PROGRESS
)
{
int
progress
=
bundle
.
getInt
(
TXLiveConstants
.
EVT_PLAY_PROGRESS_MS
);
int
duration
=
bundle
.
getInt
(
TXLiveConstants
.
EVT_PLAY_DURATION_MS
);
float
percentage
=
(
progress
/
1000
F
)
/
(
duration
/
1000
F
);
...
...
Flutter/android/src/main/res/layout/activity_flutter_pip_impl.xml
浏览文件 @
872bdf49
...
...
@@ -13,6 +13,7 @@
android:id=
"@+id/sv_video_container"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@android:color/transparent"
android:visibility=
"gone"
/>
<ProgressBar
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论