-
Notifications
You must be signed in to change notification settings - Fork 499
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
Fix the now playing info center while a voice broadcast is played #7257
Conversation
RiotSwiftUI/Modules/Room/VoiceBroadcastPlayback/MatrixSDK/VoiceBroadcastPlaybackViewModel.swift
Outdated
Show resolved
Hide resolved
@@ -93,6 +94,7 @@ import MediaPlayer | |||
private override init() { | |||
audioPlayers = NSMapTable<NSString, VoiceMessageAudioPlayer>(valueOptions: .weakMemory) | |||
audioRecorders = NSHashTable<VoiceMessageAudioRecorder>(options: .weakMemory) | |||
nowPlayingInfoProviders = NSMapTable<VoiceMessageAudioPlayer, VoiceMessageNowPlayingInfoProvider>(valueOptions: .weakMemory) |
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.
Wouldn't this make all voice broadcasting audio players be retained forever?
Riot/Modules/Room/VoiceMessages/VoiceMessageMediaServiceProvider.swift
Outdated
Show resolved
Hide resolved
RiotSwiftUI/Modules/Room/VoiceBroadcastPlayback/MatrixSDK/VoiceBroadcastPlaybackViewModel.swift
Outdated
Show resolved
Hide resolved
RiotSwiftUI/Modules/Room/VoiceBroadcastPlayback/MatrixSDK/VoiceBroadcastPlaybackViewModel.swift
Outdated
Show resolved
Hide resolved
I tested, this change is working well on ended VB 👍 We should check if there is a way to handle this intermediate state (buffering), mainly for live VB. If no solution is available for the moment, we may postpone the management of this potential buffering in the info center view. We should not block this PR for that. The current changes already enhance for some parts the user experience |
d25fa41
to
b2ae0e7
Compare
@stefanceriu I made some changes. I tried to be as less invasive as possible to not break anything in the audio players management. Also, the currentlyPlayingAudioPlayer is a bit tricky because we have to consider the player being used by the voice broadcast to be active even if it's stopped (because we're in a buffering state, waiting for the next chunk) to be able to continue to update the NowPlayingInfoCenter. |
Codecov ReportBase: 11.83% // Head: 11.91% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## develop #7257 +/- ##
===========================================
+ Coverage 11.83% 11.91% +0.08%
===========================================
Files 1630 1637 +7
Lines 160349 160647 +298
Branches 65502 65643 +141
===========================================
+ Hits 18970 19142 +172
- Misses 140740 140867 +127
+ Partials 639 638 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
@@ -93,6 +94,7 @@ import MediaPlayer | |||
private override init() { | |||
audioPlayers = NSMapTable<NSString, VoiceMessageAudioPlayer>(valueOptions: .weakMemory) | |||
audioRecorders = NSHashTable<VoiceMessageAudioRecorder>(options: .weakMemory) | |||
nowPlayingInfoDelegates = NSMapTable<VoiceMessageAudioPlayer, VoiceMessageNowPlayingInfoDelegate>(valueOptions: .weakMemory) |
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 still worried about this strongly retaining the key/audio player
As a general rule please don't force push after receiving feedback as it completely breaks where the comments point to |
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.
Just a small comment inline about how we retain audio players and there's still some opened conversations. Otherwise looks good to me 👍
Following your comment, I also set the key as weak. |
@@ -242,7 +264,7 @@ import MediaPlayer | |||
} | |||
} | |||
|
|||
private func tearDownRemoteCommandCenter() { | |||
private func tearDownRemoteCommandCenter(for audioPlayer: VoiceMessageAudioPlayer) { |
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.
The audioPlayer
parameter is not used
Can you please remove it?
Kudos, SonarCloud Quality Gate passed! |
@giomfo as discussed, a live broadcast should not appear in Info Center while playing. Also if the app goes into background while listening a live broadcast, the playback is paused because we cannot get the next chunks. |
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.
SGTM, I share my comment while I run some additional tests
RiotSwiftUI/Modules/Room/VoiceBroadcastPlayback/MatrixSDK/VoiceBroadcastPlaybackViewModel.swift
Show resolved
Hide resolved
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.
Tests ok
LGTM
This PR fixes the display in the Now Playing Info Center (NPIC) when a user is listening to a voice broadcast.
The NPIC was showing a voice message instead of a voice broadcast.
To test: