bool MediaController::isBlocked() const { ASSERT(!m_mediaElements.isEmpty()); // A MediaController is a blocked media controller if the MediaController is a paused media // controller, if (m_paused) return true; bool allPaused = true; for (MediaElementSequence::const_iterator it = m_mediaElements.begin(); it != m_mediaElements.end(); ++it) { HTMLMediaElement* element = *it; // or if any of its slaved media elements are blocked media elements, if (element->isBlocked()) return true; // or if any of its slaved media elements whose autoplaying flag is true still have their // paused attribute set to true, if (element->isAutoplaying() && element->paused()) return true; if (!element->paused()) allPaused = false; } // or if all of its slaved media elements have their paused attribute set to true. return allPaused; }
bool MediaController::isBlocked() const { // A MediaController is a blocked media controller if the MediaController is a paused media // controller, if (m_paused) return true; if (m_mediaElements.isEmpty()) return false; bool allPaused = true; for (size_t index = 0; index < m_mediaElements.size(); ++index) { HTMLMediaElement* element = m_mediaElements[index]; // or if any of its slaved media elements are blocked media elements, if (element->isBlocked()) return true; // or if any of its slaved media elements whose autoplaying flag is true still have their // paused attribute set to true, if (element->isAutoplaying() && element->paused()) return true; if (!element->paused()) allPaused = false; } // or if all of its slaved media elements have their paused attribute set to true. return allPaused; }
bool MediaController::isRestrained() const { ASSERT(!m_mediaElements.isEmpty()); // A MediaController is a restrained media controller if the MediaController is a playing media // controller, if (m_paused) return false; bool anyAutoplayingAndPaused = false; bool allPaused = true; for (MediaElementSequence::const_iterator it = m_mediaElements.begin(); it != m_mediaElements.end(); ++it) { HTMLMediaElement* element = *it; // and none of its slaved media elements are blocked media elements, if (element->isBlocked()) return false; if (element->isAutoplaying() && element->paused()) anyAutoplayingAndPaused = true; if (!element->paused()) allPaused = false; } // but either at least one of its slaved media elements whose autoplaying flag is true still has // its paused attribute set to true, or, all of its slaved media elements have their paused // attribute set to true. return anyAutoplayingAndPaused || allPaused; }