File tree 3 files changed +33
-6
lines changed
3 files changed +33
-6
lines changed Original file line number Diff line number Diff line change @@ -818,10 +818,19 @@ class _CupertinoControlsState extends State<CupertinoControls>
818
818
// -> Check if we actually buffer, as android has a bug preventing to
819
819
// get the correct buffering state from this single bool.
820
820
final VideoPlayerValue value = controller.value;
821
- final int buffer = value.buffered.lastOrNull ? .end.inMilliseconds ?? - 1 ;
821
+
822
822
final int position = value.position.inMilliseconds;
823
823
824
- buffering = position >= buffer;
824
+ // Special case, if the video is finished, we don't want to show the
825
+ // buffering indicator anymore
826
+ if (position >= value.duration.inMilliseconds) {
827
+ buffering = false ;
828
+ } else {
829
+ final int buffer =
830
+ value.buffered.lastOrNull? .end.inMilliseconds ?? - 1 ;
831
+
832
+ buffering = position >= buffer;
833
+ }
825
834
} else {
826
835
// -> No buffering
827
836
buffering = false ;
Original file line number Diff line number Diff line change @@ -653,10 +653,19 @@ class _MaterialControlsState extends State<MaterialControls>
653
653
// -> Check if we actually buffer, as android has a bug preventing to
654
654
// get the correct buffering state from this single bool.
655
655
final VideoPlayerValue value = controller.value;
656
- final int buffer = value.buffered.lastOrNull ? .end.inMilliseconds ?? - 1 ;
656
+
657
657
final int position = value.position.inMilliseconds;
658
658
659
- buffering = position >= buffer;
659
+ // Special case, if the video is finished, we don't want to show the
660
+ // buffering indicator anymore
661
+ if (position >= value.duration.inMilliseconds) {
662
+ buffering = false ;
663
+ } else {
664
+ final int buffer =
665
+ value.buffered.lastOrNull? .end.inMilliseconds ?? - 1 ;
666
+
667
+ buffering = position >= buffer;
668
+ }
660
669
} else {
661
670
// -> No buffering
662
671
buffering = false ;
Original file line number Diff line number Diff line change @@ -589,10 +589,19 @@ class _MaterialDesktopControlsState extends State<MaterialDesktopControls>
589
589
// -> Check if we actually buffer, as android has a bug preventing to
590
590
// get the correct buffering state from this single bool.
591
591
final VideoPlayerValue value = controller.value;
592
- final int buffer = value.buffered.lastOrNull ? .end.inMilliseconds ?? - 1 ;
592
+
593
593
final int position = value.position.inMilliseconds;
594
594
595
- buffering = position >= buffer;
595
+ // Special case, if the video is finished, we don't want to show the
596
+ // buffering indicator anymore
597
+ if (position >= value.duration.inMilliseconds) {
598
+ buffering = false ;
599
+ } else {
600
+ final int buffer =
601
+ value.buffered.lastOrNull? .end.inMilliseconds ?? - 1 ;
602
+
603
+ buffering = position >= buffer;
604
+ }
596
605
} else {
597
606
// -> No buffering
598
607
buffering = false ;
You can’t perform that action at this time.
0 commit comments