RESOLVED FIXED 163678
[Modern Media Controls] Media Controller: playback support
https://bugs.webkit.org/show_bug.cgi?id=163678
Summary [Modern Media Controls] Media Controller: playback support
Antoine Quint
Reported 2016-10-19 11:51:16 PDT
We need media controller support for the play/pause button and when the media is played and paused via the media API.
Attachments
Patch (47.03 KB, patch)
2016-10-20 03:31 PDT, Antoine Quint
no flags
Patch for landing (51.69 KB, patch)
2016-10-26 12:42 PDT, Antoine Quint
no flags
Antoine Quint
Comment 1 2016-10-19 11:51:38 PDT
Antoine Quint
Comment 2 2016-10-20 03:31:07 PDT
Dean Jackson
Comment 3 2016-10-20 18:56:09 PDT
Comment on attachment 292164 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=292164&action=review > Source/WebCore/Modules/modern-media-controls/media/playback-support.js:54 > +class PlaybackSupport extends MediaControllerSupport > +{ > + > + // Protected > + > + get control() > + { > + return this.mediaController.controls.playPauseButton; > + } > + > + get mediaEvents() > + { > + return ["play", "pause"]; > + } > + > + buttonWasClicked(control) > + { > + const media = this.mediaController.media; > + if (media.paused) > + media.play(); > + else > + media.pause(); > + } > + > + syncControl() > + { > + this.control.playing = !this.mediaController.media.paused; > + } > + This is another example of a super simple Support class. I'm fairly worried about how confusing the end result of the approach will be. When it was in one huge file, you could at least search for the eventListener that was added to the play button.
Antoine Quint
Comment 4 2016-10-21 01:23:37 PDT
(In reply to comment #3) > Comment on attachment 292164 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=292164&action=review > > > Source/WebCore/Modules/modern-media-controls/media/playback-support.js:54 > > +class PlaybackSupport extends MediaControllerSupport > > +{ > > + > > + // Protected > > + > > + get control() > > + { > > + return this.mediaController.controls.playPauseButton; > > + } > > + > > + get mediaEvents() > > + { > > + return ["play", "pause"]; > > + } > > + > > + buttonWasClicked(control) > > + { > > + const media = this.mediaController.media; > > + if (media.paused) > > + media.play(); > > + else > > + media.pause(); > > + } > > + > > + syncControl() > > + { > > + this.control.playing = !this.mediaController.media.paused; > > + } > > + > > This is another example of a super simple Support class. I'm fairly worried > about how confusing the end result of the approach will be. When it was in > one huge file, you could at least search for the eventListener that was > added to the play button. If you're searching for `playPauseButton`, you'll easy find this code just like you would have found it in a monolithic source file. But at least here the code related to the behaviour of the play/pause button is clearly contained.
Antoine Quint
Comment 5 2016-10-26 12:42:21 PDT
Created attachment 292954 [details] Patch for landing
WebKit Commit Bot
Comment 6 2016-10-26 13:28:13 PDT
The commit-queue encountered the following flaky tests while processing attachment 292954 [details]: http/tests/security/svg-image-with-css-cross-domain.html bug 164029 (author: sabouhallawa@apple.com) The commit-queue is continuing to process your patch.
WebKit Commit Bot
Comment 7 2016-10-26 13:28:51 PDT
Comment on attachment 292954 [details] Patch for landing Clearing flags on attachment: 292954 Committed r207909: <http://trac.webkit.org/changeset/207909>
WebKit Commit Bot
Comment 8 2016-10-26 13:28:54 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.