Media API, Media API.
- :
API PLUGIN
CDVSound.m
CDVSound.m
- (void)resumeRecordingAudio:(CDVInvokedUrlCommand*)command
{
NSString* mediaId = [command.arguments objectAtIndex:0];
CDVAudioFile* audioFile = [[self soundCache] objectForKey:mediaId];
NSString* jsString = nil;
if ((audioFile != nil) && (audioFile.recorder != nil)) {
NSLog(@"Resumed recording audio sample '%@'", audioFile.resourcePath);
[audioFile.recorder record];
}
if (jsString) {
[self.commandDelegate evalJs:jsString];
}
}
- (void)pauseRecordingAudio:(CDVInvokedUrlCommand*)command
{
NSString* mediaId = [command.arguments objectAtIndex:0];
CDVAudioFile* audioFile = [[self soundCache] objectForKey:mediaId];
NSString* jsString = nil;
if ((audioFile != nil) && (audioFile.recorder != nil)) {
NSLog(@"Paused recording audio sample '%@'", audioFile.resourcePath);
[audioFile.recorder pause];
}
if (jsString) {
[self.commandDelegate evalJs:jsString];
}
}
JAVASCRIPT API PLUGIN
Media.js www org.apache.cordova.media.
, Media.prototype.startRecord.
Media.prototype.pauseRecord = function() {
exec(null, this.errorCallback, "Media", "pauseRecordingAudio", [this.id]);
};
Media.prototype.resumeRecord = function() {
exec(null, this.errorCallback, "Media", "resumeRecordingAudio", [this.id]);
};
, nameOfRecorder.pauseRecord(); nameOfRecorder.resumeRecord(); .
PS: Cordova 3.3 XCode 5.0.2
, .