set loop one to loop all if single music

This commit is contained in:
DIYgod 2018-03-08 22:46:05 +08:00
parent dedc1bf62d
commit f4ffe98bf6
No known key found for this signature in database
GPG Key ID: EC0B76A252D3EF67
2 changed files with 7 additions and 3 deletions

View File

@ -141,13 +141,13 @@ class Controller {
}
}
else {
if (this.player.options.loop === 'one') {
if (this.player.options.loop === 'one' || this.player.options.loop === 'all') {
this.player.options.loop = 'none';
this.player.template.loop.innerHTML = Icons.loopNone;
}
else if (this.player.options.loop === 'none') {
this.player.options.loop = 'one';
this.player.template.loop.innerHTML = Icons.loopOne;
this.player.options.loop = 'all';
this.player.template.loop.innerHTML = Icons.loopAll;
}
}
});

View File

@ -21,5 +21,9 @@ export default (options) => {
options.music = [options.music];
}
if (options.music.length <= 1 && options.loop === 'one') {
options.loop = 'all';
}
return options;
};