Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
T
tx_player_fork
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
蒋俊
tx_player_fork
Commits
cbef6e07
提交
cbef6e07
authored
1月 24, 2024
作者:
kongdywang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
1. superPlayerWidget has added ability to config video render mode
2. prevent app ios crash when kill 3. fix issue that vod player can not pick width
上级
7cbb67fb
显示空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
70 行增加
和
45 行删除
+70
-45
FTXVodPlayer.m
Flutter/ios/Classes/FTXVodPlayer.m
+14
-1
txliveplayer_controller.dart
Flutter/lib/Core/txliveplayer_controller.dart
+10
-8
txvodplayer_controller.dart
Flutter/lib/Core/txvodplayer_controller.dart
+10
-8
superplayer_define.dart
Flutter/superplayer_widget/lib/model/superplayer_define.dart
+6
-0
superplayer_widget.dart
Flutter/superplayer_widget/lib/ui/superplayer_widget.dart
+30
-28
没有找到文件。
Flutter/ios/Classes/FTXVodPlayer.m
浏览文件 @
cbef6e07
...
...
@@ -83,9 +83,13 @@ static const int CODE_ON_RECEIVE_FIRST_FRAME = 2003;
-
(
void
)
onApplicationTerminateClick
{
_isTerminate
=
YES
;
_textureRegistry
=
nil
;
[
self
stopPlay
];
if
(
nil
!=
_txVodPlayer
)
{
[
_txVodPlayer
removeVideoWidget
];
_txVodPlayer
=
nil
;
_txVodPlayer
.
videoProcessDelegate
=
nil
;
}
_textureId
=
-
1
;
}
...
...
@@ -93,6 +97,12 @@ static const int CODE_ON_RECEIVE_FIRST_FRAME = 2003;
_isTerminate
=
YES
;
_textureRegistry
=
nil
;
[
self
stopPlay
];
if
(
nil
!=
_txVodPlayer
)
{
[
_txVodPlayer
removeVideoWidget
];
_txVodPlayer
=
nil
;
_txVodPlayer
.
videoProcessDelegate
=
nil
;
}
_textureId
=
-
1
;
}
-
(
void
)
destory
...
...
@@ -472,13 +482,16 @@ static const int CODE_ON_RECEIVE_FIRST_FRAME = 2003;
CVPixelBufferRef
old
=
_latestPixelBuffer
;
while
(
!
OSAtomicCompareAndSwapPtrBarrier
(
old
,
newBuffer
,
(
void
**
)
&
_latestPixelBuffer
))
{
if
(
_isTerminate
)
{
break
;
}
old
=
_latestPixelBuffer
;
}
if
(
old
&&
old
!=
pixelBuffer
)
{
CFRelease
(
old
);
}
if
(
!
_isStoped
&&
_textureRegistry
&&
_textureId
>=
0
)
{
if
(
!
_is
Terminate
&&
!
_is
Stoped
&&
_textureRegistry
&&
_textureId
>=
0
)
{
[
_textureRegistry
textureFrameAvailable
:
_textureId
];
}
}
...
...
Flutter/lib/Core/txliveplayer_controller.dart
浏览文件 @
cbef6e07
...
...
@@ -78,15 +78,17 @@ class TXLivePlayerController extends ChangeNotifier implements ValueListenable<T
break
;
case
TXVodPlayEvent
.
PLAY_EVT_CHANGE_RESOLUTION
:
//下行视频分辨率改变
if
(
defaultTargetPlatform
==
TargetPlatform
.
android
)
{
double
?
videoWidth
=
(
event
[
"videoWidth"
]);
double
?
videoHeight
=
(
event
[
"videoHeight"
]);
int
?
videoWidth
=
event
[
TXVodPlayEvent
.
EVT_VIDEO_WIDTH
];
int
?
videoHeight
=
event
[
TXVodPlayEvent
.
EVT_VIDEO_HEIGHT
];
videoWidth
??=
event
[
TXVodPlayEvent
.
EVT_PARAM1
];
videoHeight
??=
event
[
TXVodPlayEvent
.
EVT_PARAM2
];
if
((
videoWidth
!=
null
&&
videoWidth
>
0
)
&&
(
videoHeight
!=
null
&&
videoHeight
>
0
))
{
resizeVideoWidth
=
videoWidth
;
resizeVideoHeight
=
videoHeight
;
videoLeft
=
event
[
"videoLeft"
];
videoTop
=
event
[
"videoTop"
];
videoRight
=
event
[
"videoRight"
];
videoBottom
=
event
[
"videoBottom"
];
resizeVideoWidth
=
videoWidth
.
toDouble
()
;
resizeVideoHeight
=
videoHeight
.
toDouble
()
;
videoLeft
=
event
[
"videoLeft"
]
??
0
;
videoTop
=
event
[
"videoTop"
]
??
0
;
videoRight
=
event
[
"videoRight"
]
??
0
;
videoBottom
=
event
[
"videoBottom"
]
??
0
;
}
}
break
;
...
...
Flutter/lib/Core/txvodplayer_controller.dart
浏览文件 @
cbef6e07
...
...
@@ -87,15 +87,17 @@ class TXVodPlayerController extends ChangeNotifier implements ValueListenable<TX
break
;
case
TXVodPlayEvent
.
PLAY_EVT_CHANGE_RESOLUTION
:
// Downstream video resolution change.
if
(
defaultTargetPlatform
==
TargetPlatform
.
android
)
{
double
?
videoWidth
=
(
event
[
"videoWidth"
]);
double
?
videoHeight
=
(
event
[
"videoHeight"
]);
int
?
videoWidth
=
event
[
TXVodPlayEvent
.
EVT_VIDEO_WIDTH
];
int
?
videoHeight
=
event
[
TXVodPlayEvent
.
EVT_VIDEO_HEIGHT
];
videoWidth
??=
event
[
TXVodPlayEvent
.
EVT_PARAM1
];
videoHeight
??=
event
[
TXVodPlayEvent
.
EVT_PARAM2
];
if
((
videoWidth
!=
null
&&
videoWidth
>
0
)
&&
(
videoHeight
!=
null
&&
videoHeight
>
0
))
{
resizeVideoWidth
=
videoWidth
;
resizeVideoHeight
=
videoHeight
;
videoLeft
=
event
[
"videoLeft"
];
videoTop
=
event
[
"videoTop"
];
videoRight
=
event
[
"videoRight"
];
videoBottom
=
event
[
"videoBottom"
];
resizeVideoWidth
=
videoWidth
.
toDouble
()
;
resizeVideoHeight
=
videoHeight
.
toDouble
()
;
videoLeft
=
event
[
"videoLeft"
]
??
0
;
videoTop
=
event
[
"videoTop"
]
??
0
;
videoRight
=
event
[
"videoRight"
]
??
0
;
videoBottom
=
event
[
"videoBottom"
]
??
0
;
}
}
int
videoDegree
=
map
[
'EVT_KEY_VIDEO_ROTATION'
]
??
0
;
...
...
Flutter/superplayer_widget/lib/model/superplayer_define.dart
浏览文件 @
cbef6e07
...
...
@@ -51,4 +51,10 @@ class SuperPlayerUIStatus {
static
const
PIP_MODE
=
2
;
}
/// super player render mode
enum
SuperPlayerRenderMode
{
FILL_VIEW
,
ADJUST_RESOLUTION
}
Flutter/superplayer_widget/lib/ui/superplayer_widget.dart
浏览文件 @
cbef6e07
...
...
@@ -8,8 +8,9 @@ FullScreenController _fullScreenController = FullScreenController();
/// superPlayer view widget
class
SuperPlayerView
extends
StatefulWidget
{
final
SuperPlayerController
_controller
;
final
SuperPlayerRenderMode
renderMode
;
const
SuperPlayerView
(
this
.
_controller
,
{
Key
?
viewKey
})
:
super
(
key:
viewKey
);
SuperPlayerView
(
this
.
_controller
,
{
Key
?
viewKey
,
this
.
renderMode
=
SuperPlayerRenderMode
.
ADJUST_RESOLUTION
})
:
super
(
key:
viewKey
);
@override
State
<
StatefulWidget
>
createState
()
=>
SuperPlayerViewState
();
...
...
@@ -80,8 +81,7 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs
EasyLoading
.
showToast
(
FSPLocal
.
current
.
txSpwStartDownload
);
}
});
_bottomViewController
=
BottomViewController
(
_onTapPlayControl
,
_onControlFullScreen
,
_onControlQualityListView
,
(
value
)
{
_bottomViewController
=
BottomViewController
(
_onTapPlayControl
,
_onControlFullScreen
,
_onControlQualityListView
,
(
value
)
{
_taskExecutors
.
addTask
(()
=>
_controlTest
(
true
,
value
));
},
()
{
_taskExecutors
.
addTask
(()
=>
_controlTest
(
false
,
0
));
...
...
@@ -208,7 +208,7 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs
},
(
info
,
list
)
{
// onVideoImageSpriteAndKeyFrameChanged
_videoBottomKey
.
currentState
?.
setKeyFrame
(
list
);
},
()
{
},
()
{
// onResolutionChanged
_calculateSize
(
_playController
.
videoWidth
,
_playController
.
videoHeight
);
},
()
{
...
...
@@ -315,8 +315,7 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs
checkBrightness
();
// If the screen orientation is changed from landscape to portrait after returning from the background,
// switch to landscape mode based on the judgment made here.
if
(
_playController
.
_playerUIStatus
==
SuperPlayerUIStatus
.
FULLSCREEN_MODE
&&
defaultTargetPlatform
==
TargetPlatform
.
iOS
)
{
if
(
_playController
.
_playerUIStatus
==
SuperPlayerUIStatus
.
FULLSCREEN_MODE
&&
defaultTargetPlatform
==
TargetPlatform
.
iOS
)
{
Orientation
currentOrientation
=
MediaQuery
.
of
(
context
).
orientation
;
bool
isLandscape
=
currentOrientation
==
Orientation
.
landscape
;
if
(!
isLandscape
)
{
...
...
@@ -333,14 +332,13 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs
void
checkBrightness
()
async
{
double
?
sysBrightness
=
await
SuperPlayerPlugin
.
getSysBrightness
();
double
?
windowBrightness
=
await
SuperPlayerPlugin
.
getBrightness
();
if
(
sysBrightness
!=
windowBrightness
&&
null
!=
sysBrightness
)
{
if
(
sysBrightness
!=
windowBrightness
&&
null
!=
sysBrightness
)
{
SuperPlayerPlugin
.
setBrightness
(
sysBrightness
);
}
}
void
_calculateSize
(
double
videoWidth
,
double
videoHeight
)
{
if
(
mounted
&&
(
0
!=
videoWidth
&&
0
!=
videoHeight
)
&&
(
_videoWidth
!=
videoWidth
||
_videoHeight
!=
videoHeight
))
{
if
(
mounted
&&
(
0
!=
videoWidth
&&
0
!=
videoHeight
)
&&
(
_videoWidth
!=
videoWidth
||
_videoHeight
!=
videoHeight
))
{
_videoWidth
=
videoWidth
;
_videoHeight
=
videoHeight
;
_resizeVideo
();
...
...
@@ -390,8 +388,16 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs
@override
Widget
build
(
BuildContext
context
)
{
return
Center
(
child:
IntrinsicHeight
(
child:
Stack
(
child:
widget
.
renderMode
==
SuperPlayerRenderMode
.
ADJUST_RESOLUTION
?
IntrinsicHeight
(
child:
_getWidgetBody
(),
)
:
_getWidgetBody
()
);
}
Widget
_getWidgetBody
()
{
return
Stack
(
children:
[
_getPlayer
(),
_getTitleArea
(),
...
...
@@ -404,8 +410,7 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs
_getMoreMenuView
(),
_getLoading
(),
],
),
));
);
}
Widget
_getImageSpriteView
()
{
...
...
@@ -449,8 +454,8 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs
Widget
_getQualityListView
()
{
return
Visibility
(
visible:
_isShowQualityListView
,
child:
QualityListView
(
_qualitListViewController
,
_playController
.
currentQualityList
,
_playController
.
currentQuality
,
_qualityListKey
),
child:
QualityListView
(
_qualitListViewController
,
_playController
.
currentQualityList
,
_playController
.
currentQuality
,
_qualityListKey
),
);
}
...
...
@@ -503,10 +508,14 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs
highlightColor:
Colors
.
transparent
,
splashColor:
Colors
.
transparent
,
child:
Center
(
child:
AspectRatio
(
child:
widget
.
renderMode
==
SuperPlayerRenderMode
.
ADJUST_RESOLUTION
?
AspectRatio
(
aspectRatio:
_aspectRatio
,
child:
TXPlayerVideo
(
controller:
_playController
.
getCurrentController
(),
playerStream:
_playController
.
getPlayerStream
()))
:
SizedBox
(
child:
TXPlayerVideo
(
controller:
_playController
.
getCurrentController
(),
playerStream:
_playController
.
getPlayerStream
())),
controller:
_playController
.
getCurrentController
(),
playerStream:
_playController
.
getPlayerStream
()),
)
),
);
}
...
...
@@ -518,13 +527,8 @@ class SuperPlayerViewState extends State<SuperPlayerView> with WidgetsBindingObs
top:
topBottomOffset
,
left:
0
,
right:
0
,
child:
_VideoTitleView
(
_titleViewController
,
_playController
.
_playerUIStatus
==
SuperPlayerUIStatus
.
FULLSCREEN_MODE
,
_playController
.
_getPlayName
(),
_isShowDownload
,
_isDownloaded
,
_videoTitleKey
),
child:
_VideoTitleView
(
_titleViewController
,
_playController
.
_playerUIStatus
==
SuperPlayerUIStatus
.
FULLSCREEN_MODE
,
_playController
.
_getPlayName
(),
_isShowDownload
,
_isDownloaded
,
_videoTitleKey
),
),
);
}
...
...
@@ -803,14 +807,12 @@ class FullScreenController {
SystemChrome
.
setPreferredOrientations
([
DeviceOrientation
.
portraitUp
]);
SystemChrome
.
setEnabledSystemUIMode
(
SystemUiMode
.
manual
,
overlays:
SystemUiOverlay
.
values
);
}
else
if
(
orientationDirection
==
TXVodPlayEvent
.
ORIENTATION_LANDSCAPE_RIGHT
)
{
SystemChrome
.
setPreferredOrientations
(
Platform
.
isIOS
?
[
DeviceOrientation
.
landscapeRight
]
:
[
DeviceOrientation
.
landscapeLeft
]);
SystemChrome
.
setPreferredOrientations
(
Platform
.
isIOS
?
[
DeviceOrientation
.
landscapeRight
]
:
[
DeviceOrientation
.
landscapeLeft
]);
SystemChrome
.
setEnabledSystemUIMode
(
SystemUiMode
.
immersive
);
enterFullScreen
();
}
else
if
(
orientationDirection
==
TXVodPlayEvent
.
ORIENTATION_PORTRAIT_DOWN
)
{
}
else
if
(
orientationDirection
==
TXVodPlayEvent
.
ORIENTATION_LANDSCAPE_LEFT
)
{
SystemChrome
.
setPreferredOrientations
(
Platform
.
isIOS
?
[
DeviceOrientation
.
landscapeLeft
]
:
[
DeviceOrientation
.
landscapeRight
]);
SystemChrome
.
setPreferredOrientations
(
Platform
.
isIOS
?
[
DeviceOrientation
.
landscapeLeft
]
:
[
DeviceOrientation
.
landscapeRight
]);
SystemChrome
.
setEnabledSystemUIMode
(
SystemUiMode
.
immersive
);
enterFullScreen
();
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论