Diff
Modified: trunk/LayoutTests/ChangeLog (272828 => 272829)
--- trunk/LayoutTests/ChangeLog 2021-02-13 02:16:44 UTC (rev 272828)
+++ trunk/LayoutTests/ChangeLog 2021-02-13 04:36:29 UTC (rev 272829)
@@ -1,3 +1,14 @@
+2021-02-12 Jer Noble <[email protected]>
+
+ [Mac] Sound does not play on YouTube after switching back to foreground
+ https://bugs.webkit.org/show_bug.cgi?id=221858
+ <rdar://70602677>
+
+ Reviewed by Eric Carlson.
+
+ * platform/mac/media/unmute-after-loading-expected.txt: Added.
+ * platform/mac/media/unmute-after-loading.html: Added.
+
2021-02-12 Chris Gambrell <[email protected]>
[LayoutTests] Convert http/tests/mime convert PHP to Python
Added: trunk/LayoutTests/platform/mac/media/unmute-after-loading-expected.txt (0 => 272829)
--- trunk/LayoutTests/platform/mac/media/unmute-after-loading-expected.txt (rev 0)
+++ trunk/LayoutTests/platform/mac/media/unmute-after-loading-expected.txt 2021-02-13 04:36:29 UTC (rev 272829)
@@ -0,0 +1,10 @@
+
+RUN(video.muted = true)
+RUN(video.src = "" "../../../media/content/audio-tracks"))
+EVENT(canplaythrough)
+RUN(video.load())
+EVENT(canplaythrough)
+RUN(video.muted = false)
+EXPECTED (internals.privatePlayerMuted(video) == 'false') OK
+END OF TEST
+
Added: trunk/LayoutTests/platform/mac/media/unmute-after-loading.html (0 => 272829)
--- trunk/LayoutTests/platform/mac/media/unmute-after-loading.html (rev 0)
+++ trunk/LayoutTests/platform/mac/media/unmute-after-loading.html 2021-02-13 04:36:29 UTC (rev 272829)
@@ -0,0 +1,28 @@
+
+<html>
+<head>
+ <title>unmute-after-loading</title>
+ <script src=""
+ <script src=""
+ <script>
+ window.addEventListener('load', async event => {
+ try {
+ findMediaElement();
+ run('video.muted = true');
+ run('video.src = "" "../../../media/content/audio-tracks")');
+ await waitFor(video, 'canplaythrough');
+ run('video.load()');
+ await waitFor(video, 'canplaythrough');
+ run('video.muted = false');
+ testExpected('internals.privatePlayerMuted(video)', false);
+ endTest();
+ } catch(e) {
+ failTest(e);
+ }
+ })
+ </script>
+</head>
+<body>
+ <video controls></video>
+</body>
+</html>
\ No newline at end of file
Modified: trunk/Source/WebCore/ChangeLog (272828 => 272829)
--- trunk/Source/WebCore/ChangeLog 2021-02-13 02:16:44 UTC (rev 272828)
+++ trunk/Source/WebCore/ChangeLog 2021-02-13 04:36:29 UTC (rev 272829)
@@ -1,3 +1,25 @@
+2021-02-12 Jer Noble <[email protected]>
+
+ [Mac] Sound does not play on YouTube after switching back to foreground
+ https://bugs.webkit.org/show_bug.cgi?id=221858
+ <rdar://70602677>
+
+ Reviewed by Eric Carlson.
+
+ Test: platform/mac/media/unmute-after-loading.html
+
+ Remove a stray, unnecessary reset of a cached muted state which kept mute
+ state from being changed the first time after loading.
+
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+ (WebCore::MediaPlayerPrivateAVFoundationObjC::createAVPlayer):
+ * testing/Internals.cpp:
+ (WebCore::Internals::privatePlayerMuted):
+ * testing/Internals.h:
+ * testing/Internals.idl:
+ * testing/Internals.mm:
+ (WebCore::Internals::privatePlayerMuted):
+
2021-02-12 Chris Dumez <[email protected]>
Reduce explicit usage of [objC release] in WebKit
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (272828 => 272829)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2021-02-13 02:16:44 UTC (rev 272828)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2021-02-13 04:36:29 UTC (rev 272829)
@@ -1007,8 +1007,6 @@
#endif
if (m_muted) {
- // Clear m_muted so setMuted doesn't return without doing anything.
- m_muted = false;
[m_avPlayer.get() setMuted:m_muted];
#if HAVE(AVPLAYER_SUPRESSES_AUDIO_RENDERING)
Modified: trunk/Source/WebCore/testing/Internals.cpp (272828 => 272829)
--- trunk/Source/WebCore/testing/Internals.cpp 2021-02-13 02:16:44 UTC (rev 272828)
+++ trunk/Source/WebCore/testing/Internals.cpp 2021-02-13 04:36:29 UTC (rev 272829)
@@ -4889,6 +4889,11 @@
{
return 0;
}
+
+bool Internals::privatePlayerMuted(const HTMLMediaElement&)
+{
+ return false;
+}
#endif
#endif
Modified: trunk/Source/WebCore/testing/Internals.h (272828 => 272829)
--- trunk/Source/WebCore/testing/Internals.h 2021-02-13 02:16:44 UTC (rev 272828)
+++ trunk/Source/WebCore/testing/Internals.h 2021-02-13 04:36:29 UTC (rev 272829)
@@ -631,6 +631,7 @@
bool elementShouldBufferData(HTMLMediaElement&);
String elementBufferingPolicy(HTMLMediaElement&);
double privatePlayerVolume(const HTMLMediaElement&);
+ bool privatePlayerMuted(const HTMLMediaElement&);
ExceptionOr<void> setOverridePreferredDynamicRangeMode(HTMLMediaElement&, const String&);
#endif
Modified: trunk/Source/WebCore/testing/Internals.idl (272828 => 272829)
--- trunk/Source/WebCore/testing/Internals.idl 2021-02-13 02:16:44 UTC (rev 272828)
+++ trunk/Source/WebCore/testing/Internals.idl 2021-02-13 04:36:29 UTC (rev 272829)
@@ -652,6 +652,7 @@
[Conditional=VIDEO] boolean elementShouldBufferData(HTMLMediaElement media);
[Conditional=VIDEO] DOMString elementBufferingPolicy(HTMLMediaElement media);
[Conditional=VIDEO] double privatePlayerVolume(HTMLMediaElement media);
+ [Conditional=VIDEO] boolean privatePlayerMuted(HTMLMediaElement media);
[Conditional=VIDEO, MayThrowException] undefined setOverridePreferredDynamicRangeMode(HTMLMediaElement media, DOMString mode);
[MayThrowException] undefined setIsPlayingToBluetoothOverride(optional boolean? isPlaying = null);
Modified: trunk/Source/WebCore/testing/Internals.mm (272828 => 272829)
--- trunk/Source/WebCore/testing/Internals.mm 2021-02-13 02:16:44 UTC (rev 272828)
+++ trunk/Source/WebCore/testing/Internals.mm 2021-02-13 04:36:29 UTC (rev 272829)
@@ -103,6 +103,17 @@
return 0;
return [player volume];
}
+
+bool Internals::privatePlayerMuted(const HTMLMediaElement& element)
+{
+ auto corePlayer = element.player();
+ if (!corePlayer)
+ return false;
+ auto player = corePlayer->objCAVFoundationAVPlayer();
+ if (!player)
+ return false;
+ return [player isMuted];
+}
#endif
String Internals::encodedPreferenceValue(const String& domain, const String& key)