feat: 无音轨视频容错;缓冲状态提示;错误自动重试与汇报

This commit is contained in:
orz12
2024-07-11 17:50:37 +08:00
parent 17e9f00eca
commit 39b5e369f8
3 changed files with 89 additions and 32 deletions

View File

@@ -1079,24 +1079,39 @@ class _PLVideoPlayerState extends State<PLVideoPlayer>
if (_.dataStatus.loading || _.isBuffering.value) {
return Center(
child: GestureDetector(
onTap: () {
_.refreshPlayer();
},
child: Container(
padding: const EdgeInsets.all(30),
decoration: const BoxDecoration(
shape: BoxShape.circle,
gradient: RadialGradient(
colors: [Colors.black26, Colors.transparent],
),
),
child: Image.asset(
'assets/images/loading.gif',
height: 25,
semanticLabel: "加载中",
),
),
));
onTap: () {
_.refreshPlayer();
},
child: Container(
padding: const EdgeInsets.all(30),
decoration: const BoxDecoration(
shape: BoxShape.circle,
gradient: RadialGradient(
colors: [Colors.black26, Colors.transparent],
),
),
child: Column(mainAxisSize: MainAxisSize.min, children: [
Image.asset(
'assets/images/loading.gif',
height: 25,
semanticLabel: "加载中",
),
if (_.isBuffering.value)
Obx(() {
if (_.buffered.value == Duration.zero) {
return const Text('Buffering...',
style: TextStyle(
color: Colors.white, fontSize: 12));
}
String bufferStr = _.buffered.toString();
return Text(
bufferStr.substring(0, bufferStr.length - 3),
style: const TextStyle(
color: Colors.white, fontSize: 12),
);
}),
]),
)));
} else {
return const SizedBox();
}