Simplify play/pause handling (#410)

I found it awkward to listen to the video tags 'playing' and 'paused'
events, when we're controlling the state that defines what state it's
in in the first place.

This commit removes those listeners, in favor of just setting things to
the right state immediately when play(), pause(), or playPause() is
called.

Added play(), pause() methods for clarity.
This commit is contained in:
Feross Aboukhadijeh
2016-04-14 16:16:54 -07:00
parent f93685811a
commit 432d7d4a56
3 changed files with 58 additions and 40 deletions

View File

@@ -78,8 +78,6 @@ function renderMedia (state) {
ondblclick=${dispatcher('toggleFullScreen')}
onloadedmetadata=${onLoadedMetadata}
onended=${onEnded}
onplay=${dispatcher('mediaPlaying')}
onpause=${dispatcher('mediaPaused')}
onstalling=${dispatcher('mediaStalled')}
onerror=${dispatcher('mediaError')}
ontimeupdate=${dispatcher('mediaTimeUpdate')}