mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-25 11:04:00 +00:00
Add back playing media listener, refactor
This commit is contained in:
parent
e588b76203
commit
dc81083ed3
1 changed files with 5 additions and 4 deletions
|
|
@ -16,11 +16,7 @@ module.exports = {
|
|||
this.dispatch({type: 'SET_BALANCE', balance: options.balance});
|
||||
this.loadFromUrl(options.mediaFile.url, options.mediaFile.name);
|
||||
this.dispatch(setSkinFromUrl(options.skinUrl));
|
||||
this._registerListeners();
|
||||
return this;
|
||||
},
|
||||
|
||||
_registerListeners: function() {
|
||||
this.media.addEventListener('timeupdate', () => {
|
||||
this.dispatch({type: 'UPDATE_TIME_ELAPSED', elapsed: this.media.timeElapsed()});
|
||||
});
|
||||
|
|
@ -29,6 +25,10 @@ module.exports = {
|
|||
this.dispatch({type: 'SET_MEDIA_STATUS', status: 'STOPPED'});
|
||||
});
|
||||
|
||||
this.media.addEventListener('playing', () => {
|
||||
this.dispatch({type: 'SET_MEDIA_STATUS', status: 'PLAYING'});
|
||||
});
|
||||
|
||||
this.media.addEventListener('waiting', () => {
|
||||
this.dispatch({type: 'START_WORKING'});
|
||||
});
|
||||
|
|
@ -40,6 +40,7 @@ module.exports = {
|
|||
this.fileInput.onchange = (e) => {
|
||||
this.loadFromFileReference(e.target.files[0]);
|
||||
};
|
||||
return this;
|
||||
},
|
||||
|
||||
/* Functions */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue