I’ve been bashing my head against the wall over the last day trying to figure out why cordova-plugin-mediadoes not play back any sound on ** iOS 9.2 (iPhone 6 + 6s).
After debugging cordova-plugin-media/src/ios/CDVSound.m on ln 352, 355, looks like the avPlayer object doesn’t have a handle to the sound resource:
The dev that added the breaking change for Streaming suggested using file:// or cdvfile:// (which I obviously tried last month before providing the hack).
The were other devs contributing to the main Jira ticket, but it appears to be stalled at the moment. You’re welcome to join in and help out.
Apologies for the late response, been preoccupied with other activities.
I was actually more happy to get the sound file to play and didn’t hook the other methods in like getCurrentPosition
The dev that put the original streaming code in insist everything still works (streaming, local, record) - obviously doesn’t, hence the hack.
Might pick this up again (on the weekend) as the Jira ticket has kinda stalled a bit and there’s a lot of noise about it working without clear examples of implementation.
Hi johnnydong,
Thank you for the answer, unfortunately i’m not an ios developer and i don’t know swift. But, is possibile insert an “if” in the code, that check if file are streaming(src start with http:\ or https:\) or local file(src start with ) and use two different player?
It’s just my idea, i don’t know if could be right.
Just spent 2+ days scratching my head over this one. Thanks for posting a workaround.
The fact that the cordova plugin site doesnt mention this showstopping bug in any way is really frustrating. Anyone who is coming to the site now is going to be building for iOS 9.2 or 9.3 and they’ll be completely unaware until they spend hours searching for why their device and/or seems broken.
I reported 4 months ago cordova-plugin-media bug when playing on Android on cordova bug list, and never got a reply. I had to create a complex workaround to make it.
@johnnydong the jira issue status is ‘resolved’ and there’s a new release v2.3.0 on github but it hasnt been pushed to npm yet (latest npm version is 2.2.0).
i was able to install the latest stable version of the plugin using
My build works on Android but not iOS. I see this in my Xcode logs. Do you guys have any advice?
2016-07-13 18:07:38.670370 SpotShuffle[819:101801] [] <<<< FIGSANDBOX >>>> Path </private/var/mobile/Containers/Data/Application/CA12E3E3-BB41-45D7-8F4E-DE52BEFDFA4E/tmp/MediaCache> could not be converted by realpath() (requires all elements of path are present)
2016-07-13 18:07:38.671385 SpotShuffle[819:101801] [] __InternalSandboxRegisterURL_block_invoke signalled err=-12780 (kFigBaseObjectError_ParamErr) (Could not obtain realpath for specified URL) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/EmbeddedCoreMediaFramework/EmbeddedCoreMedia-1847.11.1/Prototypes/Player/ClientServer/FigSandboxSupport.c line 590
var audio_url = "file:///var/mobile/Containers/Data/Application/B932CD99-B274-4D5D-A9C2-032F77A1DDF4/Documents/hello.mp3";
var m = new Media(audio_url);
m.play();
Hi @jkcybertron (and any developer who’s come across this post),
It’s been months since I looked at this post and it appears there are still some developers experiencing the same issue I had back in March.
We’ve skipped multiple versions of iOS (iOS9.2 to 10.1), and cordova-plugin-media (2.2.0 to 2.4.0) so I thought i’d give the newer modules a try and it appears to be fixed!!!
Instead of providing small snippets of code as an answer, I’ve hacked together a test app (minus unit test ) for you guys to try out. Only tested for iOS (not sure what’s going to happen with Android…)
(Still written in Angular 1.0, but you should get the gist of what’s happening - when i get more time, i’ll convert it to Angular 2.0).