-
Notifications
You must be signed in to change notification settings - Fork 0
remove play/pause toggle behavior #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
NicholasNagy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just had a question regarding the scope of the expected changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about in the dart layer, and on the Android side? Is the toggle removed there?
| throw StateError("The data source has not been initialized"); | ||
| } | ||
| return videoPlayerController!.value.isPlaying; | ||
| return videoPlayerController!.isPlaying; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Get the isPlaying value directly from the controller
| } | ||
|
|
||
| @override | ||
| Future<bool> getIsPlaying(int? textureId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Method channel for getting the isPlaying boolean from the native layer
| } | ||
| _updatePosition(newPosition, absolutePosition: newAbsolutePosition); | ||
| }, | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved play logic directly in the play method instead of calling the toggling (_applyPlayPause) method
| if (!_created || _isDisposed) { | ||
| return; | ||
| } | ||
| await _videoPlayerPlatform.pause(_textureId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved pause logic directly in the pause method instead of calling the toggling (_applyPlayPause) method
NicholasNagy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had a question about the play method, otherwise, the changes look good.
| _timer = Timer.periodic( | ||
| const Duration(milliseconds: 500), | ||
| (Timer timer) async { | ||
| if (_isDisposed) { | ||
| return; | ||
| } | ||
| final Duration? newPosition = await position; | ||
| final DateTime? newAbsolutePosition = await absolutePosition; | ||
| // ignore: invariant_booleans | ||
| if (_isDisposed) { | ||
| return; | ||
| } | ||
| _updatePosition(newPosition, absolutePosition: newAbsolutePosition); | ||
| }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I this code necessary? What is the position and absolute position for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess these will be useful when we add the skip ahead feature. (seekTo method)
position is for getting the position in the video
absolutePosition is for getting the position in the video stream
We can remove it for now, But maybe we will need it in future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather remove it and add back when needed, as we can then design it in a way that makes most sense for us
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, I'll remove it then
NicholasNagy
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm approving in advance
Changes included:
play will simply play the pause will simply pause