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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 MediaController::MediaController(ExecutionContext* context) | 48 MediaController::MediaController(ExecutionContext* context) |
49 : m_paused(false) | 49 : m_paused(false) |
50 , m_defaultPlaybackRate(1) | 50 , m_defaultPlaybackRate(1) |
51 , m_volume(1) | 51 , m_volume(1) |
52 , m_position(MediaPlayer::invalidTime()) | 52 , m_position(MediaPlayer::invalidTime()) |
53 , m_muted(false) | 53 , m_muted(false) |
54 , m_readyState(HTMLMediaElement::HAVE_NOTHING) | 54 , m_readyState(HTMLMediaElement::HAVE_NOTHING) |
55 , m_playbackState(WAITING) | 55 , m_playbackState(WAITING) |
56 , m_asyncEventTimer(this, &MediaController::asyncEventTimerFired) | 56 , m_asyncEventTimer(this, &MediaController::asyncEventTimerFired) |
57 , m_clearPositionTimer(this, &MediaController::clearPositionTimerFired) | 57 , m_clearPositionTimer(this, &MediaController::clearPositionTimerFired) |
58 , m_closedCaptionsVisible(false) | |
59 , m_clock(Clock::create()) | 58 , m_clock(Clock::create()) |
60 , m_executionContext(context) | 59 , m_executionContext(context) |
61 , m_timeupdateTimer(this, &MediaController::timeupdateTimerFired) | 60 , m_timeupdateTimer(this, &MediaController::timeupdateTimerFired) |
62 , m_previousTimeupdateTime(0) | 61 , m_previousTimeupdateTime(0) |
63 { | 62 { |
64 ScriptWrappable::init(this); | 63 ScriptWrappable::init(this); |
65 } | 64 } |
66 | 65 |
67 MediaController::~MediaController() | 66 MediaController::~MediaController() |
68 { | 67 { |
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 | 567 |
569 bool MediaController::hasVideo() const | 568 bool MediaController::hasVideo() const |
570 { | 569 { |
571 for (size_t index = 0; index < m_mediaElements.size(); ++index) { | 570 for (size_t index = 0; index < m_mediaElements.size(); ++index) { |
572 if (m_mediaElements[index]->hasVideo()) | 571 if (m_mediaElements[index]->hasVideo()) |
573 return true; | 572 return true; |
574 } | 573 } |
575 return false; | 574 return false; |
576 } | 575 } |
577 | 576 |
578 bool MediaController::hasClosedCaptions() const | |
579 { | |
580 for (size_t index = 0; index < m_mediaElements.size(); ++index) { | |
581 if (m_mediaElements[index]->hasClosedCaptions()) | |
582 return true; | |
583 } | |
584 return false; | |
585 } | |
586 | |
587 void MediaController::setClosedCaptionsVisible(bool visible) | |
588 { | |
589 m_closedCaptionsVisible = visible; | |
590 for (size_t index = 0; index < m_mediaElements.size(); ++index) | |
591 m_mediaElements[index]->setClosedCaptionsVisible(visible); | |
592 } | |
593 | |
594 void MediaController::beginScrubbing() | 577 void MediaController::beginScrubbing() |
595 { | 578 { |
596 for (size_t index = 0; index < m_mediaElements.size(); ++index) | 579 for (size_t index = 0; index < m_mediaElements.size(); ++index) |
597 m_mediaElements[index]->beginScrubbing(); | 580 m_mediaElements[index]->beginScrubbing(); |
598 if (m_playbackState == PLAYING) | 581 if (m_playbackState == PLAYING) |
599 m_clock->stop(); | 582 m_clock->stop(); |
600 } | 583 } |
601 | 584 |
602 void MediaController::endScrubbing() | 585 void MediaController::endScrubbing() |
603 { | 586 { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 { | 628 { |
646 double now = WTF::currentTime(); | 629 double now = WTF::currentTime(); |
647 double timedelta = now - m_previousTimeupdateTime; | 630 double timedelta = now - m_previousTimeupdateTime; |
648 | 631 |
649 if (timedelta < maxTimeupdateEventFrequency) | 632 if (timedelta < maxTimeupdateEventFrequency) |
650 return; | 633 return; |
651 | 634 |
652 scheduleEvent(EventTypeNames::timeupdate); | 635 scheduleEvent(EventTypeNames::timeupdate); |
653 m_previousTimeupdateTime = now; | 636 m_previousTimeupdateTime = now; |
654 } | 637 } |
OLD | NEW |