Changeset 185424 in webkit
- Timestamp:
- Jun 10, 2015 11:43:52 AM (9 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r185423 r185424 1 2015-06-10 Matt Rajca <mrajca@apple.com> 2 3 Explicitly keep track of active HTMLMediaElements in MediaSessions. 4 https://bugs.webkit.org/show_bug.cgi?id=145829 5 6 Reviewed by Eric Carlson. 7 8 * Modules/mediasession/MediaSession.cpp: Add support for keeping track of active media elements. 9 (WebCore::MediaSession::addActiveMediaElement): 10 * Modules/mediasession/MediaSession.h: 11 * html/HTMLMediaElement.cpp: 12 (WebCore::HTMLMediaElement::playInternal): If the paused attribute is true and the readyState attribute has the 13 value HAVE_FUTURE_DATA or HAVE_ENOUGH_DATA, the media element becomes an active participating element of the 14 media session. 15 1 16 2015-06-10 Chris Dumez <cdumez@apple.com> 2 17 -
trunk/Source/WebCore/Modules/mediasession/MediaSession.cpp
r185394 r185424 67 67 } 68 68 69 Vector<HTMLMediaElement*> MediaSession::activeParticipatingElements() const 69 void MediaSession::addActiveMediaElement(HTMLMediaElement& element) 70 70 { 71 Vector<HTMLMediaElement*> elements; 72 73 for (auto* element : m_participatingElements) { 74 if (element->isPlaying()) 75 elements.append(element); 76 } 77 78 return elements; 71 m_activeParticipatingElements.add(&element); 79 72 } 80 73 … … 85 78 void MediaSession::togglePlayback() 86 79 { 87 for (auto* element : activeParticipatingElements()) {80 for (auto* element : m_activeParticipatingElements) { 88 81 if (element->paused()) 89 82 element->play(); -
trunk/Source/WebCore/Modules/mediasession/MediaSession.h
r185394 r185424 66 66 void removeMediaElement(HTMLMediaElement&); 67 67 68 Vector<HTMLMediaElement*> activeParticipatingElements() const;68 void addActiveMediaElement(HTMLMediaElement&); 69 69 70 70 State m_currentState { State::Idle }; 71 71 Vector<HTMLMediaElement*> m_participatingElements; 72 HashSet<HTMLMediaElement*> m_activeParticipatingElements; 72 73 73 74 const String m_kind; -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r185270 r185424 2830 2830 else if (m_readyState >= HAVE_FUTURE_DATA) 2831 2831 scheduleEvent(eventNames().playingEvent); 2832 2833 #if ENABLE(MEDIA_SESSION) 2834 // 6.3 Activating a media session from a media element 2835 // When the play() method is invoked, the paused attribute is true, and the readyState attribute has the value 2836 // HAVE_FUTURE_DATA or HAVE_ENOUGH_DATA, then 2837 // 1. Let media session be the value of the current media session. 2838 // 2. If we are not currently in media session's list of active participating media elements then append 2839 // ourselves to this list. 2840 if (m_readyState == HAVE_ENOUGH_DATA || m_readyState == HAVE_FUTURE_DATA) { 2841 if (m_session) 2842 m_session->addActiveMediaElement(*this); 2843 } 2844 #endif 2832 2845 } 2833 2846 m_autoplaying = false;
Note: See TracChangeset
for help on using the changeset viewer.