Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
tx_player_fork
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
蒋俊
tx_player_fork
Commits
45a843db
提交
45a843db
authored
1月 11, 2023
作者:
kongdywang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix ios translate error & fix play loading ui error
上级
4f5e1ae4
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
23 行增加
和
38 行删除
+23
-38
SuperPlayerPlugin.m
Flutter/ios/Classes/SuperPlayerPlugin.m
+2
-1
superplayer_controller.dart
Flutter/superplayer_widget/lib/superplayer_controller.dart
+5
-24
superplayer_observer.dart
Flutter/superplayer_widget/lib/superplayer_observer.dart
+2
-2
superplayer_widget.dart
Flutter/superplayer_widget/lib/ui/superplayer_widget.dart
+14
-11
没有找到文件。
Flutter/ios/Classes/SuperPlayerPlugin.m
浏览文件 @
45a843db
...
...
@@ -187,7 +187,8 @@ SuperPlayerPlugin* instance;
result
([
TXLiveBase
getSDKVersionStr
]);
}
else
if
([
@"isDeviceSupportPip"
isEqualToString
:
call
.
method
])
{
BOOL
isSupport
=
[
TXVodPlayer
isSupportPictureInPicture
];
result
([
NSNumber
numberWithBool
:
isSupport
]);
int
pipSupportResult
=
isSupport
?
0
:
ERROR_IOS_PIP_DEVICE_NOT_SUPPORT
;
result
(
@
(
pipSupportResult
));
}
else
if
([
@"setGlobalEnv"
isEqualToString
:
call
.
method
])
{
NSString
*
envConfig
=
call
.
arguments
[
@"envConfig"
];
int
setResult
=
[
TXLiveBase
setGlobalEnv
:[
envConfig
UTF8String
]];
...
...
Flutter/superplayer_widget/lib/superplayer_controller.dart
浏览文件 @
45a843db
...
...
@@ -43,6 +43,7 @@ class SuperPlayerController {
bool
isLoop
=
false
;
bool
_needToResume
=
false
;
bool
_needToPause
=
false
;
bool
callResume
=
false
;
bool
_isMultiBitrateStream
=
false
;
// 是否是多码流url播放
bool
_changeHWAcceleration
=
false
;
// 切换硬解后接收到第一个关键帧前的标记位
bool
_isOpenHWAcceleration
=
true
;
...
...
@@ -60,10 +61,6 @@ class SuperPlayerController {
double
videoHeight
=
0
;
double
currentPlayRate
=
1.0
;
// 规避IOS部分情况下收不到FirstFrame事件
bool
_isCalledFirstFrame
=
false
;
bool
_isRecFirstFrameEvent
=
false
;
SuperPlayerController
(
this
.
_context
)
{
_initVodPlayer
();
_initLivePlayer
();
...
...
@@ -99,8 +96,6 @@ class SuperPlayerController {
break
;
case
TXVodPlayEvent
.
PLAY_EVT_VOD_PLAY_PREPARED
:
// vodPrepared
isPrepared
=
true
;
_isRecFirstFrameEvent
=
false
;
_isCalledFirstFrame
=
false
;
if
(
_isMultiBitrateStream
)
{
List
<
dynamic
>?
bitrateListTemp
=
await
_vodPlayerController
.
getSupportedBitrates
();
List
<
FTXBitrateItem
>
bitrateList
=
[];
...
...
@@ -156,14 +151,13 @@ class SuperPlayerController {
if
(
_needToPause
)
{
return
;
}
_isRecFirstFrameEvent
=
true
;
if
(
_changeHWAcceleration
)
{
LogUtils
.
d
(
TAG
,
"seek pos
$_seekPos
"
);
seek
(
_seekPos
);
_changeHWAcceleration
=
false
;
}
_updatePlayerState
(
SuperPlayerState
.
PLAYING
);
_o
nRecFirstF
rame
();
_o
bserver
?.
onRcvFirstIf
rame
();
break
;
case
TXVodPlayEvent
.
PLAY_EVT_PLAY_END
:
_updatePlayerState
(
SuperPlayerState
.
END
);
...
...
@@ -180,13 +174,6 @@ class SuperPlayerController {
if
(
videoDuration
!=
0
)
{
_observer
?.
onPlayProgress
(
currentDuration
,
videoDuration
,
await
getPlayableDuration
());
}
if
(!
_isCalledFirstFrame
)
{
if
(!
_isRecFirstFrameEvent
)
{
_isRecFirstFrameEvent
=
true
;
}
else
{
_onRecFirstFrame
();
}
}
break
;
}
});
...
...
@@ -285,9 +272,8 @@ class SuperPlayerController {
await
resetPlayer
();
if
(
_playAction
==
SuperPlayerModel
.
PLAY_ACTION_AUTO_PLAY
||
_playAction
==
SuperPlayerModel
.
PLAY_ACTION_PRELOAD
)
{
await
_playWithModelInner
(
videoModel
);
}
else
{
_observer
?.
onNewVideoPlay
();
}
_observer
?.
onPreparePlayVideo
();
}
Future
<
void
>
_playWithModelInner
(
SuperPlayerModel
videoModel
)
async
{
...
...
@@ -295,6 +281,7 @@ class SuperPlayerController {
_playAction
=
videoModel
.
playAction
;
_updateImageSpriteAndKeyFrame
(
null
,
null
);
_currentProtocol
=
null
;
callResume
=
false
;
// 优先使用url播放
if
(
videoModel
.
videoURL
.
isNotEmpty
)
{
...
...
@@ -453,13 +440,6 @@ class SuperPlayerController {
}
}
void
_onRecFirstFrame
()
{
if
(
_isRecFirstFrameEvent
)
{
_isCalledFirstFrame
=
true
;
_observer
?.
onRcvFirstIframe
();
}
}
/// 暂停视频
/// 涉及到_updatePlayerState相关的方法,不使用异步,避免异步调用导致的playerState更新不及时
void
pause
()
{
...
...
@@ -484,6 +464,7 @@ class SuperPlayerController {
}
else
{
_livePlayerController
.
resume
();
}
callResume
=
true
;
_needToPause
=
false
;
_updatePlayerState
(
SuperPlayerState
.
PLAYING
);
}
...
...
Flutter/superplayer_widget/lib/superplayer_observer.dart
浏览文件 @
45a843db
...
...
@@ -19,11 +19,11 @@ class _SuperPlayerObserver {
Function
(
PlayImageSpriteInfo
?
info
,
List
<
PlayKeyFrameDescInfo
>?
list
)
onVideoImageSpriteAndKeyFrameChanged
;
Function
onRcvFirstIframe
;
Function
onSysBackPress
;
Function
on
NewVideoPlay
;
Function
on
PreparePlayVideo
;
Function
onDispose
;
_SuperPlayerObserver
(
this
.
on
NewVideoPlay
,
this
.
on
PreparePlayVideo
,
this
.
onPlayPrepare
,
this
.
onPlayBegin
,
this
.
onPlayPause
,
...
...
Flutter/superplayer_widget/lib/ui/superplayer_widget.dart
浏览文件 @
45a843db
...
...
@@ -22,7 +22,7 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs
late
SuperPlayerController
_playController
;
bool
_isFloatingMode
=
false
;
bool
_isPlaying
=
false
;
bool
_isLoading
=
tru
e
;
bool
_isLoading
=
fals
e
;
bool
_isShowCover
=
true
;
double
_radioWidth
=
0
;
...
...
@@ -135,18 +135,16 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs
void
_registerObserver
()
{
_playController
.
_observer
=
_SuperPlayerObserver
(()
{
//
onNewVideoPlay
//
preparePlayVideo
setState
(()
{
_isPlaying
=
false
;
_isShowControlView
=
false
;
_isShowCover
=
true
;
_isLoading
=
true
;
_isLoading
=
_playController
.
videoModel
!.
playAction
==
SuperPlayerModel
.
PLAY_ACTION_AUTO_PLAY
;
});
_coverViewKey
.
currentState
?.
showCover
(
_playController
.
videoModel
!);
},
()
{
// onPlayPrepare
_isShowCover
=
true
;
_
coverViewKey
.
currentState
?.
showCover
(
_playController
.
videoModel
!)
;
_
isLoading
=
true
;
_togglePlayUIState
(
false
);
},
(
name
)
{
_togglePlayUIState
(
true
);
...
...
@@ -165,11 +163,16 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs
_coverViewKey
.
currentState
?.
hideCover
();
},
()
{
// onPlayLoading
if
(!
_isPlaying
)
{
setState
(()
{
setState
(()
{
//预加载模式进行特殊处理
if
(
_playController
.
videoModel
!.
playAction
==
SuperPlayerModel
.
PLAY_ACTION_PRELOAD
)
{
if
(
_playController
.
callResume
)
{
_isLoading
=
true
;
}
}
else
{
_isLoading
=
true
;
}
);
}
}
}
);
},
(
current
,
duration
,
playableDuration
)
{
// onPlayProgress
_videoBottomKey
.
currentState
?.
updateDuration
(
current
,
duration
,
playableDuration
);
...
...
@@ -529,7 +532,7 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs
void
_onResume
()
{
SuperPlayerState
playerState
=
_playController
.
playerState
;
int
playAction
=
_playController
.
_
playAction
;
int
playAction
=
_playController
.
videoModel
!.
playAction
;
if
(
playerState
==
SuperPlayerState
.
LOADING
&&
playAction
==
SuperPlayerModel
.
PLAY_ACTION_PRELOAD
)
{
_playController
.
resume
();
}
else
if
(
playerState
==
SuperPlayerState
.
INIT
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论