Title: [185514] trunk/Source/WebCore
- Revision
- 185514
- Author
- [email protected]
- Date
- 2015-06-12 10:53:35 -0700 (Fri, 12 Jun 2015)
Log Message
Add barebones implementation of media session invocation algorithm.
https://bugs.webkit.org/show_bug.cgi?id=145847
Patch by Matt Rajca <[email protected]> on 2015-06-12
Reviewed by Darin Adler.
* Modules/mediasession/MediaSession.cpp:
(WebCore::MediaSession::invoke): Move the media session to an active state.
* Modules/mediasession/MediaSession.h:
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::playInternal): Call the media session invocation algorithm as described in the
Media Session spec.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (185513 => 185514)
--- trunk/Source/WebCore/ChangeLog 2015-06-12 17:43:31 UTC (rev 185513)
+++ trunk/Source/WebCore/ChangeLog 2015-06-12 17:53:35 UTC (rev 185514)
@@ -1,3 +1,17 @@
+2015-06-12 Matt Rajca <[email protected]>
+
+ Add barebones implementation of media session invocation algorithm.
+ https://bugs.webkit.org/show_bug.cgi?id=145847
+
+ Reviewed by Darin Adler.
+
+ * Modules/mediasession/MediaSession.cpp:
+ (WebCore::MediaSession::invoke): Move the media session to an active state.
+ * Modules/mediasession/MediaSession.h:
+ * html/HTMLMediaElement.cpp:
+ (WebCore::HTMLMediaElement::playInternal): Call the media session invocation algorithm as described in the
+ Media Session spec.
+
2015-06-12 Hunseop Jeong <[email protected]>
Use modern for-loops in WebCore/rendering - 1
Modified: trunk/Source/WebCore/Modules/mediasession/MediaSession.cpp (185513 => 185514)
--- trunk/Source/WebCore/Modules/mediasession/MediaSession.cpp 2015-06-12 17:43:31 UTC (rev 185513)
+++ trunk/Source/WebCore/Modules/mediasession/MediaSession.cpp 2015-06-12 17:53:35 UTC (rev 185514)
@@ -75,6 +75,23 @@
{
}
+bool MediaSession::invoke()
+{
+ // 4.4 Activating a media session
+ // 1. If we're already ACTIVE then return success.
+ if (m_currentState == State::Active)
+ return true;
+
+ // 2. Optionally, based on platform conventions, request the most appropriate platform-level media focus for media
+ // session based on its current media session type.
+
+ // 3. Run these substeps...
+
+ // 4. Set our current state to ACTIVE and return success.
+ m_currentState = State::Active;
+ return true;
+}
+
void MediaSession::togglePlayback()
{
for (auto* element : m_activeParticipatingElements) {
Modified: trunk/Source/WebCore/Modules/mediasession/MediaSession.h (185513 => 185514)
--- trunk/Source/WebCore/Modules/mediasession/MediaSession.h 2015-06-12 17:43:31 UTC (rev 185513)
+++ trunk/Source/WebCore/Modules/mediasession/MediaSession.h 2015-06-12 17:53:35 UTC (rev 185514)
@@ -56,6 +56,9 @@
State currentState() const { return m_currentState; }
void releaseSession();
+
+ // Runs the media session invocation algorithm and returns true on success.
+ bool invoke();
void togglePlayback();
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (185513 => 185514)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2015-06-12 17:43:31 UTC (rev 185513)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2015-06-12 17:53:35 UTC (rev 185514)
@@ -2837,9 +2837,17 @@
// 1. Let media session be the value of the current media session.
// 2. If we are not currently in media session's list of active participating media elements then append
// ourselves to this list.
+ // 3. Let activated be the result of running the media session invocation algorithm for media session.
+ // 4. If activated is failure, pause ourselves.
if (m_readyState == HAVE_ENOUGH_DATA || m_readyState == HAVE_FUTURE_DATA) {
- if (m_session)
+ if (m_session) {
m_session->addActiveMediaElement(*this);
+
+ if (!m_session->invoke()) {
+ pause();
+ return;
+ }
+ }
}
#endif
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes