-
Notifications
You must be signed in to change notification settings - Fork 194
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
Add video autoplay to media gallery #4499
Conversation
📱 Scan the QR code below to install the build (arm64 only) for this PR. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #4499 +/- ##
===========================================
- Coverage 80.11% 80.10% -0.01%
===========================================
Files 2080 2080
Lines 55679 55701 +22
Branches 6812 6816 +4
===========================================
+ Hits 44605 44620 +15
- Misses 8737 8742 +5
- Partials 2337 2339 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
… the media gallery
562c3ab
to
33eafa1
Compare
Oops, there is some leftover code from experiments that should not be there anymore, sorry. I'll fix that ASAP. |
} | ||
.distinctUntilChanged() | ||
.map { timelineItems -> | ||
val groupedItems = mediaItemsPostProcessor.process(mediaItems = timelineItems) | ||
mediaTimeline.orCache(groupedItems) | ||
} | ||
.onEach { groupedMediaItems -> |
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.
No actual changes here, but Detekt complained about this so I made some changes to make it happy.
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.
This is working (thanks for the last fix).
However I see one point that could be improved:
- opening a video;
- auto play starts;
- swipe to another media;
- the video is automatically paused;
- swipe back to the video.
The video auto start again but from the beginning, even if the user has manually paused it.
I believe that previously the media was paused and the player position was not lost, except if the user is swiping to much (in this case the View is disposed).
Maybe the video should not auto-play when swiping back to it?
I thought iOS was autoplaying when coming back, but it's not. So I think you're right, I changed this behaviour in my latest commit. |
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.
Copilot wasn't able to review any files in this pull request.
Files not reviewed (11)
- libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/datasource/MediaGalleryDataSource.kt: Language not supported
- libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/local/LocalMediaView.kt: Language not supported
- libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/local/audio/MediaAudioView.kt: Language not supported
- libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/local/player/MediaPlayerControllerState.kt: Language not supported
- libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/local/player/MediaPlayerControllerStateProvider.kt: Language not supported
- libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/local/video/MediaVideoView.kt: Language not supported
- libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/viewer/MediaViewerDataSource.kt: Language not supported
- libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/viewer/MediaViewerPresenter.kt: Language not supported
- libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/viewer/MediaViewerState.kt: Language not supported
- libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/viewer/MediaViewerStateProvider.kt: Language not supported
- libraries/mediaviewer/impl/src/main/kotlin/io/element/android/libraries/mediaviewer/impl/viewer/MediaViewerView.kt: Language not supported
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.
Thanks for the update!
I see that LocalMediaView
is also used for the media attachment preview (see code in DefaultLocalMediaRenderer
). But I think that it's not a good idea to auto-play in this case, so the current implementation is fine.
One last non-blocking question about resetting the player location when swiping between media.
exoPlayer.pause() | ||
exoPlayer.seekTo(0) |
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.
Why resetting to player position here?
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.
This was done so the video would restart from the beginning when coming back to it, but since we don't do that anymore I think we can remove it now. Thanks for noticing it!
|
Content
Motivation and context
Fixes element-hq/element-meta#2797, achieving parity with iOS.
Tests
Tested devices
Checklist