You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2016/01/30 00:48:10 UTC

[08/13] cordova-plugin-media git commit: add rate support to avPlayer implementation on ios

add rate support to avPlayer implementation on ios


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/4dcdb829
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/tree/4dcdb829
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/diff/4dcdb829

Branch: refs/heads/master
Commit: 4dcdb829276b231566109c023a272994aa6b514e
Parents: 023b2a0
Author: Gaven Henry <gh...@gmail.com>
Authored: Thu Jan 21 14:20:14 2016 +0800
Committer: Gaven Henry <gh...@gmail.com>
Committed: Thu Jan 21 14:20:14 2016 +0800

----------------------------------------------------------------------
 src/ios/CDVSound.m | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/blob/4dcdb829/src/ios/CDVSound.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVSound.m b/src/ios/CDVSound.m
index d32fed0..0727efc 100644
--- a/src/ios/CDVSound.m
+++ b/src/ios/CDVSound.m
@@ -340,8 +340,16 @@
                 if (avPlayer.currentItem && avPlayer.currentItem.asset) {
                     CMTime time = avPlayer.currentItem.asset.duration;
                     position = CMTimeGetSeconds(time);
-                    NSLog(@"Playing stream with AVPlayer");
-                    [avPlayer play];
+
+                    if (audioFile.rate != nil){
+                        float customRate = [audioFile.rate floatValue];
+                        NSLog(@"Playing stream with AVPlayer & custom rate");
+                        [avPlayer setRate:customRate];
+                    } else {
+                        NSLog(@"Playing stream with AVPlayer & custom rate");
+                        [avPlayer play];
+                    }
+
                 } else {
 
                     NSNumber* loopOption = [options objectForKey:@"numberOfLoops"];


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org