Преглед изворни кода

chore: apply requested changes

Also moved the isArray to the bottom, just in case in some weird scenario an ArrayBuffer falls into `Array.isArray`
Agustin Mendez пре 7 година
родитељ
комит
99e6119931
1 измењених фајлова са 9 додато и 4 уклоњено
  1. 9 4
      src/Audio/babylon.sound.ts

+ 9 - 4
src/Audio/babylon.sound.ts

@@ -95,10 +95,15 @@ module BABYLON {
                 // if no parameter is passed, you need to call setAudioBuffer yourself to prepare the sound
                 // if no parameter is passed, you need to call setAudioBuffer yourself to prepare the sound
                 if (urlOrArrayBuffer) {
                 if (urlOrArrayBuffer) {
                     try {
                     try {
-                        if (typeof (urlOrArrayBuffer) === "string") this._urlType = "String";
-                        if (Array.isArray(urlOrArrayBuffer)) this._urlType = "Array";
-                        if (urlOrArrayBuffer instanceof ArrayBuffer) this._urlType = "ArrayBuffer";
-                        if (urlOrArrayBuffer instanceof MediaStream) this._urlType = "MediaStream";
+                        if (typeof (urlOrArrayBuffer) === "string") {
+                            this._urlType = "String";
+                        } else if (urlOrArrayBuffer instanceof ArrayBuffer) {
+                            this._urlType = "ArrayBuffer";
+                        } else if (urlOrArrayBuffer instanceof MediaStream) {
+                            this._urlType = "MediaStream";
+                        } else if (Array.isArray(urlOrArrayBuffer)) {
+                            this._urlType = "Array";
+                        }
 
 
                         var urls: string[] = [];
                         var urls: string[] = [];
                         var codecSupportedFound = false;
                         var codecSupportedFound = false;