OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
612 if (m_paused) | 612 if (m_paused) |
613 return true; | 613 return true; |
614 | 614 |
615 for (size_t index = 0; index < m_mediaElements.size(); ++index) { | 615 for (size_t index = 0; index < m_mediaElements.size(); ++index) { |
616 if (!m_mediaElements[index]->canPlay()) | 616 if (!m_mediaElements[index]->canPlay()) |
617 return false; | 617 return false; |
618 } | 618 } |
619 return true; | 619 return true; |
620 } | 620 } |
621 | 621 |
622 bool MediaController::hasCurrentSrc() const | |
623 { | |
624 for (size_t index = 0; index < m_mediaElements.size(); ++index) { | |
625 if (!m_mediaElements[index]->hasCurrentSrc()) | |
626 return false; | |
627 } | |
628 return true; | |
629 } | |
630 | |
631 const AtomicString& MediaController::interfaceName() const | 622 const AtomicString& MediaController::interfaceName() const |
632 { | 623 { |
633 return EventTargetNames::MediaController; | 624 return EventTargetNames::MediaController; |
634 } | 625 } |
635 | 626 |
636 // The spec says to fire periodic timeupdate events (those sent while playing) e
very | 627 // The spec says to fire periodic timeupdate events (those sent while playing) e
very |
637 // "15 to 250ms", we choose the slowest frequency | 628 // "15 to 250ms", we choose the slowest frequency |
638 static const double maxTimeupdateEventFrequency = 0.25; | 629 static const double maxTimeupdateEventFrequency = 0.25; |
639 | 630 |
640 void MediaController::startTimeupdateTimer() | 631 void MediaController::startTimeupdateTimer() |
(...skipping 13 matching lines...) Expand all Loading... |
654 { | 645 { |
655 double now = WTF::currentTime(); | 646 double now = WTF::currentTime(); |
656 double timedelta = now - m_previousTimeupdateTime; | 647 double timedelta = now - m_previousTimeupdateTime; |
657 | 648 |
658 if (timedelta < maxTimeupdateEventFrequency) | 649 if (timedelta < maxTimeupdateEventFrequency) |
659 return; | 650 return; |
660 | 651 |
661 scheduleEvent(EventTypeNames::timeupdate); | 652 scheduleEvent(EventTypeNames::timeupdate); |
662 m_previousTimeupdateTime = now; | 653 m_previousTimeupdateTime = now; |
663 } | 654 } |
OLD | NEW |