summaryrefslogtreecommitdiffstats
path: root/dom/media/mediacontrol/MediaStatusManager.cpp
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:43:14 +0000
commit8dd16259287f58f9273002717ec4d27e97127719 (patch)
tree3863e62a53829a84037444beab3abd4ed9dfc7d0 /dom/media/mediacontrol/MediaStatusManager.cpp
parentReleasing progress-linux version 126.0.1-1~progress7.99u1. (diff)
downloadfirefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz
firefox-8dd16259287f58f9273002717ec4d27e97127719.zip
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/mediacontrol/MediaStatusManager.cpp')
-rw-r--r--dom/media/mediacontrol/MediaStatusManager.cpp29
1 files changed, 27 insertions, 2 deletions
diff --git a/dom/media/mediacontrol/MediaStatusManager.cpp b/dom/media/mediacontrol/MediaStatusManager.cpp
index 633ae19a44..6e86dbf2eb 100644
--- a/dom/media/mediacontrol/MediaStatusManager.cpp
+++ b/dom/media/mediacontrol/MediaStatusManager.cpp
@@ -380,6 +380,29 @@ void MediaStatusManager::UpdatePositionState(
mPositionStateChangedEvent.Notify(aState);
}
+void MediaStatusManager::UpdateGuessedPositionState(
+ uint64_t aBrowsingContextId, const nsID& aMediaId,
+ const Maybe<PositionState>& aGuessedState) {
+ mPlaybackStatusDelegate.UpdateGuessedPositionState(aBrowsingContextId,
+ aMediaId, aGuessedState);
+
+ // The position state comes from a non-active media session and
+ // there is another one active (with some metadata).
+ if (mActiveMediaSessionContextId &&
+ *mActiveMediaSessionContextId != aBrowsingContextId) {
+ return;
+ }
+
+ // media session is declared for the updated session, but there's no active
+ // session - it will get emitted once the session becomes active
+ if (mMediaSessionInfoMap.Contains(aBrowsingContextId) &&
+ !mActiveMediaSessionContextId) {
+ return;
+ }
+
+ mPositionStateChangedEvent.Notify(GetCurrentPositionState());
+}
+
void MediaStatusManager::NotifySupportedKeysChangedIfNeeded(
uint64_t aBrowsingContextId) {
// Only the active media session's supported actions would be shown in virtual
@@ -431,11 +454,13 @@ MediaMetadataBase MediaStatusManager::GetCurrentMediaMetadata() const {
Maybe<PositionState> MediaStatusManager::GetCurrentPositionState() const {
if (mActiveMediaSessionContextId) {
auto info = mMediaSessionInfoMap.Lookup(*mActiveMediaSessionContextId);
- if (info) {
+ if (info && info->mPositionState) {
return info->mPositionState;
}
}
- return Nothing();
+
+ return mPlaybackStatusDelegate.GuessedMediaPositionState(
+ mActiveMediaSessionContextId);
}
void MediaStatusManager::FillMissingTitleAndArtworkIfNeeded(