Bug 45263 - Add mediaPlayerPlaybackStateChanged to MediaPlayerClient
Summary: Add mediaPlayerPlaybackStateChanged to MediaPlayerClient
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media Elements (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other OS X 10.5
: P2 Normal
Assignee: Tor Arne Vestbø (not active)
URL:
Keywords:
Depends on:
Blocks: 51249
  Show dependency treegraph
 
Reported: 2010-09-06 06:53 PDT by Tor Arne Vestbø (not active)
Modified: 2011-01-24 07:42 PST (History)
2 users (show)

See Also:


Attachments
Patch (6.51 KB, patch)
2010-09-06 06:54 PDT, Tor Arne Vestbø (not active)
eric.carlson: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tor Arne Vestbø (not active) 2010-09-06 06:53:00 PDT
Add mediaPlayerPlaybackStateChanged to MediaPlayerClient
Comment 1 Tor Arne Vestbø (not active) 2010-09-06 06:54:28 PDT
Created attachment 66635 [details]
Patch
Comment 2 Tor Arne Vestbø (not active) 2010-09-06 07:01:25 PDT
(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 3 Eric Carlson 2010-09-07 08:21:50 PDT
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
Comment 4 Tor Arne Vestbø (not active) 2010-09-08 02:22:27 PDT
Landed in http://trac.webkit.org/changeset/66961
Comment 5 Ademar Reis 2011-01-24 07:42:16 PST
Revision r66961 cherry-picked into qtwebkit-2.2 with commit b9014dd <http://gitorious.org/webkit/qtwebkit/commit/b9014dd>