@johnnydong wrote:
Greeting IonicFramework Developers,
I've been bashing my head against the wall over the last day trying to figure out why cordova-plugin-media does 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:
I've raised a Jira ticket to Apache Cordova to get this fixed:
https://issues.apache.org/jira/browse/CB-10723However if you need sound ASAP in your apps, just make this small change to the following files and rebuild your app:
[root]/plugins/cordova-plugin-media/src/ios/CDVSound.m, ln 352, 355
[root]/platforms/ios/Sleepy/Plugins/cordova-plugin-media/CDVSound.m, ln 352, 355From:
if (audioFile.rate != nil){ float customRate = [audioFile.rate floatValue]; NSLog(@"Playing stream with AVPlayer & custom rate"); [avPlayersetRate:customRate]; } else { NSLog(@"Playing stream with AVPlayer & custom rate"); [avPlayer play]; }
To:
if (audioFile.rate != nil){ float customRate = [audioFile.rate floatValue]; NSLog(@"Playing stream with AVPlayer & custom rate"); [audioFile.player setRate:customRate]; } else { NSLog(@"Playing stream with AVPlayer & custom rate"); [audioFile.player play]; }
Hope this helps anyone out there struggling with sound.
Regards,
JD
Posts: 1
Participants: 1