Repository: cordova-plugin-media Updated Branches: refs/heads/master 46c9542de -> e5b663ac9
iOS audio should handle naked local file sources A local file lacking the file:// or cdvfile:// prefix is not played because resourceURL isn't validated to later on in the play chain. avPlayer is initialized during create(), but won't initialize without the validated resourceURL.. This closes #85 Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/commit/e5b663ac Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/tree/e5b663ac Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/diff/e5b663ac Branch: refs/heads/master Commit: e5b663ac951b2d8cb2e5e470d2c7072aa56cf779 Parents: 46c9542 Author: Gaelen Hadlett <gael...@gmail.com> Authored: Wed Mar 2 20:26:32 2016 -0500 Committer: Omar Mefire <omef...@gmail.com> Committed: Fri Mar 25 09:11:59 2016 -0700 ---------------------------------------------------------------------- src/ios/CDVSound.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/blob/e5b663ac/src/ios/CDVSound.m ---------------------------------------------------------------------- diff --git a/src/ios/CDVSound.m b/src/ios/CDVSound.m index b12c0fb..640ebcd 100644 --- a/src/ios/CDVSound.m +++ b/src/ios/CDVSound.m @@ -216,14 +216,14 @@ NSString* mediaId = [command argumentAtIndex:0]; NSString* resourcePath = [command argumentAtIndex:1]; - CDVAudioFile* audioFile = [self audioFileForResource:resourcePath withId:mediaId doValidation:NO forRecording:NO]; + CDVAudioFile* audioFile = [self audioFileForResource:resourcePath withId:mediaId doValidation:YES forRecording:NO]; if (audioFile == nil) { NSString* errorMessage = [NSString stringWithFormat:@"Failed to initialize Media file with path %@", resourcePath]; NSString* jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('cordova-plugin-media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_ABORTED message:errorMessage]]; [self.commandDelegate evalJs:jsString]; } else { - NSURL* resourceUrl = [[NSURL alloc] initWithString:resourcePath]; + NSURL* resourceUrl = audioFile.resourceURL; if (![resourceUrl isFileURL] && ![resourcePath hasPrefix:CDVFILE_PREFIX]) { // First create an AVPlayerItem @@ -849,4 +849,4 @@ @implementation CDVAudioRecorder @synthesize mediaId; -@end \ No newline at end of file +@end --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@cordova.apache.org For additional commands, e-mail: commits-h...@cordova.apache.org