Merge pull request #597 from psy/feature_streams
add remote files and streams to playAudio
This commit is contained in:
commit
d32fca9777
@ -600,8 +600,18 @@ export class GameScene extends ResizableScene implements CenterListener {
|
|||||||
if (url === undefined) {
|
if (url === undefined) {
|
||||||
audioManager.unloadAudio();
|
audioManager.unloadAudio();
|
||||||
} else {
|
} else {
|
||||||
const mapDirUrl = this.MapUrlFile.substr(0, this.MapUrlFile.lastIndexOf('/'));
|
const audioPath = url as string;
|
||||||
const realAudioPath = mapDirUrl + '/' + url;
|
let realAudioPath = '';
|
||||||
|
|
||||||
|
if (audioPath.indexOf('://') > 0) {
|
||||||
|
// remote file or stream
|
||||||
|
realAudioPath = audioPath;
|
||||||
|
} else {
|
||||||
|
// local file, include it relative to map directory
|
||||||
|
const mapDirUrl = this.MapUrlFile.substr(0, this.MapUrlFile.lastIndexOf('/'));
|
||||||
|
realAudioPath = mapDirUrl + '/' + url;
|
||||||
|
}
|
||||||
|
|
||||||
audioManager.loadAudio(realAudioPath);
|
audioManager.loadAudio(realAudioPath);
|
||||||
|
|
||||||
if (loop) {
|
if (loop) {
|
||||||
|
Loading…
Reference in New Issue
Block a user