提交 a424b0f9 authored 作者: jungleiOS's avatar jungleiOS

暴露重播方法

上级 5e585d66
...@@ -9,8 +9,8 @@ class OtherTestPage extends StatefulWidget { ...@@ -9,8 +9,8 @@ class OtherTestPage extends StatefulWidget {
} }
class _OtherTestPageState extends State<OtherTestPage> { class _OtherTestPageState extends State<OtherTestPage> {
String url = String url = 'https://mpv.videocc.net/8f38fa3352/7/8f38fa335252dea652836243dd7e3f97_1.mp4';
'https://mpv.videocc.net/8f38fa3352/c/8f38fa3352a8cc8f70dd384edb9b21dc_1.mp4'; // 'https://mpv.videocc.net/8f38fa3352/c/8f38fa3352a8cc8f70dd384edb9b21dc_1.mp4';
late VideoPlayerController _controller; late VideoPlayerController _controller;
......
...@@ -3,7 +3,7 @@ import 'package:gz_video_player/video.dart'; ...@@ -3,7 +3,7 @@ import 'package:gz_video_player/video.dart';
class OverflowTestPage extends StatelessWidget { class OverflowTestPage extends StatelessWidget {
const OverflowTestPage({super.key}); const OverflowTestPage({super.key});
// https://mpv.videocc.net/8f38fa3352/7/8f38fa335252dea652836243dd7e3f97_1.mp4
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
...@@ -16,7 +16,7 @@ class OverflowTestPage extends StatelessWidget { ...@@ -16,7 +16,7 @@ class OverflowTestPage extends StatelessWidget {
color: Colors.blue, color: Colors.blue,
child: GZVideoPlayer( child: GZVideoPlayer(
dataSource: dataSource:
'https://mpv.videocc.net/8f38fa3352/5/8f38fa3352cdb65e6773173ae8c767b5_1.mp4', 'https://mpv.videocc.net/8f38fa3352/7/8f38fa335252dea652836243dd7e3f97_1.mp4',
sourceType: DataSourceType.network, sourceType: DataSourceType.network,
), ),
), ),
......
...@@ -480,6 +480,15 @@ class GZVideoPlayerState extends State<GZVideoPlayer> ...@@ -480,6 +480,15 @@ class GZVideoPlayerState extends State<GZVideoPlayer>
} }
} }
/// 重播
void replay() {
_isEnded = false;
_updateDataSource(
source: _dataSource,
type: _sourceType,
);
}
/// 点击播放或暂停 /// 点击播放或暂停
void togglePlay() { void togglePlay() {
_createHideControlBarTimer(); _createHideControlBarTimer();
...@@ -788,13 +797,7 @@ class GZVideoPlayerState extends State<GZVideoPlayer> ...@@ -788,13 +797,7 @@ class GZVideoPlayerState extends State<GZVideoPlayer>
? Align( ? Align(
alignment: Alignment.center, alignment: Alignment.center,
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: replay,
_isEnded = false;
_updateDataSource(
source: _dataSource,
type: _sourceType,
);
},
child: widget.videoStyle.replayIcon, child: widget.videoStyle.replayIcon,
), ),
) )
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论