diff --git a/CHANGELOG.md b/CHANGELOG.md index ca5adc53..e0ee3363 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,7 @@ ## Changelogs +- **[3.0.5]** + - [iOS] Handle file path better [#307](https://github.com/hyochan/react-native-audio-recorder-player/pull/307) + - **[3.0.4]** - [Android] Add optional wrappers to support android sdk 30 [#305](https://github.com/hyochan/react-native-audio-recorder-player/pull/305) diff --git a/ios/RNAudioRecorderPlayer.swift b/ios/RNAudioRecorderPlayer.swift index 808c2ff1..276cbf68 100644 --- a/ios/RNAudioRecorderPlayer.swift +++ b/ios/RNAudioRecorderPlayer.swift @@ -38,10 +38,8 @@ class RNAudioRecorderPlayer: RCTEventEmitter, AVAudioRecorderDelegate { if (path == "DEFAULT") { let cachesDirectory = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask).first! audioFileURL = cachesDirectory.appendingPathComponent("sound.m4a") - } else if (path.contains("http")){ + } else if (path.hasPrefix("http://") || path.hasPrefix("https://") || path.hasPrefix("file://")) { audioFileURL = URL(string: path) - } else if (path.contains("file")) { - audioFileURL = path } else { let cachesDirectory = FileManager.default.urls(for: .cachesDirectory, in: .userDomainMask).first! audioFileURL = cachesDirectory.appendingPathComponent(path) diff --git a/issue_template.md b/issue_template.md index 1dacb4c3..ca0f41af 100644 --- a/issue_template.md +++ b/issue_template.md @@ -1,7 +1,10 @@ -> Please use the +> Please fill the template to help you out. Also, please try the `Example` project compare before submiting the issue when you have certain issue with your project setup. ### Version of react-native-audio-recorder-player + +### Version of React Native + ### Platforms you faced the error (IOS or Android or both?) ### Expected behavior diff --git a/package.json b/package.json index a841c831..62892740 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-audio-recorder-player", - "version": "3.0.4", + "version": "3.0.5", "description": "React Native Audio Recorder and Player.", "homepage": "https://github.com/dooboolab/react-native-audio-recorder-player", "main": "index.ts",