Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70612

iOS 9.2 cordova-plugin-media no sound [fix on the way]

$
0
0

@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-10723

However 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, 355

From:

 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

Read full topic


Viewing all articles
Browse latest Browse all 70612

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>