front: external audio file support

This commit is contained in:
Ludwig Behm 2021-01-16 22:26:17 +01:00
parent db6809fe00
commit 287934f7c4

View file

@ -620,9 +620,14 @@ export class GameScene extends ResizableScene implements CenterListener {
if (url === undefined) {
audioManager.unloadAudio();
} else {
const mapDirUrl = this.MapUrlFile.substr(0, this.MapUrlFile.lastIndexOf('/'));
const realAudioPath = mapDirUrl + '/' + url;
audioManager.loadAudio(realAudioPath);
// keep external url untouched
if (typeof url === 'string' && url.match(/^https?:\/\//)) {
audioManager.loadAudio(url);
} else {
const mapDirUrl = this.MapUrlFile.substr(0, this.MapUrlFile.lastIndexOf('/'));
const realAudioPath = mapDirUrl + '/' + url;
audioManager.loadAudio(realAudioPath);
}
if (loop) {
audioManager.loop();