|
@@ -1219,7 +1219,7 @@ class __VideoWidgetState extends State<_VideoWidget> {
|
|
|
void initState() {
|
|
|
super.initState();
|
|
|
|
|
|
- controller = VideoPlayerController.network(widget.data.introduceVideo ?? "")..initialize();
|
|
|
+ controller = VideoPlayerController.network(widget.data.introduceVideo ?? "");
|
|
|
controller.setLooping(true);
|
|
|
if (controller.value.isPlaying == true) {
|
|
|
overlay();
|
|
@@ -1313,13 +1313,17 @@ class __VideoWidgetState extends State<_VideoWidget> {
|
|
|
height: 50.0,
|
|
|
),
|
|
|
onTap: () {
|
|
|
- if (v.isPlaying) {
|
|
|
- controller.pause();
|
|
|
- } else {
|
|
|
- if (controller.value.position.compareTo(controller.value.duration) == 0) {
|
|
|
- controller.seekTo(Duration.zero);
|
|
|
+ if(controller.value.isInitialized) {
|
|
|
+ if (v.isPlaying) {
|
|
|
+ controller.pause();
|
|
|
+ } else {
|
|
|
+ if (controller.value.position.compareTo(controller.value.duration) == 0) {
|
|
|
+ controller.seekTo(Duration.zero);
|
|
|
+ }
|
|
|
+ controller.play();
|
|
|
}
|
|
|
- controller.play();
|
|
|
+ }else{
|
|
|
+ controller.initialize().then((value) => controller.play());
|
|
|
}
|
|
|
overlay();
|
|
|
},
|
|
@@ -1356,8 +1360,36 @@ class __VideoWidgetState extends State<_VideoWidget> {
|
|
|
),
|
|
|
),
|
|
|
);
|
|
|
- } else {
|
|
|
+ }else if(v.isBuffering) {
|
|
|
return Center(child: CircularProgressIndicator());
|
|
|
+ } else {
|
|
|
+ return Container(
|
|
|
+ width: double.infinity,
|
|
|
+ height: double.infinity,
|
|
|
+ child: Stack(
|
|
|
+ fit: StackFit.expand,
|
|
|
+ children: <Widget>[
|
|
|
+ CachedNetworkImage(imageUrl: '${widget.data.introduceVideoCover}', fit: BoxFit.fitWidth,),
|
|
|
+ Container(
|
|
|
+ width: double.infinity,
|
|
|
+ height: double.infinity,
|
|
|
+ decoration: BoxDecoration(color: const Color(0xFF040404).withOpacity(.05)),
|
|
|
+ ),
|
|
|
+ Center(
|
|
|
+ child: InkWell(
|
|
|
+ child: Image.asset(
|
|
|
+ "lib/assets/img/game_icon_play.png",
|
|
|
+ height: 50.0,
|
|
|
+ ),
|
|
|
+ onTap: () {
|
|
|
+ controller.initialize().then((value) => controller.play());
|
|
|
+ overlay();
|
|
|
+ },
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
}
|
|
|
}),
|
|
|
if (widget.isFullScreen)
|