mirror of
https://github.com/captbaritone/webamp.git
synced 2026-07-29 04:50:14 +00:00
Consolidate setting media info
This commit is contained in:
parent
cf398cb8fe
commit
d932bb38f6
2 changed files with 17 additions and 17 deletions
|
|
@ -108,20 +108,19 @@ const media = (state, action) => {
|
|||
return {...state, timeMode: newMode};
|
||||
case 'UPDATE_TIME_ELAPSED':
|
||||
return {...state, timeElapsed: action.elapsed};
|
||||
case 'SET_MEDIA_LENGTH':
|
||||
return {...state, length: action.length};
|
||||
case 'SET_MEDIA_KBPS':
|
||||
return {...state, kbps: action.kbps};
|
||||
case 'SET_MEDIA_KHZ':
|
||||
return {...state, khz: action.khz};
|
||||
case 'SET_MEDIA':
|
||||
return {
|
||||
...state,
|
||||
length: action.length,
|
||||
kbps: action.kbps,
|
||||
khz: action.khz,
|
||||
channels: action.channels,
|
||||
name: action.name
|
||||
};
|
||||
case 'SET_VOLUME':
|
||||
return {...state, volume: action.volume};
|
||||
case 'SET_BALANCE':
|
||||
return {...state, balance: action.balance};
|
||||
case 'SET_MEDIA_NAME':
|
||||
return {...state, name: action.name};
|
||||
case 'SET_CHANNELS_COUNT':
|
||||
return {...state, channels: action.channels};
|
||||
case 'TOGGLE_REPEAT':
|
||||
return {...state, repeat: !state.repeat};
|
||||
case 'TOGGLE_SHUFFLE':
|
||||
|
|
|
|||
15
js/winamp.js
15
js/winamp.js
|
|
@ -83,13 +83,14 @@ module.exports = {
|
|||
/* Listeners */
|
||||
_loadBuffer: function(buffer) {
|
||||
function setMetaData() {
|
||||
const kbps = '128';
|
||||
const khz = Math.round(this.media.sampleRate() / 1000).toString();
|
||||
this.dispatch({type: 'SET_MEDIA_KBPS', kbps: kbps});
|
||||
this.dispatch({type: 'SET_MEDIA_KHZ', khz: khz});
|
||||
this.dispatch({type: 'SET_CHANNELS_COUNT', channels: this.media.channels()});
|
||||
this.dispatch({type: 'SET_MEDIA_NAME', name: this.fileName});
|
||||
this.dispatch({type: 'SET_MEDIA_LENGTH', length: this.media.duration()});
|
||||
this.dispatch({
|
||||
type: 'SET_MEDIA',
|
||||
kbps: '128',
|
||||
khz: Math.round(this.media.sampleRate() / 1000).toString(),
|
||||
channels: this.media.channels(),
|
||||
name: this.fileName,
|
||||
length: this.media.duration()
|
||||
});
|
||||
}
|
||||
|
||||
// Note, this will not happen right away
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue