AnonymHK / betterplayer

Bug fix version for betterplayer
Apache License 2.0
42 stars 32 forks source link

[BUG] startAt cannot working on IOS #30

Open andes2912 opened 6 months ago

andes2912 commented 6 months ago

History check I check issue and cannot find for this issue.

Describe the bug A clear and concise description of what the bug is.

To Reproduce Steps to reproduce the behavior:

  1. Go to player (video)
  2. Click on play (before i set startAt with Duration 10 second)
  3. Video not error but startAt not working

*Example code

@override
  void initState() {
    super.initState();
    episodeHistoryBox = Hive.box(episodeBox);
    FlutterDownloader.registerCallback(downloadCallback, step: 1);
    getData();
    betterPlayerConfiguration = BetterPlayerConfiguration(
      startAt: Duration(seconds: time),
      allowedScreenSleep: false,
      aspectRatio: 16 / 9,
      fit: BoxFit.contain,
      autoDetectFullscreenAspectRatio: true,
      fullScreenAspectRatio: 16 / 9,
      controlsConfiguration: const BetterPlayerControlsConfiguration(
        loadingColor: Colors.deepOrange,
        progressBarBufferedColor: Colors.red, //very useful
        progressBarHandleColor: Colors.blue,
        progressBarBackgroundColor: Colors.white,
        enableSubtitles: false,
        pipMenuIcon: Icons.picture_in_picture,
      ),
      eventListener: (e) async {
        e.betterPlayerEventType;
        BetterPlayerEventType.progress;
        final progress = e.parameters!['progress']! as Duration;

        SharedPreferences prefs = await SharedPreferences.getInstance();
        int duration = progress.inSeconds;
        prefs.setInt('curentTime', duration);
        switch (e.betterPlayerEventType) {
          case BetterPlayerEventType.progress:
            final progress = e.parameters!['progress']! as Duration;

            SharedPreferences prefs = await SharedPreferences.getInstance();
            int duration = progress.inSeconds;
            prefs.setInt('curentTime', duration);
            break;
          default:
            break;
        }
      },
    );
  }

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable, add screenshots to help explain your problem.

Flutter doctor Please add flutter doctor output here.

Better Player version

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.