Flutter 视频播放器仅显示我要循环播放的视频的第一帧

Flutter video player shows only the first frame of the video that I want to loop

我想为我的 flutter 应用程序创建一个 VideoPlayer class,我可以在其中放置循环视频。当我调试应用程序或将其 运行 设置为“发布模式”时,VideoPlayer 仅显示视频的第一帧。

这是我的 videoplayer.dart 文件中的代码

import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:video_player/video_player.dart';

class clipVideo extends StatefulWidget {
  clipVideo() : super();
  final String title = "titlu video";

  @override
  _clipVideo createState() => _clipVideo();
}

class _clipVideo extends State<clipVideo> {
  VideoPlayerController _controller;
  Future<void> _initializeVideoPlayerFuture;

  @override
  void initState() {
    _controller = VideoPlayerController.asset('assets/videos/intro.mp4');
    _initializeVideoPlayerFuture = _controller.initialize();
    _controller.setLooping(true);
    _controller.setVolume(1.0);
    super.initState();
  }

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      child: FutureBuilder(
        future: _initializeVideoPlayerFuture,
        builder: (context, snapshot) {
          if (snapshot.connectionState == ConnectionState.done) {
            return Center(
              child: AspectRatio(
                aspectRatio: _controller.value.aspectRatio,
                child: VideoPlayer(_controller),
              ),
            );
          } else {
            return Center(
              child: CircularProgressIndicator(),
            );
          }
        },
      ),
    );
  }
}

这是我对 public.yasml 文件的依赖

video_player: ^0.10.11

flutter 运行没有任何错误。是因为视频有20MB大小吗?

包含在 initState() 中

_controller.play();