Changeset 125337 in webkit
- Timestamp:
- Aug 10, 2012, 4:50:46 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r125335 r125337 1 2012-08-10 Jer Noble <jer.noble@apple.com> 2 3 no timeupdate events emitted for media controller 4 https://bugs.webkit.org/show_bug.cgi?id=93745 5 6 Reviewed by Eric Carlson. 7 8 New test checking that the timeupdate event is emmitted correctly during playback. 9 10 * media/media-controller-timeupdate-expected.txt: Added. 11 * media/media-controller-timeupdate.html: Added. 12 1 13 2012-08-09 Jeffrey Pfau <jpfau@apple.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r125335 r125337 1 2012-08-10 Jer Noble <jer.noble@apple.com> 2 3 no timeupdate events emitted for media controller 4 https://bugs.webkit.org/show_bug.cgi?id=93745 5 6 Reviewed by Eric Carlson. 7 8 Generate timeupdate events while the current position is changing. 9 10 Test: media/media-controller-timeupdate.html 11 12 Enforce the spec requirement that the timeupdate event is fired no more often 13 than every 250ms. 14 * html/MediaController.cpp: 15 (MediaController::scheduleTimeupdateEvent): 16 17 Add a periodic firing timer to generate timeupdate events during playback. 18 * html/MediaController.cpp: 19 (MediaController::startTimeupdateTimer): 20 (MediaController::timeupdateTimerFired): 21 22 * html/MediaController.cpp: 23 (MediaController::MediaController): Initialize m_previousTimeupdateTime. 24 (MediaController::setCurrentTime): Call scheduleTimeUpdateEvent. 25 (MediaController::updatePlaybackState): Start and stop the timeupdate timer. 26 * html/MediaController.h: 27 1 28 2012-08-09 Jeffrey Pfau <jpfau@apple.com> 2 29 -
trunk/Source/WebCore/html/MediaController.cpp
r123386 r125337 57 57 , m_clock(Clock::create()) 58 58 , m_scriptExecutionContext(context) 59 , m_timeupdateTimer(this, &MediaController::timeupdateTimerFired) 60 , m_previousTimeupdateTime(0) 59 61 { 60 62 } … … 172 174 for (size_t index = 0; index < m_mediaElements.size(); ++index) 173 175 m_mediaElements[index]->seek(time, code); 176 177 scheduleTimeupdateEvent(); 174 178 } 175 179 … … 396 400 eventName = eventNames().waitingEvent; 397 401 m_clock->stop(); 402 m_timeupdateTimer.stop(); 398 403 break; 399 404 case ENDED: 400 405 eventName = eventNames().endedEvent; 401 406 m_clock->stop(); 407 m_timeupdateTimer.stop(); 402 408 break; 403 409 case PLAYING: 404 410 eventName = eventNames().playingEvent; 405 411 m_clock->start(); 412 startTimeupdateTimer(); 406 413 break; 407 414 default: … … 606 613 } 607 614 615 // The spec says to fire periodic timeupdate events (those sent while playing) every 616 // "15 to 250ms", we choose the slowest frequency 617 static const double maxTimeupdateEventFrequency = 0.25; 618 619 void MediaController::startTimeupdateTimer() 620 { 621 if (m_timeupdateTimer.isActive()) 622 return; 623 624 m_timeupdateTimer.startRepeating(maxTimeupdateEventFrequency); 625 } 626 627 void MediaController::timeupdateTimerFired(Timer<MediaController>*) 628 { 629 scheduleTimeupdateEvent(); 630 } 631 632 void MediaController::scheduleTimeupdateEvent() 633 { 634 double now = WTF::currentTime(); 635 double timedelta = now - m_previousTimeupdateTime; 636 637 if (timedelta < maxTimeupdateEventFrequency) 638 return; 639 640 scheduleEvent(eventNames().timeupdateEvent); 641 m_previousTimeupdateTime = now; 642 } 643 608 644 #endif -
trunk/Source/WebCore/html/MediaController.h
r123386 r125337 126 126 void clearPositionTimerFired(Timer<MediaController>*); 127 127 bool hasEnded() const; 128 void scheduleTimeupdateEvent(); 129 void timeupdateTimerFired(Timer<MediaController>*); 130 void startTimeupdateTimer(); 128 131 129 132 // EventTarget … … 153 156 PassRefPtr<Clock> m_clock; 154 157 ScriptExecutionContext* m_scriptExecutionContext; 158 Timer<MediaController> m_timeupdateTimer; 159 double m_previousTimeupdateTime; 155 160 }; 156 161
Note:
See TracChangeset
for help on using the changeset viewer.