Skip to content
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

PE-4583: Video Preview (In-app) #1380

Merged
merged 22 commits into from
Oct 18, 2023
Merged

Conversation

kunstmusik
Copy link
Contributor

@kunstmusik kunstmusik commented Sep 22, 2023

@github-actions
Copy link

github-actions bot commented Sep 22, 2023

Visit the preview URL for this PR (updated for commit 693ce98):

https://ardrive-web--pr1380-pe-4583-video-previe-295jplwc.web.app

(expires Wed, 18 Oct 2023 17:55:30 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: a224ebaee2f0939e7665e7630e7d3d6cd7d0f8b0

Copy link
Collaborator

@thiagocarvalhodev thiagocarvalhodev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The feature is looking GREAT! I just left a few comments about using the logger.e method when logging errors. We have some duplicated code that we should address in a tech debt, but not for now.
LGTM

@@ -8,6 +8,7 @@
"enableQuickSyncAuthoring": true,
"enableMultipleFileDownload": true,
"enableVideoPreview": false,
"enableAudioPreview": false,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will need to update it to true when releasing

@@ -8,6 +8,7 @@
"enableQuickSyncAuthoring": true,
"enableMultipleFileDownload": true,
"enableVideoPreview": false,
"enableAudioPreview": false,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same for the previous comment

@@ -175,6 +184,16 @@ class FsEntryPreviewCubit extends Cubit<FsEntryPreviewState> {
case 'image':
emitImagePreview(file, previewUrl);
break;

case 'audio':
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kunstmusik , it seems this branch is out to date. Let's sync with dev

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merged latest from dev

@@ -233,6 +233,19 @@ class AppConfigWindowManagerState extends State<AppConfigWindowManager> {
type: ArDriveDevToolOptionType.bool,
);

ArDriveDevToolOption enableAudioPreviewOption = ArDriveDevToolOption(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@@ -1,5 +1,7 @@
part of '../drive_detail_page.dart';

const List<double> _speedOptions = [.25, .5, .75, 1, 1.25, 1.5, 1.75, 2];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use the normal option here, as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm using the numbers to set the speed; could use 'normal' here but it it wouldn't make the code that uses it much different (would have to check for 'normal' and use 1 for speed param; current code checks for 1 and uses 'normal' for speed label).

if (isPlaying) {
await _lock.synchronized(() async {
await _videoPlayerController.play().catchError((e) {
logger.d('Error playing video: $e');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: use logger.e

_videoPlayerController.value.isPlaying) {
await _lock.synchronized(() async {
await _videoPlayerController.pause().catchError((error) {
logger.d('Error pausing video: $error');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: use the logger.e

child: Container(color: Colors.black.withOpacity(0.0)),
),
),
AnimatedOpacity(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can improve the readability of this widget by splitting its sub-widgets into private method or classes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed; do you think we should do it for this PR or do as tech debt?

Comment on lines 522 to 538
setState(() {
if (_videoPlayerController.value.hasError) {
logger.d('>>> ${_videoPlayerController.value.errorDescription}');

// In case of emergency, reinitialize the video player.
_videoPlayerController.removeListener(_listener);
_videoPlayerController.dispose();

_videoPlayerController =
VideoPlayerController.networkUrl(Uri.parse(widget.videoUrl));
_videoPlayerController.initialize();
_videoPlayerController.addListener(_listener);

_videoPlayer =
VideoPlayer(_videoPlayerController, key: const Key('videoPlayer'));
}
});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have almost the same logic on the VideoPlayerWidget. We could implement an abstraction for that, so we don't need to repeat the code. I'm not requesting for now, we can address it in a tech debt in the future.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added PE-4697 tech debt task to look at refactoring for clarity and code reuse.

});
_videoPlayerController.addListener(_listener);

SystemChrome.setPreferredOrientations([
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀

@kunstmusik kunstmusik dismissed thiagocarvalhodev’s stale review September 28, 2023 12:57

The merge-base changed after approval.

matibat
matibat previously approved these changes Oct 2, 2023
Copy link
Contributor

@matibat matibat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

pubspec.lock Outdated
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we intend to update these versions?

…-accept-all-mov-and-mpg-formats

PE-4732: video-preview-doesnt-accept-all-mov-and-mpg-formats
@thiagocarvalhodev thiagocarvalhodev merged commit 693ce98 into dev Oct 18, 2023
6 checks passed
@thiagocarvalhodev thiagocarvalhodev deleted the PE-4583-video-preview-in-app branch October 18, 2023 15:02
@thiagocarvalhodev
Copy link
Collaborator

Closing this one. The changes here were merged on this PR: #1425

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants