Title: [183613] trunk/Source/WebCore
- Revision
- 183613
- Author
- [email protected]
- Date
- 2015-04-29 20:40:16 -0700 (Wed, 29 Apr 2015)
Log Message
Not all videos should automatically play to playback target
https://bugs.webkit.org/show_bug.cgi?id=144430
<rdar://problem/20718523>
Reviewed by Darin Adler.
* Modules/mediasession/WebMediaSessionManager.cpp:
(WebCore::WebMediaSessionManager::clientStateDidChange): Consider ExternalDeviceAutoPlayCandidate.
Minor cleanup.
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::mediaState): Set ExternalDeviceAutoPlayCandidate when a <video>
has a file with an audio track that does not loop.
* page/MediaProducer.h: Add ExternalDeviceAutoPlayCandidate.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (183612 => 183613)
--- trunk/Source/WebCore/ChangeLog 2015-04-30 03:27:34 UTC (rev 183612)
+++ trunk/Source/WebCore/ChangeLog 2015-04-30 03:40:16 UTC (rev 183613)
@@ -1,3 +1,21 @@
+2015-04-29 Eric Carlson <[email protected]>
+
+ Not all videos should automatically play to playback target
+ https://bugs.webkit.org/show_bug.cgi?id=144430
+ <rdar://problem/20718523>
+
+ Reviewed by Darin Adler.
+
+ * Modules/mediasession/WebMediaSessionManager.cpp:
+ (WebCore::WebMediaSessionManager::clientStateDidChange): Consider ExternalDeviceAutoPlayCandidate.
+ Minor cleanup.
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::mediaState): Set ExternalDeviceAutoPlayCandidate when a <video>
+ has a file with an audio track that does not loop.
+
+ * page/MediaProducer.h: Add ExternalDeviceAutoPlayCandidate.
+
2015-04-29 Joseph Pecoraro <[email protected]>
LiveNodeList may unexpectedly return an element for empty string
Modified: trunk/Source/WebCore/Modules/mediasession/WebMediaSessionManager.cpp (183612 => 183613)
--- trunk/Source/WebCore/Modules/mediasession/WebMediaSessionManager.cpp 2015-04-30 03:27:34 UTC (rev 183612)
+++ trunk/Source/WebCore/Modules/mediasession/WebMediaSessionManager.cpp 2015-04-30 03:40:16 UTC (rev 183613)
@@ -144,9 +144,12 @@
if (!flagsAreSet(oldFlags, MediaProducer::RequiresPlaybackTargetMonitoring) && flagsAreSet(newFlags, MediaProducer::RequiresPlaybackTargetMonitoring))
configurePlaybackTargetMonitoring();
- if (!flagsAreSet(newFlags, MediaProducer::IsPlayingVideo))
+ if (!flagsAreSet(newFlags, MediaProducer::IsPlayingVideo) || !flagsAreSet(newFlags, MediaProducer::ExternalDeviceAutoPlayCandidate))
return;
+ if (!m_playbackTarget || !m_playbackTarget->hasActiveRoute())
+ return;
+
// Do not interrupt another element already playing to a device.
for (auto& state : m_clientState) {
if (state->contextId == contextId && state->client == &client)
@@ -156,17 +159,14 @@
return;
}
- if (m_playbackTarget && m_playbackTarget->hasActiveRoute()) {
+ for (auto& state : m_clientState) {
+ if (state->contextId == contextId && state->client == &client)
+ continue;
+ state->client->setShouldPlayToPlaybackTarget(state->contextId, false);
+ }
- for (auto& state : m_clientState) {
- if (state->contextId == contextId && state->client == &client)
- continue;
- state->client->setShouldPlayToPlaybackTarget(state->contextId, false);
- }
+ changedClientState->client->setShouldPlayToPlaybackTarget(changedClientState->contextId, true);
- changedClientState->client->setShouldPlayToPlaybackTarget(changedClientState->contextId, true);
- }
-
if (index && m_clientState.size() > 1)
std::swap(m_clientState.at(index), m_clientState.at(0));
}
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (183612 => 183613)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2015-04-30 03:27:34 UTC (rev 183612)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2015-04-30 03:40:16 UTC (rev 183613)
@@ -6189,6 +6189,7 @@
MediaStateFlags state = IsNotPlaying;
bool hasActiveVideo = isVideo() && hasVideo();
+ bool hasAudio = this->hasAudio();
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
if (isPlayingToWirelessPlaybackTarget())
state |= IsPlayingToExternalDevice;
@@ -6197,12 +6198,16 @@
if ((m_hasPlaybackTargetAvailabilityListeners || hasActiveVideo) && m_player->canPlayToWirelessPlaybackTarget())
state |= RequiresPlaybackTargetMonitoring;
}
+
+ if (hasActiveVideo && hasAudio && !loop())
+ state |= ExternalDeviceAutoPlayCandidate;
+
#endif
if (!isPlaying())
return state;
- if (hasAudio() && !muted())
+ if (hasAudio && !muted())
state |= IsPlayingAudio;
if (hasActiveVideo)
Modified: trunk/Source/WebCore/page/MediaProducer.h (183612 => 183613)
--- trunk/Source/WebCore/page/MediaProducer.h 2015-04-30 03:27:34 UTC (rev 183612)
+++ trunk/Source/WebCore/page/MediaProducer.h 2015-04-30 03:40:16 UTC (rev 183613)
@@ -36,6 +36,7 @@
IsPlayingVideo = 1 << 1,
IsPlayingToExternalDevice = 1 << 2,
RequiresPlaybackTargetMonitoring = 1 << 3,
+ ExternalDeviceAutoPlayCandidate = 1 << 4,
};
typedef unsigned MediaStateFlags;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes