add remote files and streams to playAudio

This commit is contained in:
psy 2021-01-14 11:45:14 +01:00
parent 842eadeb59
commit f431e769cc
1 changed files with 11 additions and 1 deletions

View File

@ -599,7 +599,17 @@ export class GameScene extends ResizableScene implements CenterListener {
audioManager.unloadAudio();
} else {
const mapDirUrl = this.MapUrlFile.substr(0, this.MapUrlFile.lastIndexOf('/'));
const realAudioPath = mapDirUrl + '/' + url;
const audioPath = url as string;
let realAudioPath = '';
if (audioPath.indexOf('://') > 0) {
// remote file or stream
realAudioPath = audioPath;
} else {
// local file, include it relative to map directory
realAudioPath = mapDirUrl + '/' + url;
}
audioManager.loadAudio(realAudioPath);
if (loop) {