diff --git a/index.html b/index.html index 898f3dc6..1e8ffe8f 100644 --- a/index.html +++ b/index.html @@ -892,8 +892,8 @@ > lens stop - - + + diff --git a/js/animations/animation.js b/js/animations/animation.js index 25af2a45..a9f7b984 100644 --- a/js/animations/animation.js +++ b/js/animations/animation.js @@ -970,20 +970,20 @@ class EffectAnimator extends GeneralAnimator { this.sound.forEach(kf => { var diff = kf.time - Timeline.time; if (diff >= 0 && diff < (1/60) * (Timeline.playback_speed/100)) { - if (kf.file && !kf.cooldown) { - var media = new Audio(kf.file); - window._media = media - media.volume = Math.clamp(settings.volume.value/100, 0, 1); - media.play(); - Timeline.playing_sounds.push(media); - media.onended = function() { - Timeline.playing_sounds.remove(media); - } + if (kf.data_points[0]?.file && !kf.cooldown) { + var media = new Audio(kf.data_points[0]?.file); + window._media = media + media.volume = Math.clamp(settings.volume.value/100, 0, 1); + media.play().catch(() => {}); + Timeline.playing_sounds.push(media); + media.onended = function() { + Timeline.playing_sounds.remove(media); + } - kf.cooldown = true; - setTimeout(() => { - delete kf.cooldown; - }, 400) + kf.cooldown = true; + setTimeout(() => { + delete kf.cooldown; + }, 400) } } }) @@ -992,14 +992,14 @@ class EffectAnimator extends GeneralAnimator { startPreviousSounds() { if (!this.muted.sound) { this.sound.forEach(kf => { - if (kf.file && !kf.cooldown) { + if (kf.data_points[0]?.file && !kf.cooldown) { var diff = kf.time - Timeline.time; - if (diff < 0 && Timeline.waveforms[kf.file] && Timeline.waveforms[kf.file].duration > -diff) { - var media = new Audio(kf.file); + if (diff < 0 && Timeline.waveforms[kf.data_points[0]?.file] && Timeline.waveforms[kf.data_points[0]?.file].duration > -diff) { + var media = new Audio(kf.data_points[0]?.file); window._media = media media.volume = Math.clamp(settings.volume.value/100, 0, 1); media.currentTime = -diff; - media.play(); + media.play().catch(() => {}); Timeline.playing_sounds.push(media); media.onended = function() { Timeline.playing_sounds.remove(media); diff --git a/js/animations/keyframe.js b/js/animations/keyframe.js index 7da6a24c..73b8a981 100644 --- a/js/animations/keyframe.js +++ b/js/animations/keyframe.js @@ -671,7 +671,7 @@ BARS.defineActions(function() { resource_id: 'animation_audio', extensions: ['ogg'], type: 'Audio File', - startpath: Timeline.selected[0].file + startpath: Timeline.selected[0].data_points[0]?.file }, function(files) { // Todo: move to panel