mirror of
https://github.com/koel/koel
synced 2024-11-10 06:34:14 +00:00
Playback now initializes only once
This commit is contained in:
parent
f51740fe3a
commit
eeeb03b313
1 changed files with 8 additions and 0 deletions
|
@ -14,6 +14,7 @@ export default {
|
||||||
player: null,
|
player: null,
|
||||||
$volumeInput: null,
|
$volumeInput: null,
|
||||||
repeatModes: ['NO_REPEAT', 'REPEAT_ALL', 'REPEAT_ONE'],
|
repeatModes: ['NO_REPEAT', 'REPEAT_ALL', 'REPEAT_ONE'],
|
||||||
|
initialized: false,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the playback service for this whole Koel app.
|
* Initialize the playback service for this whole Koel app.
|
||||||
|
@ -21,6 +22,11 @@ export default {
|
||||||
* @param object app The root Vue component.
|
* @param object app The root Vue component.
|
||||||
*/
|
*/
|
||||||
init(app) {
|
init(app) {
|
||||||
|
// We don't need to init this service twice, or the media events will be duplicated.
|
||||||
|
if (this.initialized) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.app = app;
|
this.app = app;
|
||||||
|
|
||||||
plyr.setup({
|
plyr.setup({
|
||||||
|
@ -65,6 +71,8 @@ export default {
|
||||||
|
|
||||||
// On init, set the volume to the value found in the local storage.
|
// On init, set the volume to the value found in the local storage.
|
||||||
this.setVolume(preferenceStore.get('volume'));
|
this.setVolume(preferenceStore.get('volume'));
|
||||||
|
|
||||||
|
this.initialized = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue