Changeset 185885 in webkit


Ignore:
Timestamp:
Jun 23, 2015 3:02:34 PM (9 years ago)
Author:
mrajca@apple.com
Message:

Support releasing media sessions
https://bugs.webkit.org/show_bug.cgi?id=146132

Reviewed by Darin Adler.

  • Modules/mediasession/MediaSession.cpp: Implemented as described in the Media Session spec.

(WebCore::MediaSession::releaseSession):
(WebCore::MediaSession::releaseInternal):

  • Modules/mediasession/MediaSession.h:
Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r185884 r185885  
     12015-06-18  Matt Rajca  <mrajca@apple.com>
     2
     3        Support releasing media sessions
     4        https://bugs.webkit.org/show_bug.cgi?id=146132
     5
     6        Reviewed by Darin Adler.
     7
     8        * Modules/mediasession/MediaSession.cpp: Implemented as described in the Media Session spec.
     9        (WebCore::MediaSession::releaseSession):
     10        (WebCore::MediaSession::releaseInternal):
     11        * Modules/mediasession/MediaSession.h:
     12
    1132015-06-23  Chris Fleizach  <cfleizach@apple.com>
    214
  • trunk/Source/WebCore/Modules/mediasession/MediaSession.cpp

    r185678 r185885  
    7575void MediaSession::releaseSession()
    7676{
     77    // 5.1.3
     78    // 1. Let media session be the current media session.
     79    // 2. Indefinitely pause all of media session's active participating media elements.
     80    // 3. Reset media session's active participating media elements to an empty list.
     81    while (!m_activeParticipatingElements.isEmpty())
     82        m_activeParticipatingElements.takeAny()->pause();
     83
     84    // 4. Run the media session release algorithm for media session.
     85    releaseInternal();
     86}
     87
     88void MediaSession::releaseInternal()
     89{
     90    // 6.5. Releasing a media session
     91    // 1. If current media session's current state is idle, then terminate these steps.
     92    if (m_currentState == State::Idle)
     93        return;
     94
     95    // 2. If current media session still has one or more active participating media elements, then terminate these steps.
     96    if (!m_activeParticipatingElements.isEmpty())
     97        return;
     98
     99    // 3. Optionally, based on platform conventions, the user agent must release any currently held platform media focus
     100    //    for current media session.
     101    // 4. Optionally, based on platform conventions, the user agent must remove any previously established ongoing media
     102    //    interface in the underlying platform’s notifications area and any ongoing media interface in the underlying
     103    //    platform's lock screen area for current media session, if any.
     104    // 5. Optionally, based on platform conventions, the user agent must prevent any hardware and/or software media keys
     105    //    from controlling playback of current media session's active participating media elements.
     106    // 6. Set current media session's current state to idle.
     107    m_currentState = State::Idle;
    77108}
    78109
  • trunk/Source/WebCore/Modules/mediasession/MediaSession.h

    r185678 r185885  
    7373    void addActiveMediaElement(HTMLMediaElement&);
    7474
     75    void releaseInternal();
     76
    7577    State m_currentState { State::Idle };
    7678    Vector<HTMLMediaElement*> m_participatingElements;
Note: See TracChangeset for help on using the changeset viewer.