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:06 UTC
[04/13] cordova-plugin-media git commit: Implement stop() for
avplayer for compliance
Implement stop() for avplayer for compliance
stop will now behave the same when avplayer is used to play from a
stream as when avaudioplayer is used to play from a local file.
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/6f3727c6
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/tree/6f3727c6
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/diff/6f3727c6
Branch: refs/heads/master
Commit: 6f3727c63d753cfdff15962c5f2132bac4bc47ac
Parents: 31d5362
Author: ghenry22 <gh...@gmail.com>
Authored: Tue Oct 13 08:59:57 2015 +0800
Committer: ghenry22 <gh...@gmail.com>
Committed: Tue Oct 13 08:59:57 2015 +0800
----------------------------------------------------------------------
src/ios/CDVSound.m | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/blob/6f3727c6/src/ios/CDVSound.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVSound.m b/src/ios/CDVSound.m
index 50b15ee..80f90da 100644
--- a/src/ios/CDVSound.m
+++ b/src/ios/CDVSound.m
@@ -458,7 +458,17 @@
[audioFile.player stop];
audioFile.player.currentTime = 0;
jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%d);", @"cordova.require('cordova-plugin-media.Media').onStatus", mediaId, MEDIA_STATE, MEDIA_STOPPED];
- } // ignore if no media playing
+ }
+ 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)];
+ jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%d);", @"cordova.require('cordova-plugin-media.Media').onStatus", mediaId, MEDIA_STATE, MEDIA_STOPPED];
+ }
+ // ignore if no media playing
if (jsString) {
[self.commandDelegate evalJs:jsString];
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org