| 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 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 size_t count = pendingEvents.size(); | 580 size_t count = pendingEvents.size(); |
| 581 for (size_t index = 0; index < count; ++index) | 581 for (size_t index = 0; index < count; ++index) |
| 582 dispatchEvent(pendingEvents[index].release(), IGNORE_EXCEPTION); | 582 dispatchEvent(pendingEvents[index].release(), IGNORE_EXCEPTION); |
| 583 } | 583 } |
| 584 | 584 |
| 585 void MediaController::clearPositionTimerFired(Timer<MediaController>*) | 585 void MediaController::clearPositionTimerFired(Timer<MediaController>*) |
| 586 { | 586 { |
| 587 m_position = MediaPlayer::invalidTime(); | 587 m_position = MediaPlayer::invalidTime(); |
| 588 } | 588 } |
| 589 | 589 |
| 590 bool MediaController::hasAudio() const | |
| 591 { | |
| 592 for (size_t index = 0; index < m_mediaElements.size(); ++index) { | |
| 593 if (m_mediaElements[index]->hasAudio()) | |
| 594 return true; | |
| 595 } | |
| 596 return false; | |
| 597 } | |
| 598 | |
| 599 const AtomicString& MediaController::interfaceName() const | 590 const AtomicString& MediaController::interfaceName() const |
| 600 { | 591 { |
| 601 return EventTargetNames::MediaController; | 592 return EventTargetNames::MediaController; |
| 602 } | 593 } |
| 603 | 594 |
| 604 // The spec says to fire periodic timeupdate events (those sent while playing) e
very | 595 // The spec says to fire periodic timeupdate events (those sent while playing) e
very |
| 605 // "15 to 250ms", we choose the slowest frequency | 596 // "15 to 250ms", we choose the slowest frequency |
| 606 static const double maxTimeupdateEventFrequency = 0.25; | 597 static const double maxTimeupdateEventFrequency = 0.25; |
| 607 | 598 |
| 608 void MediaController::startTimeupdateTimer() | 599 void MediaController::startTimeupdateTimer() |
| (...skipping 13 matching lines...) Expand all Loading... |
| 622 { | 613 { |
| 623 double now = WTF::currentTime(); | 614 double now = WTF::currentTime(); |
| 624 double timedelta = now - m_previousTimeupdateTime; | 615 double timedelta = now - m_previousTimeupdateTime; |
| 625 | 616 |
| 626 if (timedelta < maxTimeupdateEventFrequency) | 617 if (timedelta < maxTimeupdateEventFrequency) |
| 627 return; | 618 return; |
| 628 | 619 |
| 629 scheduleEvent(EventTypeNames::timeupdate); | 620 scheduleEvent(EventTypeNames::timeupdate); |
| 630 m_previousTimeupdateTime = now; | 621 m_previousTimeupdateTime = now; |
| 631 } | 622 } |
| OLD | NEW |