cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [06/13] cordova-plugin-media git commit: completion handler for stop();
Date Fri, 29 Jan 2016 23:48:08 GMT
completion handler for stop();

seekto 0 then stop playing.


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

Branch: refs/heads/master
Commit: 45afc8a4f82fe781a088f9268856b59afcc61886
Parents: 4e76ca0
Author: ghenry22 <ghenry22@gmail.com>
Authored: Tue Oct 13 09:16:29 2015 +0800
Committer: ghenry22 <ghenry22@gmail.com>
Committed: Tue Oct 13 09:16:29 2015 +0800

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


http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/blob/45afc8a4/src/ios/CDVSound.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVSound.m b/src/ios/CDVSound.m
index 80f90da..ccf9984 100644
--- a/src/ios/CDVSound.m
+++ b/src/ios/CDVSound.m
@@ -461,11 +461,12 @@
     }
     if (avPlayer.currentItem && avPlayer.currentItem.asset) {
         NSLog(@"Stopped playing audio sample '%@'", audioFile.resourcePath);
-        [avPlayer pause];
         [avPlayer seekToTime: kCMTimeZero
                      toleranceBefore: kCMTimeZero
                       toleranceAfter: kCMTimeZero
-                   completionHandler: ^(BOOL finished)];
+                   completionHandler: ^(BOOL finished){
+                           if (finished) [avPlayer pause];
+                       }];
         jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%d);", @"cordova.require('cordova-plugin-media.Media').onStatus",
mediaId, MEDIA_STATE, MEDIA_STOPPED];
     }
     // ignore if no media playing


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


Mime
View raw message