[WebKitLegacy] Media playback pauses on scroll
[WebKit-https.git] / Source / WebCore / platform / audio / PlatformMediaSession.h
index 721c7fa..25c1779 100644 (file)
@@ -49,6 +49,7 @@ class PlatformMediaSession
     , private LoggerHelper
 #endif
 {
+    WTF_MAKE_FAST_ALLOCATED;
 public:
     static std::unique_ptr<PlatformMediaSession> create(PlatformMediaSessionClient&);
 
@@ -84,6 +85,7 @@ public:
         SuspendedUnderLock,
         InvisibleAutoplay,
         ProcessInactive,
+        PlaybackSuspended,
     };
     InterruptionType interruptionType() const { return m_interruptionType; }
 
@@ -151,7 +153,6 @@ public:
 
     bool shouldOverrideBackgroundLoadingRestriction() const;
 
-    virtual bool canPlayToWirelessPlaybackTarget() const { return false; }
     virtual bool isPlayingToWirelessPlaybackTarget() const { return m_isPlayingToWirelessPlaybackTarget; }
     void isPlayingToWirelessPlaybackTargetChanged(bool);
 
@@ -162,7 +163,7 @@ public:
     void setShouldPlayToPlaybackTarget(bool) override { }
 #endif
 
-#if PLATFORM(IOS)
+#if PLATFORM(IOS_FAMILY)
     virtual bool requiresPlaybackTargetRouteMonitoring() const { return false; }
 #endif
 
@@ -175,6 +176,9 @@ public:
 
     virtual bool allowsNowPlayingControlsVisibility() const { return false; }
 
+    bool hasPlayedSinceLastInterruption() const { return m_hasPlayedSinceLastInterruption; }
+    void clearHasPlayedSinceLastInterruption() { m_hasPlayedSinceLastInterruption = false; }
+
 protected:
     PlatformMediaSessionClient& client() const { return m_client; }
 
@@ -193,6 +197,7 @@ private:
     int m_interruptionCount { 0 };
     bool m_notifyingClient;
     bool m_isPlayingToWirelessPlaybackTarget { false };
+    bool m_hasPlayedSinceLastInterruption { false };
 
 #if !RELEASE_LOG_DISABLED
     Ref<const Logger> m_logger;
@@ -235,10 +240,11 @@ public:
 
     virtual void wirelessRoutesAvailableDidChange() { }
     virtual void setWirelessPlaybackTarget(Ref<MediaPlaybackTarget>&&) { }
-    virtual bool canPlayToWirelessPlaybackTarget() const { return false; }
     virtual bool isPlayingToWirelessPlaybackTarget() const { return false; }
     virtual void setShouldPlayToPlaybackTarget(bool) { }
 
+    virtual bool isPlayingOnSecondScreen() const { return false; }
+
     virtual Document* hostingDocument() const = 0;
     virtual String sourceApplicationIdentifier() const = 0;
 
@@ -250,7 +256,7 @@ protected:
 
 String convertEnumerationToString(PlatformMediaSession::State);
 String convertEnumerationToString(PlatformMediaSession::InterruptionType);
-
+String convertEnumerationToString(PlatformMediaSession::RemoteControlCommandType);
 }
 
 namespace WTF {
@@ -274,6 +280,14 @@ struct LogArgument<WebCore::PlatformMediaSession::InterruptionType> {
     }
 };
 
+template <>
+struct LogArgument<WebCore::PlatformMediaSession::RemoteControlCommandType> {
+    static String toString(const WebCore::PlatformMediaSession::RemoteControlCommandType command)
+    {
+        return convertEnumerationToString(command);
+    }
+};
+
 } // namespace WTF
 
 #endif // PlatformMediaSession_h