mirror of
https://github.com/yuukiwww/taiko-web.git
synced 2024-10-22 17:05:49 +02:00
Fix song previews
This commit is contained in:
parent
47f346eadb
commit
1c92f3b344
@ -3,7 +3,7 @@ function SongSelect(){
|
||||
var _songs;
|
||||
var _selectedSong = {title:'', folder:'', difficulty:''};
|
||||
var _preview;
|
||||
var _preview_ended
|
||||
var _preview_id = 0
|
||||
var _diffNames={
|
||||
easy:"かんたん",
|
||||
normal:"ふつう",
|
||||
@ -14,7 +14,7 @@ function SongSelect(){
|
||||
this.startPreview = function(id, prvtime, first_open=true) {
|
||||
_this.endPreview();
|
||||
var startLoad = +new Date
|
||||
_preview_ended = false
|
||||
var current_id = _preview_id
|
||||
if(first_open){
|
||||
snd.musicGain.fadeOut(0.4)
|
||||
}
|
||||
@ -30,7 +30,7 @@ function SongSelect(){
|
||||
this.previewLoaded(startLoad, prvtime, first_open)
|
||||
}else{
|
||||
snd.previewGain.load("/songs/" + id + "/main.mp3").then(sound => {
|
||||
if(!_preview_ended){
|
||||
if(current_id == _preview_id){
|
||||
songObj.sound = sound
|
||||
_preview = sound
|
||||
this.previewLoaded(startLoad, prvtime, first_open)
|
||||
@ -48,7 +48,7 @@ function SongSelect(){
|
||||
}
|
||||
|
||||
this.endPreview = function() {
|
||||
_preview_ended = true
|
||||
_preview_id++
|
||||
if (_preview) {
|
||||
_preview.stop();
|
||||
};
|
||||
|
@ -124,7 +124,9 @@ class Sound{
|
||||
playLoop(time, absolute, seek1, seek2, until){
|
||||
time = this.convertTime(time, absolute)
|
||||
seek1 = seek1 || 0
|
||||
seek2 = seek2 || 0
|
||||
if(typeof seek2 == "undefined"){
|
||||
seek2 = seek1
|
||||
}
|
||||
until = until || this.duration
|
||||
this.loop = {
|
||||
started: time + until - seek1,
|
||||
|
Loading…
Reference in New Issue
Block a user