Diff
Modified: trunk/Source/WebCore/ChangeLog (200489 => 200490)
--- trunk/Source/WebCore/ChangeLog 2016-05-05 23:11:13 UTC (rev 200489)
+++ trunk/Source/WebCore/ChangeLog 2016-05-05 23:18:20 UTC (rev 200490)
@@ -1,3 +1,94 @@
+2016-05-05 Jer Noble <[email protected]>
+
+ [WK2] Media controls don't update if controller is created after the interface is created
+ https://bugs.webkit.org/show_bug.cgi?id=157376
+
+ Reviewed by Beth Dakin.
+
+ Add getter methods to WebPlaybackSessionModel so that the model's values can be retrieved
+ if those values were missed before the equivalent WebPlaybackSessionInterface methods were
+ called. This necessatates a bunch of changes in HTMLMediaElement and related classes to
+ change PassRefPtr<TimeRanges> types to Ref<TimeRanges> (and one change in TimeRanges itself).
+ WebPlaybackSessionModelMediaElement can implement these new getter methods by querying the
+ values from the HTMLMediaElement, something it was doing already, so most of those changes
+ are simple refactoring.
+
+ There's no reason any longer for WebVideoFullscreenModel to inherit from WebPlaybackSessionModel,
+ so remove that superclass.
+
+ In WebPlaybackSessionInterfaceMac, when a new WebPlaybackControlsManager is set, use the new
+ getter methods on WebPlaybackSessionModel to update the values in the manager.
+
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::mediaPlayerCharacteristicChanged):
+ (WebCore::HTMLMediaElement::maxBufferedTime):
+ (WebCore::HTMLMediaElement::played):
+ (WebCore::HTMLMediaElement::buffered): Deleted.
+ (WebCore::HTMLMediaElement::seekable): Deleted.
+ * html/HTMLMediaElement.h:
+ * html/MediaController.cpp:
+ (MediaController::buffered):
+ (MediaController::seekable):
+ (MediaController::played):
+ * html/MediaController.h:
+ * html/MediaControllerInterface.h:
+ * html/TimeRanges.cpp:
+ (WebCore::TimeRanges::copy):
+ * html/TimeRanges.h:
+ * platform/cocoa/WebPlaybackSessionModel.h:
+ * platform/cocoa/WebPlaybackSessionModelMediaElement.h:
+ * platform/cocoa/WebPlaybackSessionModelMediaElement.mm:
+ (WebPlaybackSessionModelMediaElement::setWebPlaybackSessionInterface):
+ (WebPlaybackSessionModelMediaElement::updateForEventName):
+ (WebPlaybackSessionModelMediaElement::updateLegibleOptions):
+ (WebPlaybackSessionModelMediaElement::observedEventNames):
+ (WebPlaybackSessionModelMediaElement::eventNameAll):
+ (WebPlaybackSessionModelMediaElement::duration):
+ (WebPlaybackSessionModelMediaElement::currentTime):
+ (WebPlaybackSessionModelMediaElement::bufferedTime):
+ (WebPlaybackSessionModelMediaElement::isPlaying):
+ (WebPlaybackSessionModelMediaElement::playbackRate):
+ (WebPlaybackSessionModelMediaElement::seekableRanges):
+ (WebPlaybackSessionModelMediaElement::canPlayFastReverse):
+ (WebPlaybackSessionModelMediaElement::audioMediaSelectionOptions):
+ (WebPlaybackSessionModelMediaElement::audioMediaSelectedIndex):
+ (WebPlaybackSessionModelMediaElement::legibleMediaSelectionOptions):
+ (WebPlaybackSessionModelMediaElement::legibleMediaSelectedIndex):
+ (WebPlaybackSessionModelMediaElement::externalPlaybackEnabled):
+ (WebPlaybackSessionModelMediaElement::wirelessVideoPlaybackDisabled):
+ * platform/cocoa/WebVideoFullscreenModel.h:
+ * platform/cocoa/WebVideoFullscreenModelVideoElement.h:
+ * platform/cocoa/WebVideoFullscreenModelVideoElement.mm:
+ (WebVideoFullscreenModelVideoElement::requestFullscreenMode): Deleted.
+ (WebVideoFullscreenModelVideoElement::setVideoLayerFrame): Deleted.
+ (WebVideoFullscreenModelVideoElement::setVideoLayerGravity): Deleted.
+ (WebVideoFullscreenModelVideoElement::observedEventNames): Deleted.
+ (WebVideoFullscreenModelVideoElement::eventNameAll): Deleted.
+ (WebVideoFullscreenModelVideoElement::fullscreenModeChanged): Deleted.
+ * platform/ios/WebPlaybackSessionInterfaceAVKit.h:
+ * platform/ios/WebVideoFullscreenControllerAVKit.mm:
+ (WebVideoFullscreenControllerContext::play): Deleted.
+ (WebVideoFullscreenControllerContext::pause): Deleted.
+ (WebVideoFullscreenControllerContext::togglePlayState): Deleted.
+ (WebVideoFullscreenControllerContext::beginScrubbing): Deleted.
+ (WebVideoFullscreenControllerContext::endScrubbing): Deleted.
+ (WebVideoFullscreenControllerContext::seekToTime): Deleted.
+ (WebVideoFullscreenControllerContext::fastSeek): Deleted.
+ (WebVideoFullscreenControllerContext::beginScanningForward): Deleted.
+ (WebVideoFullscreenControllerContext::beginScanningBackward): Deleted.
+ (WebVideoFullscreenControllerContext::endScanning): Deleted.
+ (WebVideoFullscreenControllerContext::selectAudioMediaOption): Deleted.
+ (WebVideoFullscreenControllerContext::selectLegibleMediaOption): Deleted.
+ * platform/ios/WebVideoFullscreenInterfaceAVKit.h:
+ * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
+ (WebVideoFullscreenInterfaceAVKit::requestHideAndExitFullscreen):
+ (WebVideoFullscreenInterfaceAVKit::shouldExitFullscreenWithReason):
+ * platform/mac/WebPlaybackSessionInterfaceMac.mm:
+ (WebCore::timeRangesToArray):
+ (WebCore::WebPlaybackSessionInterfaceMac::setSeekableRanges):
+ (WebCore::WebPlaybackSessionInterfaceMac::setPlayBackControlsManager):
+ * platform/mac/WebVideoFullscreenInterfaceMac.h:
+
2016-05-05 Brady Eidson <[email protected]>
Modern IDB (Workers): Move TransactionOperation management from IDBConnectionToServer to IDBConnectionProxy.
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (200489 => 200490)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2016-05-05 23:11:13 UTC (rev 200489)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2016-05-05 23:18:20 UTC (rev 200490)
@@ -4636,7 +4636,7 @@
endProcessingMediaPlayerCallback();
}
-PassRefPtr<TimeRanges> HTMLMediaElement::buffered() const
+Ref<TimeRanges> HTMLMediaElement::buffered() const
{
if (!m_player)
return TimeRanges::create();
@@ -4659,7 +4659,7 @@
return bufferedRanges->end(numRanges - 1, ASSERT_NO_EXCEPTION);
}
-PassRefPtr<TimeRanges> HTMLMediaElement::played()
+Ref<TimeRanges> HTMLMediaElement::played()
{
if (m_playing) {
MediaTime time = currentMediaTime();
@@ -4673,7 +4673,7 @@
return m_playedTimeRanges->copy();
}
-PassRefPtr<TimeRanges> HTMLMediaElement::seekable() const
+Ref<TimeRanges> HTMLMediaElement::seekable() const
{
if (m_player)
return TimeRanges::create(*m_player->seekable());
Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (200489 => 200490)
--- trunk/Source/WebCore/html/HTMLMediaElement.h 2016-05-05 23:11:13 UTC (rev 200489)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h 2016-05-05 23:18:20 UTC (rev 200490)
@@ -167,7 +167,7 @@
String preload() const;
void setPreload(const String&);
- PassRefPtr<TimeRanges> buffered() const override;
+ Ref<TimeRanges> buffered() const override;
void load();
String canPlayType(const String& mimeType, const String& keySystem = String(), const URL& = URL()) const;
@@ -197,8 +197,8 @@
void updatePlaybackRate();
bool webkitPreservesPitch() const;
void setWebkitPreservesPitch(bool);
- PassRefPtr<TimeRanges> played() override;
- PassRefPtr<TimeRanges> seekable() const override;
+ Ref<TimeRanges> played() override;
+ Ref<TimeRanges> seekable() const override;
WEBCORE_EXPORT bool ended() const;
bool autoplay() const;
bool isAutoplaying() const { return m_autoplaying; }
Modified: trunk/Source/WebCore/html/MediaController.cpp (200489 => 200490)
--- trunk/Source/WebCore/html/MediaController.cpp 2016-05-05 23:11:13 UTC (rev 200489)
+++ trunk/Source/WebCore/html/MediaController.cpp 2016-05-05 23:18:20 UTC (rev 200490)
@@ -85,7 +85,7 @@
return m_mediaElements.contains(element);
}
-PassRefPtr<TimeRanges> MediaController::buffered() const
+Ref<TimeRanges> MediaController::buffered() const
{
if (m_mediaElements.isEmpty())
return TimeRanges::create();
@@ -93,13 +93,13 @@
// The buffered attribute must return a new static normalized TimeRanges object that represents
// the intersection of the ranges of the media resources of the slaved media elements that the
// user agent has buffered, at the time the attribute is evaluated.
- RefPtr<TimeRanges> bufferedRanges = m_mediaElements.first()->buffered();
+ Ref<TimeRanges> bufferedRanges = m_mediaElements.first()->buffered();
for (size_t index = 1; index < m_mediaElements.size(); ++index)
- bufferedRanges->intersectWith(*m_mediaElements[index]->buffered().get());
+ bufferedRanges->intersectWith(m_mediaElements[index]->buffered());
return bufferedRanges;
}
-PassRefPtr<TimeRanges> MediaController::seekable() const
+Ref<TimeRanges> MediaController::seekable() const
{
if (m_mediaElements.isEmpty())
return TimeRanges::create();
@@ -107,13 +107,13 @@
// The seekable attribute must return a new static normalized TimeRanges object that represents
// the intersection of the ranges of the media resources of the slaved media elements that the
// user agent is able to seek to, at the time the attribute is evaluated.
- RefPtr<TimeRanges> seekableRanges = m_mediaElements.first()->seekable();
+ Ref<TimeRanges> seekableRanges = m_mediaElements.first()->seekable();
for (size_t index = 1; index < m_mediaElements.size(); ++index)
- seekableRanges->intersectWith(*m_mediaElements[index]->seekable().get());
+ seekableRanges->intersectWith(m_mediaElements[index]->seekable());
return seekableRanges;
}
-PassRefPtr<TimeRanges> MediaController::played()
+Ref<TimeRanges> MediaController::played()
{
if (m_mediaElements.isEmpty())
return TimeRanges::create();
@@ -121,9 +121,9 @@
// The played attribute must return a new static normalized TimeRanges object that represents
// the union of the ranges of the media resources of the slaved media elements that the
// user agent has so far rendered, at the time the attribute is evaluated.
- RefPtr<TimeRanges> playedRanges = m_mediaElements.first()->played();
+ Ref<TimeRanges> playedRanges = m_mediaElements.first()->played();
for (size_t index = 1; index < m_mediaElements.size(); ++index)
- playedRanges->unionWith(*m_mediaElements[index]->played().get());
+ playedRanges->unionWith(m_mediaElements[index]->played());
return playedRanges;
}
Modified: trunk/Source/WebCore/html/MediaController.h (200489 => 200490)
--- trunk/Source/WebCore/html/MediaController.h 2016-05-05 23:11:13 UTC (rev 200489)
+++ trunk/Source/WebCore/html/MediaController.h 2016-05-05 23:18:20 UTC (rev 200490)
@@ -54,9 +54,9 @@
const String& mediaGroup() const { return m_mediaGroup; }
- PassRefPtr<TimeRanges> buffered() const override;
- PassRefPtr<TimeRanges> seekable() const override;
- PassRefPtr<TimeRanges> played() override;
+ Ref<TimeRanges> buffered() const override;
+ Ref<TimeRanges> seekable() const override;
+ Ref<TimeRanges> played() override;
double duration() const override;
double currentTime() const override;
Modified: trunk/Source/WebCore/html/MediaControllerInterface.h (200489 => 200490)
--- trunk/Source/WebCore/html/MediaControllerInterface.h 2016-05-05 23:11:13 UTC (rev 200489)
+++ trunk/Source/WebCore/html/MediaControllerInterface.h 2016-05-05 23:18:20 UTC (rev 200490)
@@ -42,9 +42,9 @@
virtual ~MediaControllerInterface() { };
// MediaController IDL:
- virtual PassRefPtr<TimeRanges> buffered() const = 0;
- virtual PassRefPtr<TimeRanges> seekable() const = 0;
- virtual PassRefPtr<TimeRanges> played() = 0;
+ virtual Ref<TimeRanges> buffered() const = 0;
+ virtual Ref<TimeRanges> seekable() const = 0;
+ virtual Ref<TimeRanges> played() = 0;
virtual double duration() const = 0;
virtual double currentTime() const = 0;
Modified: trunk/Source/WebCore/html/TimeRanges.cpp (200489 => 200490)
--- trunk/Source/WebCore/html/TimeRanges.cpp 2016-05-05 23:11:13 UTC (rev 200489)
+++ trunk/Source/WebCore/html/TimeRanges.cpp 2016-05-05 23:18:20 UTC (rev 200490)
@@ -90,7 +90,7 @@
m_ranges.invert();
}
-PassRefPtr<TimeRanges> TimeRanges::copy() const
+Ref<TimeRanges> TimeRanges::copy() const
{
return TimeRanges::create(m_ranges);
}
Modified: trunk/Source/WebCore/html/TimeRanges.h (200489 => 200490)
--- trunk/Source/WebCore/html/TimeRanges.h 2016-05-05 23:11:13 UTC (rev 200489)
+++ trunk/Source/WebCore/html/TimeRanges.h 2016-05-05 23:18:20 UTC (rev 200490)
@@ -45,7 +45,7 @@
WEBCORE_EXPORT double start(unsigned index, ExceptionCode&) const;
WEBCORE_EXPORT double end(unsigned index, ExceptionCode&) const;
- WEBCORE_EXPORT PassRefPtr<TimeRanges> copy() const;
+ WEBCORE_EXPORT Ref<TimeRanges> copy() const;
void invert();
WEBCORE_EXPORT void intersectWith(const TimeRanges&);
void unionWith(const TimeRanges&);
Modified: trunk/Source/WebCore/platform/cocoa/WebPlaybackSessionModel.h (200489 => 200490)
--- trunk/Source/WebCore/platform/cocoa/WebPlaybackSessionModel.h 2016-05-05 23:11:13 UTC (rev 200489)
+++ trunk/Source/WebCore/platform/cocoa/WebPlaybackSessionModel.h 2016-05-05 23:18:20 UTC (rev 200490)
@@ -28,8 +28,14 @@
#if PLATFORM(IOS) || (PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE))
+#include <wtf/Forward.h>
+#include <wtf/Ref.h>
+#include <wtf/Vector.h>
+
namespace WebCore {
+class TimeRanges;
+
class WebPlaybackSessionModel {
public:
virtual ~WebPlaybackSessionModel() { };
@@ -45,6 +51,20 @@
virtual void endScanning() = 0;
virtual void selectAudioMediaOption(uint64_t index) = 0;
virtual void selectLegibleMediaOption(uint64_t index) = 0;
+
+ virtual double duration() const = 0;
+ virtual double currentTime() const = 0;
+ virtual double bufferedTime() const = 0;
+ virtual bool isPlaying() const = 0;
+ virtual float playbackRate() const = 0;
+ virtual Ref<TimeRanges> seekableRanges() const = 0;
+ virtual bool canPlayFastReverse() const = 0;
+ virtual Vector<WTF::String> audioMediaSelectionOptions() const = 0;
+ virtual uint64_t audioMediaSelectedIndex() const = 0;
+ virtual Vector<WTF::String> legibleMediaSelectionOptions() const = 0;
+ virtual uint64_t legibleMediaSelectedIndex() const = 0;
+ virtual bool externalPlaybackEnabled() const = 0;
+ virtual bool wirelessVideoPlaybackDisabled() const = 0;
};
}
Modified: trunk/Source/WebCore/platform/cocoa/WebPlaybackSessionModelMediaElement.h (200489 => 200490)
--- trunk/Source/WebCore/platform/cocoa/WebPlaybackSessionModelMediaElement.h 2016-05-05 23:11:13 UTC (rev 200489)
+++ trunk/Source/WebCore/platform/cocoa/WebPlaybackSessionModelMediaElement.h 2016-05-05 23:18:20 UTC (rev 200490)
@@ -68,6 +68,20 @@
WEBCORE_EXPORT void selectAudioMediaOption(uint64_t index) final;
WEBCORE_EXPORT void selectLegibleMediaOption(uint64_t index) final;
+ double duration() const final;
+ double currentTime() const final;
+ double bufferedTime() const final;
+ bool isPlaying() const final;
+ float playbackRate() const final;
+ Ref<TimeRanges> seekableRanges() const final;
+ bool canPlayFastReverse() const final;
+ Vector<WTF::String> audioMediaSelectionOptions() const final;
+ uint64_t audioMediaSelectedIndex() const final;
+ Vector<WTF::String> legibleMediaSelectionOptions() const final;
+ uint64_t legibleMediaSelectedIndex() const final;
+ bool externalPlaybackEnabled() const final;
+ bool wirelessVideoPlaybackDisabled() const final;
+
protected:
WEBCORE_EXPORT WebPlaybackSessionModelMediaElement();
Modified: trunk/Source/WebCore/platform/cocoa/WebPlaybackSessionModelMediaElement.mm (200489 => 200490)
--- trunk/Source/WebCore/platform/cocoa/WebPlaybackSessionModelMediaElement.mm 2016-05-05 23:11:13 UTC (rev 200489)
+++ trunk/Source/WebCore/platform/cocoa/WebPlaybackSessionModelMediaElement.mm 2016-05-05 23:18:20 UTC (rev 200490)
@@ -69,16 +69,13 @@
return;
m_playbackSessionInterface->resetMediaState();
- if (!m_mediaElement)
- return;
-
- m_playbackSessionInterface->setDuration(m_mediaElement->duration());
- m_playbackSessionInterface->setCurrentTime(m_mediaElement->currentTime(), [[NSProcessInfo processInfo] systemUptime]);
- m_playbackSessionInterface->setBufferedTime(m_mediaElement->maxBufferedTime());
- m_playbackSessionInterface->setRate(!m_mediaElement->paused(), m_mediaElement->playbackRate());
- m_playbackSessionInterface->setSeekableRanges(*m_mediaElement->seekable());
- m_playbackSessionInterface->setCanPlayFastReverse(m_mediaElement->minFastReverseRate() < 0.0);
- m_playbackSessionInterface->setWirelessVideoPlaybackDisabled(m_mediaElement->mediaSession().wirelessVideoPlaybackDisabled(*m_mediaElement));
+ m_playbackSessionInterface->setDuration(duration());
+ m_playbackSessionInterface->setCurrentTime(currentTime(), [[NSProcessInfo processInfo] systemUptime]);
+ m_playbackSessionInterface->setBufferedTime(bufferedTime());
+ m_playbackSessionInterface->setRate(isPlaying(), playbackRate());
+ m_playbackSessionInterface->setSeekableRanges(seekableRanges());
+ m_playbackSessionInterface->setCanPlayFastReverse(canPlayFastReverse());
+ m_playbackSessionInterface->setWirelessVideoPlaybackDisabled(wirelessVideoPlaybackDisabled());
updateLegibleOptions();
}
@@ -142,7 +139,7 @@
m_playbackSessionInterface->setCurrentTime(m_mediaElement->currentTime(), [[NSProcessInfo processInfo] systemUptime]);
m_playbackSessionInterface->setBufferedTime(m_mediaElement->maxBufferedTime());
// FIXME: 130788 - find a better event to update seekable ranges from.
- m_playbackSessionInterface->setSeekableRanges(*m_mediaElement->seekable());
+ m_playbackSessionInterface->setSeekableRanges(m_mediaElement->seekable());
}
if (all
@@ -259,42 +256,135 @@
void WebPlaybackSessionModelMediaElement::updateLegibleOptions()
{
+ if (!m_mediaElement)
+ return;
+
AudioTrackList* audioTrackList = m_mediaElement->audioTracks();
TextTrackList* trackList = m_mediaElement->textTracks();
- if ((!trackList && !audioTrackList) || !m_mediaElement->document().page() || !m_mediaElement->mediaControlsHost())
+ if ((!trackList && !audioTrackList) || !m_mediaElement->document().page())
return;
- AtomicString displayMode = m_mediaElement->mediaControlsHost()->captionDisplayMode();
- TextTrack* offItem = m_mediaElement->mediaControlsHost()->captionMenuOffItem();
- TextTrack* automaticItem = m_mediaElement->mediaControlsHost()->captionMenuAutomaticItem();
-
auto& captionPreferences = m_mediaElement->document().page()->group().captionPreferences();
m_legibleTracksForMenu = captionPreferences.sortedTrackListForMenu(trackList);
m_audioTracksForMenu = captionPreferences.sortedTrackListForMenu(audioTrackList);
+ m_playbackSessionInterface->setAudioMediaSelectionOptions(audioMediaSelectionOptions(), audioMediaSelectedIndex());
+ m_playbackSessionInterface->setLegibleMediaSelectionOptions(legibleMediaSelectionOptions(), legibleMediaSelectedIndex());
+}
+
+const Vector<AtomicString>& WebPlaybackSessionModelMediaElement::observedEventNames()
+{
+ static NeverDestroyed<Vector<AtomicString>> sEventNames;
+
+ if (!sEventNames.get().size()) {
+ sEventNames.get().append(eventNames().durationchangeEvent);
+ sEventNames.get().append(eventNames().pauseEvent);
+ sEventNames.get().append(eventNames().playEvent);
+ sEventNames.get().append(eventNames().ratechangeEvent);
+ sEventNames.get().append(eventNames().timeupdateEvent);
+ sEventNames.get().append(eventNames().addtrackEvent);
+ sEventNames.get().append(eventNames().removetrackEvent);
+ sEventNames.get().append(eventNames().webkitcurrentplaybacktargetiswirelesschangedEvent);
+ }
+ return sEventNames.get();
+}
+
+const AtomicString& WebPlaybackSessionModelMediaElement::eventNameAll()
+{
+ static NeverDestroyed<AtomicString> sEventNameAll = "allEvents";
+ return sEventNameAll;
+}
+
+double WebPlaybackSessionModelMediaElement::duration() const
+{
+ return m_mediaElement ? m_mediaElement->duration() : 0;
+}
+
+double WebPlaybackSessionModelMediaElement::currentTime() const
+{
+ return m_mediaElement ? m_mediaElement->currentTime() : 0;
+}
+
+double WebPlaybackSessionModelMediaElement::bufferedTime() const
+{
+ return m_mediaElement ? m_mediaElement->maxBufferedTime() : 0;
+}
+
+bool WebPlaybackSessionModelMediaElement::isPlaying() const
+{
+ return m_mediaElement ? !m_mediaElement->paused() : false;
+}
+
+float WebPlaybackSessionModelMediaElement::playbackRate() const
+{
+ return m_mediaElement ? m_mediaElement->playbackRate() : 0;
+}
+
+Ref<TimeRanges> WebPlaybackSessionModelMediaElement::seekableRanges() const
+{
+ return m_mediaElement ? m_mediaElement->seekable() : TimeRanges::create();
+}
+
+bool WebPlaybackSessionModelMediaElement::canPlayFastReverse() const
+{
+ return m_mediaElement ? m_mediaElement->minFastReverseRate() < 0.0 : false;
+}
+
+Vector<WTF::String> WebPlaybackSessionModelMediaElement::audioMediaSelectionOptions() const
+{
Vector<String> audioTrackDisplayNames;
- uint64_t selectedAudioIndex = 0;
+ if (!m_mediaElement || !m_mediaElement->document().page())
+ return audioTrackDisplayNames;
+
+ auto& captionPreferences = m_mediaElement->document().page()->group().captionPreferences();
+
+ for (auto& audioTrack : m_audioTracksForMenu)
+ audioTrackDisplayNames.append(captionPreferences.displayNameForTrack(audioTrack.get()));
+
+ return audioTrackDisplayNames;
+}
+
+uint64_t WebPlaybackSessionModelMediaElement::audioMediaSelectedIndex() const
+{
for (size_t index = 0; index < m_audioTracksForMenu.size(); ++index) {
- auto& track = m_audioTracksForMenu[index];
- audioTrackDisplayNames.append(captionPreferences.displayNameForTrack(track.get()));
-
- if (track->enabled())
- selectedAudioIndex = index;
+ if (m_audioTracksForMenu[index]->enabled())
+ return index;
}
+ return 0;
+}
- m_playbackSessionInterface->setAudioMediaSelectionOptions(audioTrackDisplayNames, selectedAudioIndex);
+Vector<WTF::String> WebPlaybackSessionModelMediaElement::legibleMediaSelectionOptions() const
+{
+ Vector<String> trackDisplayNames;
- Vector<String> trackDisplayNames;
+ if (!m_mediaElement || !m_mediaElement->document().page())
+ return trackDisplayNames;
+
+ auto& captionPreferences = m_mediaElement->document().page()->group().captionPreferences();
+
+ for (auto& track : m_legibleTracksForMenu)
+ trackDisplayNames.append(captionPreferences.displayNameForTrack(track.get()));
+
+ return trackDisplayNames;
+}
+
+uint64_t WebPlaybackSessionModelMediaElement::legibleMediaSelectedIndex() const
+{
uint64_t selectedIndex = 0;
uint64_t offIndex = 0;
bool trackMenuItemSelected = false;
+ if (!m_mediaElement || !m_mediaElement->mediaControlsHost())
+ return selectedIndex;
+
+ AtomicString displayMode = m_mediaElement->mediaControlsHost()->captionDisplayMode();
+ TextTrack* offItem = m_mediaElement->mediaControlsHost()->captionMenuOffItem();
+ TextTrack* automaticItem = m_mediaElement->mediaControlsHost()->captionMenuAutomaticItem();
+
for (size_t index = 0; index < m_legibleTracksForMenu.size(); index++) {
auto& track = m_legibleTracksForMenu[index];
- trackDisplayNames.append(captionPreferences.displayNameForTrack(track.get()));
-
if (track == offItem)
offIndex = index;
@@ -309,35 +399,20 @@
}
}
- if (offIndex && !trackMenuItemSelected && displayMode == MediaControlsHost::forcedOnlyKeyword()) {
+ if (offIndex && !trackMenuItemSelected && displayMode == MediaControlsHost::forcedOnlyKeyword())
selectedIndex = offIndex;
- trackMenuItemSelected = true;
- }
- m_playbackSessionInterface->setLegibleMediaSelectionOptions(trackDisplayNames, selectedIndex);
+ return selectedIndex;
}
-const Vector<AtomicString>& WebPlaybackSessionModelMediaElement::observedEventNames()
+bool WebPlaybackSessionModelMediaElement::externalPlaybackEnabled() const
{
- static NeverDestroyed<Vector<AtomicString>> sEventNames;
-
- if (!sEventNames.get().size()) {
- sEventNames.get().append(eventNames().durationchangeEvent);
- sEventNames.get().append(eventNames().pauseEvent);
- sEventNames.get().append(eventNames().playEvent);
- sEventNames.get().append(eventNames().ratechangeEvent);
- sEventNames.get().append(eventNames().timeupdateEvent);
- sEventNames.get().append(eventNames().addtrackEvent);
- sEventNames.get().append(eventNames().removetrackEvent);
- sEventNames.get().append(eventNames().webkitcurrentplaybacktargetiswirelesschangedEvent);
- }
- return sEventNames.get();
+ return m_mediaElement ? m_mediaElement->webkitCurrentPlaybackTargetIsWireless() : false;
}
-const AtomicString& WebPlaybackSessionModelMediaElement::eventNameAll()
+bool WebPlaybackSessionModelMediaElement::wirelessVideoPlaybackDisabled() const
{
- static NeverDestroyed<AtomicString> sEventNameAll = "allEvents";
- return sEventNameAll;
+ return m_mediaElement ? m_mediaElement->mediaSession().wirelessVideoPlaybackDisabled(*m_mediaElement) : false;
}
#endif
Modified: trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenModel.h (200489 => 200490)
--- trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenModel.h 2016-05-05 23:11:13 UTC (rev 200489)
+++ trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenModel.h 2016-05-05 23:18:20 UTC (rev 200490)
@@ -35,7 +35,7 @@
namespace WebCore {
-class WebVideoFullscreenModel : public WebPlaybackSessionModel {
+class WebVideoFullscreenModel {
public:
virtual ~WebVideoFullscreenModel() { };
virtual void requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode) = 0;
Modified: trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.h (200489 => 200490)
--- trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.h 2016-05-05 23:11:13 UTC (rev 200489)
+++ trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.h 2016-05-05 23:18:20 UTC (rev 200490)
@@ -62,21 +62,9 @@
bool operator==(const EventListener& rhs) override
{return static_cast<WebCore::EventListener*>(this) == &rhs;}
- WEBCORE_EXPORT void play() override;
- WEBCORE_EXPORT void pause() override;
- WEBCORE_EXPORT void togglePlayState() override;
- WEBCORE_EXPORT void beginScrubbing() override;
- WEBCORE_EXPORT void endScrubbing() override;
- WEBCORE_EXPORT void seekToTime(double time) override;
- WEBCORE_EXPORT void fastSeek(double time) override;
- WEBCORE_EXPORT void beginScanningForward() override;
- WEBCORE_EXPORT void beginScanningBackward() override;
- WEBCORE_EXPORT void endScanning() override;
WEBCORE_EXPORT void requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode) override;
WEBCORE_EXPORT void setVideoLayerFrame(FloatRect) override;
WEBCORE_EXPORT void setVideoLayerGravity(VideoGravity) override;
- WEBCORE_EXPORT void selectAudioMediaOption(uint64_t index) override;
- WEBCORE_EXPORT void selectLegibleMediaOption(uint64_t index) override;
WEBCORE_EXPORT void fullscreenModeChanged(HTMLMediaElementEnums::VideoFullscreenMode) override;
WEBCORE_EXPORT bool isVisible() const override;
Modified: trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.mm (200489 => 200490)
--- trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.mm 2016-05-05 23:11:13 UTC (rev 200489)
+++ trunk/Source/WebCore/platform/cocoa/WebVideoFullscreenModelVideoElement.mm 2016-05-05 23:18:20 UTC (rev 200490)
@@ -135,56 +135,6 @@
m_videoElement->setVideoFullscreenLayer(m_videoFullscreenLayer.get());
}
-void WebVideoFullscreenModelVideoElement::play()
-{
- m_playbackSessionModel->play();
-}
-
-void WebVideoFullscreenModelVideoElement::pause()
-{
- m_playbackSessionModel->pause();
-}
-
-void WebVideoFullscreenModelVideoElement::togglePlayState()
-{
- m_playbackSessionModel->togglePlayState();
-}
-
-void WebVideoFullscreenModelVideoElement::beginScrubbing()
-{
- m_playbackSessionModel->beginScrubbing();
-}
-
-void WebVideoFullscreenModelVideoElement::endScrubbing()
-{
- m_playbackSessionModel->endScrubbing();
-}
-
-void WebVideoFullscreenModelVideoElement::seekToTime(double time)
-{
- m_playbackSessionModel->seekToTime(time);
-}
-
-void WebVideoFullscreenModelVideoElement::fastSeek(double time)
-{
- m_playbackSessionModel->fastSeek(time);
-}
-
-void WebVideoFullscreenModelVideoElement::beginScanningForward()
-{
- m_playbackSessionModel->beginScanningForward();
-}
-
-void WebVideoFullscreenModelVideoElement::beginScanningBackward()
-{
- m_playbackSessionModel->beginScanningBackward();
-}
-
-void WebVideoFullscreenModelVideoElement::endScanning()
-{
- m_playbackSessionModel->endScanning();
-}
-
void WebVideoFullscreenModelVideoElement::requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode mode)
{
if (m_videoElement && m_videoElement->fullscreenMode() != mode)
@@ -214,16 +164,6 @@
m_videoElement->setVideoFullscreenGravity(videoGravity);
}
-void WebVideoFullscreenModelVideoElement::selectAudioMediaOption(uint64_t selectedAudioIndex)
-{
- m_playbackSessionModel->selectAudioMediaOption(selectedAudioIndex);
-}
-
-void WebVideoFullscreenModelVideoElement::selectLegibleMediaOption(uint64_t index)
-{
- m_playbackSessionModel->selectLegibleMediaOption(index);
-}
-
const Vector<AtomicString>& WebVideoFullscreenModelVideoElement::observedEventNames()
{
static NeverDestroyed<Vector<AtomicString>> sEventNames;
Modified: trunk/Source/WebCore/platform/ios/WebPlaybackSessionInterfaceAVKit.h (200489 => 200490)
--- trunk/Source/WebCore/platform/ios/WebPlaybackSessionInterfaceAVKit.h 2016-05-05 23:11:13 UTC (rev 200489)
+++ trunk/Source/WebCore/platform/ios/WebPlaybackSessionInterfaceAVKit.h 2016-05-05 23:18:20 UTC (rev 200490)
@@ -72,6 +72,7 @@
}
virtual ~WebPlaybackSessionInterfaceAVKit();
WEBCORE_EXPORT void setWebPlaybackSessionModel(WebPlaybackSessionModel*);
+ WebPlaybackSessionModel* webPlaybackSessionModel() const { return m_playbackSessionModel; }
void setClient(WebPlaybackSessionInterfaceAVKitClient* client) { m_client = client; }
WEBCORE_EXPORT void resetMediaState() override;
Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm (200489 => 200490)
--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm 2016-05-05 23:11:13 UTC (rev 200489)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenControllerAVKit.mm 2016-05-05 23:18:20 UTC (rev 200490)
@@ -136,21 +136,9 @@
void setWirelessVideoPlaybackDisabled(bool) override;
// WebVideoFullscreenModel
- void play() override;
- void pause() override;
- void togglePlayState() override;
- void beginScrubbing() override;
- void endScrubbing() override;
- void seekToTime(double time) override;
- void fastSeek(double time) override;
- void beginScanningForward() override;
- void beginScanningBackward() override;
- void endScanning() override;
void requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode) override;
void setVideoLayerFrame(FloatRect) override;
void setVideoLayerGravity(WebVideoFullscreenModel::VideoGravity) override;
- void selectAudioMediaOption(uint64_t index) override;
- void selectLegibleMediaOption(uint64_t index) override;
void fullscreenModeChanged(HTMLMediaElementEnums::VideoFullscreenMode) override;
bool isVisible() const override;
@@ -365,106 +353,6 @@
#pragma mark WebVideoFullscreenModel
-void WebVideoFullscreenControllerContext::play()
-{
- ASSERT(isUIThread());
- RefPtr<WebVideoFullscreenControllerContext> strongThis(this);
- WebThreadRun([strongThis, this] {
- if (m_model)
- m_model->play();
- });
-}
-
-void WebVideoFullscreenControllerContext::pause()
-{
- ASSERT(isUIThread());
- RefPtr<WebVideoFullscreenControllerContext> strongThis(this);
- WebThreadRun([strongThis, this] {
- if (m_model)
- m_model->pause();
- });
-}
-
-void WebVideoFullscreenControllerContext::togglePlayState()
-{
- ASSERT(isUIThread());
- RefPtr<WebVideoFullscreenControllerContext> strongThis(this);
- WebThreadRun([strongThis, this] {
- if (m_model)
- m_model->togglePlayState();
- });
-}
-
-void WebVideoFullscreenControllerContext::beginScrubbing()
-{
- ASSERT(isUIThread());
- RefPtr<WebVideoFullscreenControllerContext> strongThis(this);
- WebThreadRun([strongThis, this] {
- if (m_model)
- m_model->beginScrubbing();
- });
-}
-
-void WebVideoFullscreenControllerContext::endScrubbing()
-{
- ASSERT(isUIThread());
- RefPtr<WebVideoFullscreenControllerContext> strongThis(this);
- WebThreadRun([strongThis, this] {
- if (m_model)
- m_model->endScrubbing();
- });
-}
-
-void WebVideoFullscreenControllerContext::seekToTime(double time)
-{
- ASSERT(isUIThread());
- RefPtr<WebVideoFullscreenControllerContext> strongThis(this);
- WebThreadRun([strongThis, this, time] {
- if (m_model)
- m_model->seekToTime(time);
- });
-}
-
-void WebVideoFullscreenControllerContext::fastSeek(double time)
-{
- ASSERT(isUIThread());
- RefPtr<WebVideoFullscreenControllerContext> strongThis(this);
- WebThreadRun([strongThis, this, time] {
- if (m_model)
- m_model->fastSeek(time);
- });
-}
-
-void WebVideoFullscreenControllerContext::beginScanningForward()
-{
- ASSERT(isUIThread());
- RefPtr<WebVideoFullscreenControllerContext> strongThis(this);
- WebThreadRun([strongThis, this] {
- if (m_model)
- m_model->beginScanningForward();
- });
-}
-
-void WebVideoFullscreenControllerContext::beginScanningBackward()
-{
- ASSERT(isUIThread());
- RefPtr<WebVideoFullscreenControllerContext> strongThis(this);
- WebThreadRun([strongThis, this] {
- if (m_model)
- m_model->beginScanningBackward();
- });
-}
-
-void WebVideoFullscreenControllerContext::endScanning()
-{
- ASSERT(isUIThread());
- RefPtr<WebVideoFullscreenControllerContext> strongThis(this);
- WebThreadRun([strongThis, this] {
- if (m_model)
- m_model->endScanning();
- });
-}
-
void WebVideoFullscreenControllerContext::requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode mode)
{
ASSERT(isUIThread());
@@ -508,26 +396,6 @@
});
}
-void WebVideoFullscreenControllerContext::selectAudioMediaOption(uint64_t index)
-{
- ASSERT(isUIThread());
- RefPtr<WebVideoFullscreenControllerContext> strongThis(this);
- WebThreadRun([strongThis, this, index] {
- if (m_model)
- m_model->selectAudioMediaOption(index);
- });
-}
-
-void WebVideoFullscreenControllerContext::selectLegibleMediaOption(uint64_t index)
-{
- ASSERT(isUIThread());
- RefPtr<WebVideoFullscreenControllerContext> strongThis(this);
- WebThreadRun([strongThis, this, index] {
- if (m_model)
- m_model->selectLegibleMediaOption(index);
- });
-}
-
void WebVideoFullscreenControllerContext::fullscreenModeChanged(HTMLMediaElementEnums::VideoFullscreenMode mode)
{
ASSERT(isUIThread());
Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h (200489 => 200490)
--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h 2016-05-05 23:11:13 UTC (rev 200489)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h 2016-05-05 23:18:20 UTC (rev 200490)
@@ -70,7 +70,8 @@
virtual ~WebVideoFullscreenInterfaceAVKit();
WEBCORE_EXPORT void setWebVideoFullscreenModel(WebVideoFullscreenModel*);
WEBCORE_EXPORT void setWebVideoFullscreenChangeObserver(WebVideoFullscreenChangeObserver*);
-
+ WebPlaybackSessionModel* webPlaybackSessionModel() const { return m_playbackSessionInterface->webPlaybackSessionModel(); }
+
WEBCORE_EXPORT void resetMediaState() final;
WEBCORE_EXPORT void setDuration(double) final;
WEBCORE_EXPORT void setCurrentTime(double currentTime, double anchorTime) final;
Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm (200489 => 200490)
--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm 2016-05-05 23:11:13 UTC (rev 200489)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm 2016-05-05 23:18:20 UTC (rev 200490)
@@ -863,8 +863,8 @@
[m_window setHidden:YES];
[[m_playerViewController view] setHidden:YES];
- if (m_videoFullscreenModel && !m_exitRequested) {
- m_videoFullscreenModel->pause();
+ if (webPlaybackSessionModel() && m_videoFullscreenModel && !m_exitRequested) {
+ webPlaybackSessionModel()->pause();
m_videoFullscreenModel->requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenModeNone);
}
}
@@ -1019,8 +1019,8 @@
return true;
}
- if (reason == ExitFullScreenReason::DoneButtonTapped || reason == ExitFullScreenReason::RemoteControlStopEventReceived)
- m_videoFullscreenModel->pause();
+ if (webPlaybackSessionModel() && (reason == ExitFullScreenReason::DoneButtonTapped || reason == ExitFullScreenReason::RemoteControlStopEventReceived))
+ webPlaybackSessionModel()->pause();
m_videoFullscreenModel->requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenModeNone);
Modified: trunk/Source/WebCore/platform/mac/WebPlaybackSessionInterfaceMac.mm (200489 => 200490)
--- trunk/Source/WebCore/platform/mac/WebPlaybackSessionInterfaceMac.mm 2016-05-05 23:11:13 UTC (rev 200489)
+++ trunk/Source/WebCore/platform/mac/WebPlaybackSessionInterfaceMac.mm 2016-05-05 23:18:20 UTC (rev 200490)
@@ -95,21 +95,25 @@
m_client->rateChanged(isPlaying, playbackRate);
}
-void WebPlaybackSessionInterfaceMac::setSeekableRanges(const TimeRanges& timeRanges)
+static RetainPtr<NSMutableArray> timeRangesToArray(const TimeRanges& timeRanges)
{
- WebPlaybackControlsManager* controlsManager = playBackControlsManager();
+ RetainPtr<NSMutableArray> rangeArray = adoptNS([[NSMutableArray alloc] init]);
- RetainPtr<NSMutableArray> seekableRanges = adoptNS([[NSMutableArray alloc] init]);
-
for (unsigned i = 0; i < timeRanges.length(); i++) {
const PlatformTimeRanges& ranges = timeRanges.ranges();
CMTimeRange range = CMTimeRangeMake(toCMTime(ranges.start(i)), toCMTime(ranges.end(i)));
- [seekableRanges addObject:[NSValue valueWithCMTimeRange:range]];
+ [rangeArray addObject:[NSValue valueWithCMTimeRange:range]];
}
- [controlsManager setSeekableTimeRanges:seekableRanges.get()];
+ return rangeArray;
}
+void WebPlaybackSessionInterfaceMac::setSeekableRanges(const TimeRanges& timeRanges)
+{
+ WebPlaybackControlsManager* controlsManager = playBackControlsManager();
+ [controlsManager setSeekableTimeRanges:timeRangesToArray(timeRanges).get()];
+}
+
void WebPlaybackSessionInterfaceMac::setAudioMediaSelectionOptions(const Vector<WTF::String>& options, uint64_t selectedIndex)
{
WebPlaybackControlsManager* controlsManager = playBackControlsManager();
@@ -143,6 +147,20 @@
void WebPlaybackSessionInterfaceMac::setPlayBackControlsManager(WebPlaybackControlsManager *manager)
{
m_playbackControlsManager = manager;
+
+ if (!manager || !m_playbackSessionModel)
+ return;
+
+ NSTimeInterval anchorTimeStamp = ![manager rate] ? NAN : [[NSProcessInfo processInfo] systemUptime];
+ manager.timing = [getAVValueTimingClass() valueTimingWithAnchorValue:m_playbackSessionModel->currentTime() anchorTimeStamp:anchorTimeStamp rate:0];
+ double duration = m_playbackSessionModel->duration();
+ manager.contentDuration = duration;
+ manager.hasEnabledAudio = duration > 0;
+ manager.hasEnabledVideo = duration > 0;
+ manager.rate = m_playbackSessionModel->isPlaying() ? m_playbackSessionModel->playbackRate() : 0.;
+ manager.seekableTimeRanges = timeRangesToArray(m_playbackSessionModel->seekableRanges()).get();
+ [manager setAudioMediaSelectionOptions:m_playbackSessionModel->audioMediaSelectionOptions() withSelectedIndex:static_cast<NSUInteger>(m_playbackSessionModel->audioMediaSelectedIndex())];
+ [manager setLegibleMediaSelectionOptions:m_playbackSessionModel->legibleMediaSelectionOptions() withSelectedIndex:static_cast<NSUInteger>(m_playbackSessionModel->legibleMediaSelectedIndex())];
}
}
Modified: trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.h (200489 => 200490)
--- trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.h 2016-05-05 23:11:13 UTC (rev 200489)
+++ trunk/Source/WebCore/platform/mac/WebVideoFullscreenInterfaceMac.h 2016-05-05 23:18:20 UTC (rev 200490)
@@ -59,6 +59,7 @@
}
virtual ~WebVideoFullscreenInterfaceMac();
WebVideoFullscreenModel* webVideoFullscreenModel() const { return m_videoFullscreenModel; }
+ WebPlaybackSessionModel* webPlaybackSessionModel() const { return m_playbackSessionInterface->webPlaybackSessionModel(); }
WEBCORE_EXPORT void setWebVideoFullscreenModel(WebVideoFullscreenModel*);
WebVideoFullscreenChangeObserver* webVideoFullscreenChangeObserver() const { return m_fullscreenChangeObserver; }
WEBCORE_EXPORT void setWebVideoFullscreenChangeObserver(WebVideoFullscreenChangeObserver*);
Modified: trunk/Source/WebKit2/ChangeLog (200489 => 200490)
--- trunk/Source/WebKit2/ChangeLog 2016-05-05 23:11:13 UTC (rev 200489)
+++ trunk/Source/WebKit2/ChangeLog 2016-05-05 23:18:20 UTC (rev 200490)
@@ -1,3 +1,39 @@
+2016-05-05 Jer Noble <[email protected]>
+
+ [WK2] Media controls don't update if controller is created after the interface is created
+ https://bugs.webkit.org/show_bug.cgi?id=157376
+
+ Reviewed by Beth Dakin.
+
+ Implement the new getter methods on WebPlaybackSessionModelContext by caching the values
+ passed through WebPlaybackSessionManagerProxy.
+
+ * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.h:
+ * UIProcess/Cocoa/WebPlaybackSessionManagerProxy.mm:
+ (WebKit::WebPlaybackSessionManagerProxy::setCurrentTime):
+ (WebKit::WebPlaybackSessionManagerProxy::setBufferedTime):
+ (WebKit::WebPlaybackSessionManagerProxy::setSeekableRangesVector):
+ (WebKit::WebPlaybackSessionManagerProxy::setCanPlayFastReverse):
+ (WebKit::WebPlaybackSessionManagerProxy::setAudioMediaSelectionOptions):
+ (WebKit::WebPlaybackSessionManagerProxy::setLegibleMediaSelectionOptions):
+ (WebKit::WebPlaybackSessionManagerProxy::setExternalPlaybackProperties):
+ (WebKit::WebPlaybackSessionManagerProxy::setWirelessVideoPlaybackDisabled):
+ (WebKit::WebPlaybackSessionManagerProxy::setDuration):
+ (WebKit::WebPlaybackSessionManagerProxy::setRate):
+ * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h:
+ * UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm:
+ (WebKit::WebVideoFullscreenModelContext::requestFullscreenMode): Deleted.
+ (WebKit::WebVideoFullscreenModelContext::setVideoLayerFrame): Deleted.
+ (WebKit::WebVideoFullscreenModelContext::setVideoLayerGravity): Deleted.
+ (WebKit::WebVideoFullscreenModelContext::fullscreenModeChanged): Deleted.
+ (WebKit::WebVideoFullscreenModelContext::isVisible): Deleted.
+ (WebKit::WebVideoFullscreenModelContext::didSetupFullscreen): Deleted.
+ (WebKit::WebVideoFullscreenModelContext::didEnterFullscreen): Deleted.
+ (WebKit::WebVideoFullscreenModelContext::didExitFullscreen): Deleted.
+ (WebKit::WebVideoFullscreenModelContext::didCleanupFullscreen): Deleted.
+ (WebKit::WebVideoFullscreenManagerProxy::WebVideoFullscreenManagerProxy): Deleted.
+ (WebKit::WebVideoFullscreenManagerProxy::~WebVideoFullscreenManagerProxy): Deleted.
+
2016-05-05 Dean Jackson <[email protected]>
Shadow DOM should not be experimental
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebPlaybackSessionManagerProxy.h (200489 => 200490)
--- trunk/Source/WebKit2/UIProcess/Cocoa/WebPlaybackSessionManagerProxy.h 2016-05-05 23:11:13 UTC (rev 200489)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebPlaybackSessionManagerProxy.h 2016-05-05 23:18:20 UTC (rev 200490)
@@ -30,6 +30,7 @@
#include "MessageReceiver.h"
#include <WebCore/GraphicsLayer.h>
#include <WebCore/PlatformView.h>
+#include <WebCore/TimeRanges.h>
#include <WebCore/WebPlaybackSessionModel.h>
#include <wtf/HashMap.h>
#include <wtf/PassRefPtr.h>
@@ -63,6 +64,20 @@
void invalidate() { m_manager = nullptr; }
+ void setDuration(double duration) { m_duration = duration; }
+ void setCurrentTime(double currentTime) { m_currentTime = currentTime; }
+ void setBufferedTime(double bufferedTime) { m_bufferedTime = bufferedTime; }
+ void setIsPlaying(bool isPlaying) { m_isPlaying = isPlaying; }
+ void setPlaybackRate(float playbackRate) { m_playbackRate = playbackRate; }
+ void setSeekableRanges(WebCore::TimeRanges& seekableRanges) { m_seekableRanges = seekableRanges; }
+ void setCanPlayFastReverse(bool canPlayFastReverse) { m_canPlayFastReverse = canPlayFastReverse; }
+ void setAudioMediaSelectionOptions(const Vector<WTF::String>& audioMediaSelectionOptions) { m_audioMediaSelectionOptions = audioMediaSelectionOptions; }
+ void setAudioMediaSelectedIndex(uint64_t audioMediaSelectedIndex) { m_audioMediaSelectedIndex = audioMediaSelectedIndex; }
+ void setLegibleMediaSelectionOptions(const Vector<WTF::String>& legibleMediaSelectionOptions) { m_legibleMediaSelectionOptions = legibleMediaSelectionOptions; }
+ void setLegibleMediaSelectedIndex(uint64_t legibleMediaSelectedIndex) { m_legibleMediaSelectedIndex = legibleMediaSelectedIndex; }
+ void setExternalPlaybackEnabled(bool externalPlaybackEnabled) { m_externalPlaybackEnabled = externalPlaybackEnabled; }
+ void setWirelessVideoPlaybackDisabled(bool wirelessVideoPlaybackDisabled) { m_wirelessVideoPlaybackDisabled = wirelessVideoPlaybackDisabled; }
+
private:
friend class WebVideoFullscreenModelContext;
@@ -86,8 +101,35 @@
void selectAudioMediaOption(uint64_t) final;
void selectLegibleMediaOption(uint64_t) final;
+ double duration() const final { return m_duration; }
+ double currentTime() const final { return m_currentTime; }
+ double bufferedTime() const final { return m_bufferedTime; }
+ bool isPlaying() const final { return m_isPlaying; }
+ float playbackRate() const final { return m_playbackRate; }
+ Ref<WebCore::TimeRanges> seekableRanges() const final { return m_seekableRanges.copyRef(); }
+ bool canPlayFastReverse() const final { return m_canPlayFastReverse; }
+ Vector<WTF::String> audioMediaSelectionOptions() const final { return m_audioMediaSelectionOptions; }
+ uint64_t audioMediaSelectedIndex() const final { return m_audioMediaSelectedIndex; }
+ Vector<WTF::String> legibleMediaSelectionOptions() const final { return m_legibleMediaSelectionOptions; }
+ uint64_t legibleMediaSelectedIndex() const final { return m_legibleMediaSelectedIndex; }
+ bool externalPlaybackEnabled() const final { return m_externalPlaybackEnabled; }
+ bool wirelessVideoPlaybackDisabled() const final { return m_wirelessVideoPlaybackDisabled; }
+
WebPlaybackSessionManagerProxy* m_manager;
uint64_t m_contextId;
+ double m_duration { 0 };
+ double m_currentTime { 0 };
+ double m_bufferedTime { 0 };
+ bool m_isPlaying { false };
+ float m_playbackRate { 0 };
+ Ref<WebCore::TimeRanges> m_seekableRanges { WebCore::TimeRanges::create() };
+ bool m_canPlayFastReverse { false };
+ Vector<WTF::String> m_audioMediaSelectionOptions;
+ uint64_t m_audioMediaSelectedIndex { 0 };
+ Vector<WTF::String> m_legibleMediaSelectionOptions;
+ uint64_t m_legibleMediaSelectedIndex { 0 };
+ bool m_externalPlaybackEnabled { false };
+ bool m_wirelessVideoPlaybackDisabled { false };
};
class WebPlaybackSessionManagerProxy : public RefCounted<WebPlaybackSessionManagerProxy>, private IPC::MessageReceiver {
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebPlaybackSessionManagerProxy.mm (200489 => 200490)
--- trunk/Source/WebKit2/UIProcess/Cocoa/WebPlaybackSessionManagerProxy.mm 2016-05-05 23:11:13 UTC (rev 200489)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebPlaybackSessionManagerProxy.mm 2016-05-05 23:18:20 UTC (rev 200490)
@@ -32,7 +32,6 @@
#import "WebPlaybackSessionManagerMessages.h"
#import "WebPlaybackSessionManagerProxyMessages.h"
#import "WebProcessProxy.h"
-#import <WebCore/TimeRanges.h>
#import <WebKitSystemInterface.h>
using namespace WebCore;
@@ -242,17 +241,25 @@
void WebPlaybackSessionManagerProxy::setCurrentTime(uint64_t contextId, double currentTime, double hostTime)
{
- ensureInterface(contextId).setCurrentTime(currentTime, hostTime);
+ RefPtr<WebPlaybackSessionModelContext> model;
+ RefPtr<PlatformWebPlaybackSessionInterface> interface;
+ std::tie(model, interface) = ensureModelAndInterface(contextId);
+ model->setCurrentTime(currentTime);
+ interface->setCurrentTime(currentTime, hostTime);
}
void WebPlaybackSessionManagerProxy::setBufferedTime(uint64_t contextId, double bufferedTime)
{
- ensureInterface(contextId).setBufferedTime(bufferedTime);
+ RefPtr<WebPlaybackSessionModelContext> model;
+ RefPtr<PlatformWebPlaybackSessionInterface> interface;
+ std::tie(model, interface) = ensureModelAndInterface(contextId);
+ model->setBufferedTime(bufferedTime);
+ interface->setBufferedTime(bufferedTime);
}
void WebPlaybackSessionManagerProxy::setSeekableRangesVector(uint64_t contextId, Vector<std::pair<double, double>> ranges)
{
- RefPtr<TimeRanges> timeRanges = TimeRanges::create();
+ Ref<TimeRanges> timeRanges = TimeRanges::create();
for (const auto& range : ranges) {
ASSERT(isfinite(range.first));
ASSERT(isfinite(range.second));
@@ -260,22 +267,40 @@
timeRanges->add(range.first, range.second);
}
- ensureInterface(contextId).setSeekableRanges(*timeRanges);
+ RefPtr<WebPlaybackSessionModelContext> model;
+ RefPtr<PlatformWebPlaybackSessionInterface> interface;
+ std::tie(model, interface) = ensureModelAndInterface(contextId);
+ model->setSeekableRanges(timeRanges);
+ interface->setSeekableRanges(timeRanges);
}
void WebPlaybackSessionManagerProxy::setCanPlayFastReverse(uint64_t contextId, bool value)
{
- ensureInterface(contextId).setCanPlayFastReverse(value);
+ RefPtr<WebPlaybackSessionModelContext> model;
+ RefPtr<PlatformWebPlaybackSessionInterface> interface;
+ std::tie(model, interface) = ensureModelAndInterface(contextId);
+ model->setCanPlayFastReverse(value);
+ interface->setCanPlayFastReverse(value);
}
void WebPlaybackSessionManagerProxy::setAudioMediaSelectionOptions(uint64_t contextId, Vector<String> options, uint64_t selectedIndex)
{
- ensureInterface(contextId).setAudioMediaSelectionOptions(options, selectedIndex);
+ RefPtr<WebPlaybackSessionModelContext> model;
+ RefPtr<PlatformWebPlaybackSessionInterface> interface;
+ std::tie(model, interface) = ensureModelAndInterface(contextId);
+ model->setAudioMediaSelectionOptions(options);
+ model->setAudioMediaSelectedIndex(selectedIndex);
+ interface->setAudioMediaSelectionOptions(options, selectedIndex);
}
void WebPlaybackSessionManagerProxy::setLegibleMediaSelectionOptions(uint64_t contextId, Vector<String> options, uint64_t selectedIndex)
{
- ensureInterface(contextId).setLegibleMediaSelectionOptions(options, selectedIndex);
+ RefPtr<WebPlaybackSessionModelContext> model;
+ RefPtr<PlatformWebPlaybackSessionInterface> interface;
+ std::tie(model, interface) = ensureModelAndInterface(contextId);
+ model->setLegibleMediaSelectionOptions(options);
+ model->setLegibleMediaSelectedIndex(selectedIndex);
+ interface->setLegibleMediaSelectionOptions(options, selectedIndex);
}
void WebPlaybackSessionManagerProxy::setExternalPlaybackProperties(uint64_t contextId, bool enabled, uint32_t targetType, String localizedDeviceName)
@@ -283,22 +308,39 @@
WebPlaybackSessionInterface::ExternalPlaybackTargetType type = static_cast<WebPlaybackSessionInterface::ExternalPlaybackTargetType>(targetType);
ASSERT(type == WebPlaybackSessionInterface::TargetTypeAirPlay || type == WebPlaybackSessionInterface::TargetTypeTVOut || type == WebPlaybackSessionInterface::TargetTypeNone);
- ensureInterface(contextId).setExternalPlayback(enabled, type, localizedDeviceName);
+ RefPtr<WebPlaybackSessionModelContext> model;
+ RefPtr<PlatformWebPlaybackSessionInterface> interface;
+ std::tie(model, interface) = ensureModelAndInterface(contextId);
+ model->setExternalPlaybackEnabled(enabled);
+ interface->setExternalPlayback(enabled, type, localizedDeviceName);
}
void WebPlaybackSessionManagerProxy::setWirelessVideoPlaybackDisabled(uint64_t contextId, bool disabled)
{
- ensureInterface(contextId).setWirelessVideoPlaybackDisabled(disabled);
+ RefPtr<WebPlaybackSessionModelContext> model;
+ RefPtr<PlatformWebPlaybackSessionInterface> interface;
+ std::tie(model, interface) = ensureModelAndInterface(contextId);
+ model->setWirelessVideoPlaybackDisabled(disabled);
+ interface->setWirelessVideoPlaybackDisabled(disabled);
}
void WebPlaybackSessionManagerProxy::setDuration(uint64_t contextId, double duration)
{
- ensureInterface(contextId).setDuration(duration);
+ RefPtr<WebPlaybackSessionModelContext> model;
+ RefPtr<PlatformWebPlaybackSessionInterface> interface;
+ std::tie(model, interface) = ensureModelAndInterface(contextId);
+ model->setDuration(duration);
+ interface->setDuration(duration);
}
void WebPlaybackSessionManagerProxy::setRate(uint64_t contextId, bool isPlaying, double rate)
{
- ensureInterface(contextId).setRate(isPlaying, rate);
+ RefPtr<WebPlaybackSessionModelContext> model;
+ RefPtr<PlatformWebPlaybackSessionInterface> interface;
+ std::tie(model, interface) = ensureModelAndInterface(contextId);
+ model->setIsPlaying(isPlaying);
+ model->setPlaybackRate(rate);
+ interface->setRate(isPlaying, rate);
}
#pragma mark Messages to WebPlaybackSessionManager
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h (200489 => 200490)
--- trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h 2016-05-05 23:11:13 UTC (rev 200489)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.h 2016-05-05 23:18:20 UTC (rev 200490)
@@ -74,21 +74,9 @@
WebVideoFullscreenModelContext(WebVideoFullscreenManagerProxy&, WebPlaybackSessionModelContext&, uint64_t);
// WebVideoFullscreenModel
- void play() override;
- void pause() override;
- void togglePlayState() override;
- void beginScrubbing() override;
- void endScrubbing() override;
- void seekToTime(double) override;
- void fastSeek(double time) override;
- void beginScanningForward() override;
- void beginScanningBackward() override;
- void endScanning() override;
void requestFullscreenMode(WebCore::HTMLMediaElementEnums::VideoFullscreenMode) override;
void setVideoLayerFrame(WebCore::FloatRect) override;
void setVideoLayerGravity(VideoGravity) override;
- void selectAudioMediaOption(uint64_t) override;
- void selectLegibleMediaOption(uint64_t) override;
void fullscreenModeChanged(WebCore::HTMLMediaElementEnums::VideoFullscreenMode) override;
bool isVisible() const override;
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm (200489 => 200490)
--- trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm 2016-05-05 23:11:13 UTC (rev 200489)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebVideoFullscreenManagerProxy.mm 2016-05-05 23:18:20 UTC (rev 200490)
@@ -123,56 +123,6 @@
{
}
-void WebVideoFullscreenModelContext::play()
-{
- m_playbackSessionModel->play();
-}
-
-void WebVideoFullscreenModelContext::pause()
-{
- m_playbackSessionModel->pause();
-}
-
-void WebVideoFullscreenModelContext::togglePlayState()
-{
- m_playbackSessionModel->togglePlayState();
-}
-
-void WebVideoFullscreenModelContext::beginScrubbing()
-{
- m_playbackSessionModel->beginScrubbing();
-}
-
-void WebVideoFullscreenModelContext::endScrubbing()
-{
- m_playbackSessionModel->endScrubbing();
-}
-
-void WebVideoFullscreenModelContext::seekToTime(double time)
-{
- m_playbackSessionModel->seekToTime(time);
-}
-
-void WebVideoFullscreenModelContext::fastSeek(double time)
-{
- m_playbackSessionModel->fastSeek(time);
-}
-
-void WebVideoFullscreenModelContext::beginScanningForward()
-{
- m_playbackSessionModel->beginScanningForward();
-}
-
-void WebVideoFullscreenModelContext::beginScanningBackward()
-{
- m_playbackSessionModel->beginScanningBackward();
-}
-
-void WebVideoFullscreenModelContext::endScanning()
-{
- m_playbackSessionModel->endScanning();
-}
-
void WebVideoFullscreenModelContext::requestFullscreenMode(HTMLMediaElementEnums::VideoFullscreenMode mode)
{
if (m_manager)
@@ -191,16 +141,6 @@
m_manager->setVideoLayerGravity(m_contextId, gravity);
}
-void WebVideoFullscreenModelContext::selectAudioMediaOption(uint64_t optionId)
-{
- m_playbackSessionModel->selectAudioMediaOption(optionId);
-}
-
-void WebVideoFullscreenModelContext::selectLegibleMediaOption(uint64_t optionId)
-{
- m_playbackSessionModel->selectLegibleMediaOption(optionId);
-}
-
void WebVideoFullscreenModelContext::fullscreenModeChanged(WebCore::HTMLMediaElementEnums::VideoFullscreenMode mode)
{
if (m_manager)