Skip to content

Commit

Permalink
adds isCompleted
Browse files Browse the repository at this point in the history
  • Loading branch information
nourhelmi committed Mar 8, 2023
1 parent f25b5da commit 09fa2c6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
12 changes: 11 additions & 1 deletion brightcove_flutter/lib/brightcove_flutter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ class VideoPlayerValue {
this.size = Size.zero,
this.position = Duration.zero,
this.isInitialized = false,
this.isCompleted = false,
this.isPlaying = false,
this.isLooping = false,
this.isBuffering = false,
Expand Down Expand Up @@ -94,6 +95,9 @@ class VideoPlayerValue {
/// Indicates whether or not the video has been loaded and is ready to play.
final bool isInitialized;

/// True if video has completed playing
final bool isCompleted;

/// Indicates if the player auto-plays
// final bool isAutoPlay;

Expand Down Expand Up @@ -128,6 +132,7 @@ class VideoPlayerValue {
Duration? position,
Duration? captionOffset,
bool? isInitialized,
bool? isCompleted,
bool? isPlaying,
bool? isLooping,
bool? isBuffering,
Expand All @@ -142,6 +147,7 @@ class VideoPlayerValue {
size: size ?? this.size,
position: position ?? this.position,
isInitialized: isInitialized ?? this.isInitialized,
isCompleted: isCompleted ?? this.isCompleted,
isPlaying: isPlaying ?? this.isPlaying,
isLooping: isLooping ?? this.isLooping,
isBuffering: isBuffering ?? this.isBuffering,
Expand All @@ -160,6 +166,7 @@ class VideoPlayerValue {
'size: $size, '
'position: $position, '
'isInitialized: $isInitialized, '
'isCompleted: $isCompleted, '
'isPlaying: $isPlaying, '
'isLooping: $isLooping, '
'isBuffering: $isBuffering, '
Expand All @@ -171,6 +178,7 @@ class VideoPlayerValue {
bool operator ==(other) {
return (other is VideoPlayerValue &&
other.isInitialized == isInitialized &&
other.isCompleted == isCompleted &&
other.isLooping == isLooping &&
other.isBuffering == isBuffering &&
other.volume == volume &&
Expand All @@ -184,6 +192,7 @@ class VideoPlayerValue {
@override
int get hashCode => Object.hash(
isInitialized,
isCompleted,
isPlaying,
isLooping,
volume,
Expand Down Expand Up @@ -245,11 +254,12 @@ class BrightcoveVideoPlayerController extends ValueNotifier<VideoPlayerValue> {
print("[listener][position]${event.currentPosition}");
value = value.copyWith(
position: Duration(
milliseconds: ((event.currentPosition ?? 0) as int),
milliseconds: (event.currentPosition ?? 0),
));
break;
case VideoEventType.completed:
pause().then((_) => seekTo(value.duration));
value = value.copyWith(isCompleted: true);
break;
case VideoEventType.bufferingStart:
value = value.copyWith(isBuffering: true);
Expand Down
4 changes: 2 additions & 2 deletions brightcove_flutter/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ dependencies:
git:
url: https://github.com/BlinxTeam/brightcove_flutter.git
path: brightcove_android
ref: v0.2.3
ref: v0.2.4
brightcove_ios:
# path: ../brightcove_ios
git:
url: https://github.com/BlinxTeam/brightcove_flutter.git
path: brightcove_ios
ref: v0.2.3
ref: v0.2.4

dependency_overrides:
brightcove_flutter_platform_interface:
Expand Down

0 comments on commit 09fa2c6

Please sign in to comment.