Title: [265145] trunk/Source/WebCore
Revision
265145
Author
peng.l...@apple.com
Date
2020-07-31 10:09:04 -0700 (Fri, 31 Jul 2020)

Log Message

PIP on netflix.com shows only a gray window and spinner
https://bugs.webkit.org/show_bug.cgi?id=214899

Reviewed by Jer Noble.

Use an empty "seekableRanges" instead of a special "duration" value (NaN) to indicate
that seeking is not supported. With this change, the "duration" will always have a meaningful
value, so that WebAVPlayerController can work properly in the picture-in-picture mode.
Related change: https://trac.webkit.org/changeset/217858.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::supportsSeeking const):
* platform/cocoa/PlaybackSessionModelMediaElement.mm:
(WebCore::PlaybackSessionModelMediaElement::duration const):
(WebCore::PlaybackSessionModelMediaElement::seekableRanges const):
* platform/mac/WebPlaybackControlsManager.mm:
(-[WebPlaybackControlsManager canBeginTouchBarScrubbing]):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (265144 => 265145)


--- trunk/Source/WebCore/ChangeLog	2020-07-31 16:27:20 UTC (rev 265144)
+++ trunk/Source/WebCore/ChangeLog	2020-07-31 17:09:04 UTC (rev 265145)
@@ -1,3 +1,23 @@
+2020-07-31  Peng Liu  <peng.l...@apple.com>
+
+        PIP on netflix.com shows only a gray window and spinner
+        https://bugs.webkit.org/show_bug.cgi?id=214899
+
+        Reviewed by Jer Noble.
+
+        Use an empty "seekableRanges" instead of a special "duration" value (NaN) to indicate
+        that seeking is not supported. With this change, the "duration" will always have a meaningful
+        value, so that WebAVPlayerController can work properly in the picture-in-picture mode.
+        Related change: https://trac.webkit.org/changeset/217858.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::supportsSeeking const):
+        * platform/cocoa/PlaybackSessionModelMediaElement.mm:
+        (WebCore::PlaybackSessionModelMediaElement::duration const):
+        (WebCore::PlaybackSessionModelMediaElement::seekableRanges const):
+        * platform/mac/WebPlaybackControlsManager.mm:
+        (-[WebPlaybackControlsManager canBeginTouchBarScrubbing]):
+
 2020-07-31  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [GTK] Mouse wheel events on horizontal scrollbar not correctly handled when AC mode is forced

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (265144 => 265145)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2020-07-31 16:27:20 UTC (rev 265144)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2020-07-31 17:09:04 UTC (rev 265145)
@@ -7496,7 +7496,7 @@
 
 bool HTMLMediaElement::supportsSeeking() const
 {
-    return !document().quirks().needsSeekingSupportDisabled() && !isLiveStream();
+    return !document().quirks().needsSeekingSupportDisabled();
 }
 
 bool HTMLMediaElement::shouldOverrideBackgroundPlaybackRestriction(PlatformMediaSession::InterruptionType type) const

Modified: trunk/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.mm (265144 => 265145)


--- trunk/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.mm	2020-07-31 16:27:20 UTC (rev 265144)
+++ trunk/Source/WebCore/platform/cocoa/PlaybackSessionModelMediaElement.mm	2020-07-31 17:09:04 UTC (rev 265145)
@@ -426,9 +426,7 @@
 
 double PlaybackSessionModelMediaElement::duration() const
 {
-    if (!m_mediaElement)
-        return 0;
-    return m_mediaElement->supportsSeeking() ? m_mediaElement->duration() : std::numeric_limits<double>::quiet_NaN();
+    return m_mediaElement ? m_mediaElement->duration() : 0;
 }
 
 double PlaybackSessionModelMediaElement::currentTime() const
@@ -458,7 +456,7 @@
 
 Ref<TimeRanges> PlaybackSessionModelMediaElement::seekableRanges() const
 {
-    return m_mediaElement ? m_mediaElement->seekable() : TimeRanges::create();
+    return m_mediaElement && m_mediaElement->supportsSeeking() ? m_mediaElement->seekable() : TimeRanges::create();
 }
 
 double PlaybackSessionModelMediaElement::seekableTimeRangesLastModifiedTime() const

Modified: trunk/Source/WebCore/platform/mac/WebPlaybackControlsManager.mm (265144 => 265145)


--- trunk/Source/WebCore/platform/mac/WebPlaybackControlsManager.mm	2020-07-31 16:27:20 UTC (rev 265144)
+++ trunk/Source/WebCore/platform/mac/WebPlaybackControlsManager.mm	2020-07-31 17:09:04 UTC (rev 265145)
@@ -119,7 +119,7 @@
     // quirk means we pretend Netflix is a live stream for Touch Bar.) It's not ideal to return YES all the time for
     // other media. The intent of the API is that we return NO when the media is being scrubbed via the on-screen scrubber.
     // But we can only possibly get the right answer for media that uses the default controls.
-    return std::isfinite(_contentDuration);;
+    return std::isfinite(_contentDuration) && [_seekableTimeRanges count];
 }
 
 - (void)beginTouchBarScrubbing
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to