From be4e31e9f330962ca01088bb49e5df92c2b737b9 Mon Sep 17 00:00:00 2001 From: Daisuke Inoue Date: Wed, 18 May 2016 12:17:32 +0900 Subject: [PATCH] Recognize a external file and a bundled file on Android. --- sound.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sound.js b/sound.js index 09993a05..41317682 100644 --- a/sound.js +++ b/sound.js @@ -5,10 +5,14 @@ var IsAndroid = RNSound.IsAndroid; var nextKey = 0; +function isRelativePath(path) { + return !/^\//.test(path); +} + function Sound(filename, basePath, onError) { this._filename = basePath ? basePath + '/' + filename : filename; - if (IsAndroid && !basePath) { + if (IsAndroid && !basePath && isRelativePath(filename)) { this._filename = filename.toLowerCase().replace(/\.[^.]+$/, ''); }