Summary: | Add mediaPlayerPlaybackStateChanged to MediaPlayerClient | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Tor Arne Vestbø <vestbo> | ||||
Component: | Media | Assignee: | Tor Arne Vestbø <vestbo> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Normal | CC: | ademar, eric.carlson | ||||
Priority: | P2 | ||||||
Version: | 528+ (Nightly build) | ||||||
Hardware: | Other | ||||||
OS: | OS X 10.5 | ||||||
Bug Depends on: | |||||||
Bug Blocks: | 51249 | ||||||
Attachments: |
|
Description
Tor Arne Vestbø
2010-09-06 06:53:00 PDT
Created attachment 66635 [details]
Patch
(In reply to comment #1) > Created an attachment (id=66635) [details] > Patch Tried to keep the logic of updatePlayState() in the refactor, but wondering about if (playerPaused && couldPlayIfEnoughData()), should this check be moved out of the play/not-playing block? Or perhaps be done like this? if (!playerPaused) m_player->pause(); if (couldPlayIfEnoughData()) m_player->prepareToPlay(); Comment on attachment 66635 [details] Patch > + updatePlayState() is then refactored to take into account the > + situation where the backend is already in the correct state but > + WebCore is not, so that we update thee playback progress timer Typo - "thee" > > +void HTMLMediaElement::mediaPlayerPlaybackStateChanged(MediaPlayer*) > +{ > + beginProcessingMediaPlayerCallback(); > + if (m_player) { > + if (m_player->paused()) > + pauseInternal(); > + else > + playInternal(); > + } > + endProcessingMediaPlayerCallback(); > +} > + Might as well return early if m_player is NULL. > + // Set rate before calling play in case the rate was set before the media engine wasn't setup. Old typo you might as well fix, "wasn't" should be "was". > Tried to keep the logic of updatePlayState() in the refactor, but wondering about if (playerPaused && > couldPlayIfEnoughData()), should this check be moved out of the play/not-playing block? Or perhaps be > done like this? > > if (!playerPaused) > m_player->pause(); > > if (couldPlayIfEnoughData()) > m_player->prepareToPlay(); Good idea, this seems much clearer. Thanks! r=me Landed in http://trac.webkit.org/changeset/66961 Revision r66961 cherry-picked into qtwebkit-2.2 with commit b9014dd <http://gitorious.org/webkit/qtwebkit/commit/b9014dd> |