You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by er...@apache.org on 2022/08/30 05:33:45 UTC
[cordova-plugin-media] branch master updated: (iOS): support file scheme in iOS (#352)
This is an automated email from the ASF dual-hosted git repository.
erisu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-plugin-media.git
The following commit(s) were added to refs/heads/master by this push:
new 31785c7 (iOS): support file scheme in iOS (#352)
31785c7 is described below
commit 31785c72fc64ab4cfc4891d52c74680ee561fa50
Author: knaito-asial <81...@users.noreply.github.com>
AuthorDate: Tue Aug 30 14:33:38 2022 +0900
(iOS): support file scheme in iOS (#352)
---
src/ios/CDVSound.m | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/ios/CDVSound.m b/src/ios/CDVSound.m
index 4ca8b60..5c40590 100644
--- a/src/ios/CDVSound.m
+++ b/src/ios/CDVSound.m
@@ -24,6 +24,7 @@
#define HTTP_SCHEME_PREFIX @"http://"
#define HTTPS_SCHEME_PREFIX @"https://"
#define CDVFILE_PREFIX @"cdvfile://"
+#define FILE_PREFIX @"file://"
@implementation CDVSound
@@ -70,6 +71,9 @@ BOOL keepAvAudioSessionAlwaysActive = NO;
resourceURL = [NSURL URLWithString:resourcePath];
}
} else {
+ if ([resourcePath hasPrefix:FILE_PREFIX]) { // Support file scheme
+ resourcePath = [resourcePath substringFromIndex:[FILE_PREFIX length]];
+ }
// if resourcePath is not from FileSystem put in tmp dir, else attempt to use provided resource path
NSString* tmpPath = [NSTemporaryDirectory()stringByStandardizingPath];
BOOL isTmp = [resourcePath rangeOfString:tmpPath].location != NSNotFound;
@@ -114,6 +118,9 @@ BOOL keepAvAudioSessionAlwaysActive = NO;
resourceURL = [NSURL URLWithString:resourcePath];
}
} else {
+ if ([resourcePath hasPrefix:FILE_PREFIX]) { // Support file scheme
+ resourcePath = [resourcePath substringFromIndex:[FILE_PREFIX length]];
+ }
// attempt to find file path in www directory or LocalFileSystem.TEMPORARY directory
filePath = [self.commandDelegate pathForResource:resourcePath];
if (filePath == nil) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org