Loading src/android/AudioPlayer.java +15 −15 Changes for src/android/AudioPlayer.java: 15 added lines, 15 removed lines. Original line number Diff line number Diff line Loading @@ -133,7 +133,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On switch (this.mode) { case PLAY: Log.d(LOG_TAG, "AudioPlayer Error: Can't record in play mode."); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('" + this.id + "', "+MEDIA_ERROR+", { \"code\":"+MEDIA_ERR_ABORTED+"});"); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.media.Media').onStatus('" + this.id + "', "+MEDIA_ERROR+", { \"code\":"+MEDIA_ERR_ABORTED+"});"); break; case NONE: this.audioFile = file; Loading @@ -152,11 +152,11 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On e.printStackTrace(); } this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('" + this.id + "', "+MEDIA_ERROR+", { \"code\":"+MEDIA_ERR_ABORTED+"});"); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.media.Media').onStatus('" + this.id + "', "+MEDIA_ERROR+", { \"code\":"+MEDIA_ERR_ABORTED+"});"); break; case RECORD: Log.d(LOG_TAG, "AudioPlayer Error: Already recording."); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('" + this.id + "', "+MEDIA_ERROR+", { \"code\":"+MEDIA_ERR_ABORTED+"});"); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.media.Media').onStatus('" + this.id + "', "+MEDIA_ERROR+", { \"code\":"+MEDIA_ERR_ABORTED+"});"); } } Loading Loading @@ -227,7 +227,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On if (this.readyPlayer(this.audioFile)) { this.player.seekTo(milliseconds); Log.d(LOG_TAG, "Send a onStatus update for the new seek"); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('" + this.id + "', " + MEDIA_POSITION + ", " + milliseconds / 1000.0f + ");"); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.media.Media').onStatus('" + this.id + "', " + MEDIA_POSITION + ", " + milliseconds / 1000.0f + ");"); } else { this.seekOnPrepared = milliseconds; Loading @@ -246,7 +246,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On } else { Log.d(LOG_TAG, "AudioPlayer Error: pausePlaying() called during invalid state: " + this.state.ordinal()); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('" + this.id + "', " + MEDIA_ERROR + ", { \"code\":" + MEDIA_ERR_NONE_ACTIVE + "});"); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.media.Media').onStatus('" + this.id + "', " + MEDIA_ERROR + ", { \"code\":" + MEDIA_ERR_NONE_ACTIVE + "});"); } } Loading @@ -262,7 +262,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On } else { Log.d(LOG_TAG, "AudioPlayer Error: stopPlaying() called during invalid state: " + this.state.ordinal()); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('" + this.id + "', " + MEDIA_ERROR + ", { \"code\":" + MEDIA_ERR_NONE_ACTIVE + "});"); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.media.Media').onStatus('" + this.id + "', " + MEDIA_ERROR + ", { \"code\":" + MEDIA_ERR_NONE_ACTIVE + "});"); } } Loading @@ -284,7 +284,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On public long getCurrentPosition() { if ((this.state == STATE.MEDIA_RUNNING) || (this.state == STATE.MEDIA_PAUSED)) { int curPos = this.player.getCurrentPosition(); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('" + this.id + "', " + MEDIA_POSITION + ", " + curPos / 1000.0f + ");"); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.media.Media').onStatus('" + this.id + "', " + MEDIA_POSITION + ", " + curPos / 1000.0f + ");"); return curPos; } else { Loading Loading @@ -363,7 +363,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On this.prepareOnly = true; // Send status notification to JavaScript this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('" + this.id + "', " + MEDIA_DURATION + "," + this.duration + ");"); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.media.Media').onStatus('" + this.id + "', " + MEDIA_DURATION + "," + this.duration + ");"); } /** Loading Loading @@ -391,7 +391,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On this.player.release(); // Send error notification to JavaScript this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('" + this.id + "', { \"code\":" + arg1 + "});"); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.media.Media').onStatus('" + this.id + "', { \"code\":" + arg1 + "});"); return false; } Loading @@ -402,7 +402,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On */ private void setState(STATE state) { if (this.state != state) { this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('" + this.id + "', " + MEDIA_STATE + ", " + state.ordinal() + ");"); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.media.Media').onStatus('" + this.id + "', " + MEDIA_STATE + ", " + state.ordinal() + ");"); } this.state = state; } Loading @@ -415,7 +415,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On private void setMode(MODE mode) { if (this.mode != mode) { //mode is not part of the expected behavior, so no notification //this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('" + this.id + "', " + MEDIA_STATE + ", " + mode + ");"); //this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.media.Media').onStatus('" + this.id + "', " + MEDIA_STATE + ", " + mode + ");"); } this.mode = mode; } Loading Loading @@ -451,7 +451,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On break; case RECORD: Log.d(LOG_TAG, "AudioPlayer Error: Can't play in record mode."); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('" + this.id + "', " + MEDIA_ERROR + ", { \"code\":" + MEDIA_ERR_ABORTED + "});"); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.media.Media').onStatus('" + this.id + "', " + MEDIA_ERROR + ", { \"code\":" + MEDIA_ERR_ABORTED + "});"); return false; //player is not ready } return true; Loading @@ -472,7 +472,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On try { this.loadAudioFile(file); } catch (Exception e) { this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('" + this.id + "', "+MEDIA_ERROR+", { \"code\":"+MEDIA_ERR_ABORTED+"});"); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.media.Media').onStatus('" + this.id + "', "+MEDIA_ERROR+", { \"code\":"+MEDIA_ERR_ABORTED+"});"); } return false; case MEDIA_LOADING: Loading @@ -497,14 +497,14 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On try { this.loadAudioFile(file); } catch (Exception e) { this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('" + this.id + "', " + MEDIA_ERROR + ", { \"code\":" + MEDIA_ERR_ABORTED + "});"); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.media.Media').onStatus('" + this.id + "', " + MEDIA_ERROR + ", { \"code\":" + MEDIA_ERR_ABORTED + "});"); } //if we had to prepare= the file, we won't be in the correct state for playback return false; } default: Log.d(LOG_TAG, "AudioPlayer Error: startPlaying() called during invalid state: " + this.state); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('" + this.id + "', " + MEDIA_ERROR + ", { \"code\":" + MEDIA_ERR_ABORTED + "});"); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.media.Media').onStatus('" + this.id + "', " + MEDIA_ERROR + ", { \"code\":" + MEDIA_ERR_ABORTED + "});"); } } return false; Loading src/ios/CDVSound.m +22 −22 Changes for src/ios/CDVSound.m: 22 added lines, 22 removed lines. Original line number Diff line number Diff line Loading @@ -206,7 +206,7 @@ } if (bError) { jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:errcode message:errMsg]]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:errcode message:errMsg]]; [self.commandDelegate evalJs:jsString]; } Loading Loading @@ -251,7 +251,7 @@ if (audioFile == nil) { NSString* errorMessage = [NSString stringWithFormat:@"Failed to initialize Media file with path %@", resourcePath]; NSString* jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_ABORTED message:errorMessage]]; NSString* jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_ABORTED message:errorMessage]]; [self.commandDelegate evalJs:jsString]; } else { CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; Loading Loading @@ -336,7 +336,7 @@ [audioFile.player play]; double position = round(audioFile.player.duration * 1000) / 1000; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%.3f);\n%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_DURATION, position, @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_STATE, MEDIA_RUNNING]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%.3f);\n%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_DURATION, position, @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_STATE, MEDIA_RUNNING]; [self.commandDelegate evalJs:jsString]; } } Loading @@ -354,8 +354,8 @@ [audioFile.player play]; } */ // error creating the session or player // jsString = [NSString stringWithFormat: @"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_ERROR, MEDIA_ERR_NONE_SUPPORTED]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_NONE_SUPPORTED message:nil]]; // jsString = [NSString stringWithFormat: @"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_ERROR, MEDIA_ERR_NONE_SUPPORTED]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_NONE_SUPPORTED message:nil]]; [self.commandDelegate evalJs:jsString]; } } Loading Loading @@ -423,7 +423,7 @@ NSLog(@"Stopped playing audio sample '%@'", audioFile.resourcePath); [audioFile.player stop]; audioFile.player.currentTime = 0; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_STATE, MEDIA_STOPPED]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_STATE, MEDIA_STOPPED]; } // ignore if no media playing if (jsString) { [self.commandDelegate evalJs:jsString]; Loading @@ -439,7 +439,7 @@ if ((audioFile != nil) && (audioFile.player != nil)) { NSLog(@"Paused playing audio sample '%@'", audioFile.resourcePath); [audioFile.player pause]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_STATE, MEDIA_PAUSED]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_STATE, MEDIA_PAUSED]; } // ignore if no media playing Loading Loading @@ -467,11 +467,11 @@ // The seek is past the end of file. Stop media and reset to beginning instead of seeking past the end. [audioFile.player stop]; audioFile.player.currentTime = 0; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%.3f);\n%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_POSITION, 0.0, @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_STATE, MEDIA_STOPPED]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%.3f);\n%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_POSITION, 0.0, @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_STATE, MEDIA_STOPPED]; // NSLog(@"seekToEndJsString=%@",jsString); } else { audioFile.player.currentTime = posInSeconds; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%f);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_POSITION, posInSeconds]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%f);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_POSITION, posInSeconds]; // NSLog(@"seekJsString=%@",jsString); } Loading Loading @@ -515,7 +515,7 @@ position = round(audioFile.player.currentTime * 1000) / 1000; } CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDouble:position]; NSString* jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%.3f);\n%@", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_POSITION, position, [result toSuccessCallbackString:callbackId]]; NSString* jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%.3f);\n%@", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_POSITION, position, [result toSuccessCallbackString:callbackId]]; [self.commandDelegate evalJs:jsString]; } Loading Loading @@ -544,8 +544,8 @@ if (![self.avSession setActive:YES error:&error]) { // other audio with higher priority that does not allow mixing could cause this to fail errorMsg = [NSString stringWithFormat:@"Unable to record audio: %@", [error localizedFailureReason]]; // jsString = [NSString stringWithFormat: @"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_ERROR, MEDIA_ERR_ABORTED]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_ABORTED message:errorMsg]]; // jsString = [NSString stringWithFormat: @"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_ERROR, MEDIA_ERR_ABORTED]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_ABORTED message:errorMsg]]; [self.commandDelegate evalJs:jsString]; return; } Loading @@ -561,7 +561,7 @@ recordingSuccess = [audioFile.recorder record]; if (recordingSuccess) { NSLog(@"Started recording audio sample '%@'", audioFile.resourcePath); jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_STATE, MEDIA_RUNNING]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_STATE, MEDIA_RUNNING]; } } Loading @@ -575,7 +575,7 @@ if (self.avSession) { [self.avSession setActive:NO error:nil]; } jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_ABORTED message:errorMsg]]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_ABORTED message:errorMsg]]; } }; Loading @@ -594,7 +594,7 @@ if (self.avSession) { [self.avSession setActive:NO error:nil]; } jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_ABORTED message:msg]]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_ABORTED message:msg]]; [self.commandDelegate evalJs:jsString]; } }]; Loading @@ -606,7 +606,7 @@ } else { // file did not validate NSString* errorMsg = [NSString stringWithFormat:@"Could not record audio at '%@'", audioFile.resourcePath]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_ABORTED message:errorMsg]]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_ABORTED message:errorMsg]]; [self.commandDelegate evalJs:jsString]; } } Loading Loading @@ -640,10 +640,10 @@ NSLog(@"Finished recording audio sample '%@'", audioFile.resourcePath); } if (flag) { jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_STATE, MEDIA_STOPPED]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_STATE, MEDIA_STOPPED]; } else { // jsString = [NSString stringWithFormat: @"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_ERROR, MEDIA_ERR_DECODE]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_DECODE message:nil]]; // jsString = [NSString stringWithFormat: @"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_ERROR, MEDIA_ERR_DECODE]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_DECODE message:nil]]; } if (self.avSession) { [self.avSession setActive:NO error:nil]; Loading @@ -663,10 +663,10 @@ } if (flag) { audioFile.player.currentTime = 0; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_STATE, MEDIA_STOPPED]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_STATE, MEDIA_STOPPED]; } else { // jsString = [NSString stringWithFormat: @"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_ERROR, MEDIA_ERR_DECODE]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_DECODE message:nil]]; // jsString = [NSString stringWithFormat: @"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_ERROR, MEDIA_ERR_DECODE]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_DECODE message:nil]]; } if (self.avSession) { [self.avSession setActive:NO error:nil]; Loading src/windows8/MediaProxy.js +2 −2 Changes for src/windows8/MediaProxy.js: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -22,9 +22,9 @@ /*global Windows:true */ var cordova = require('cordova'), Media = require('org.apache.cordova.core.AudioHandler.Media'); Media = require('org.apache.cordova.AudioHandler.Media'); var MediaError = require('org.apache.cordova.core.AudioHandler.MediaError'); var MediaError = require('org.apache.cordova.AudioHandler.MediaError'); module.exports = { mediaCaptureMrg:null, Loading Loading
src/android/AudioPlayer.java +15 −15 Changes for src/android/AudioPlayer.java: 15 added lines, 15 removed lines. Original line number Diff line number Diff line Loading @@ -133,7 +133,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On switch (this.mode) { case PLAY: Log.d(LOG_TAG, "AudioPlayer Error: Can't record in play mode."); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('" + this.id + "', "+MEDIA_ERROR+", { \"code\":"+MEDIA_ERR_ABORTED+"});"); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.media.Media').onStatus('" + this.id + "', "+MEDIA_ERROR+", { \"code\":"+MEDIA_ERR_ABORTED+"});"); break; case NONE: this.audioFile = file; Loading @@ -152,11 +152,11 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On e.printStackTrace(); } this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('" + this.id + "', "+MEDIA_ERROR+", { \"code\":"+MEDIA_ERR_ABORTED+"});"); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.media.Media').onStatus('" + this.id + "', "+MEDIA_ERROR+", { \"code\":"+MEDIA_ERR_ABORTED+"});"); break; case RECORD: Log.d(LOG_TAG, "AudioPlayer Error: Already recording."); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('" + this.id + "', "+MEDIA_ERROR+", { \"code\":"+MEDIA_ERR_ABORTED+"});"); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.media.Media').onStatus('" + this.id + "', "+MEDIA_ERROR+", { \"code\":"+MEDIA_ERR_ABORTED+"});"); } } Loading Loading @@ -227,7 +227,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On if (this.readyPlayer(this.audioFile)) { this.player.seekTo(milliseconds); Log.d(LOG_TAG, "Send a onStatus update for the new seek"); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('" + this.id + "', " + MEDIA_POSITION + ", " + milliseconds / 1000.0f + ");"); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.media.Media').onStatus('" + this.id + "', " + MEDIA_POSITION + ", " + milliseconds / 1000.0f + ");"); } else { this.seekOnPrepared = milliseconds; Loading @@ -246,7 +246,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On } else { Log.d(LOG_TAG, "AudioPlayer Error: pausePlaying() called during invalid state: " + this.state.ordinal()); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('" + this.id + "', " + MEDIA_ERROR + ", { \"code\":" + MEDIA_ERR_NONE_ACTIVE + "});"); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.media.Media').onStatus('" + this.id + "', " + MEDIA_ERROR + ", { \"code\":" + MEDIA_ERR_NONE_ACTIVE + "});"); } } Loading @@ -262,7 +262,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On } else { Log.d(LOG_TAG, "AudioPlayer Error: stopPlaying() called during invalid state: " + this.state.ordinal()); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('" + this.id + "', " + MEDIA_ERROR + ", { \"code\":" + MEDIA_ERR_NONE_ACTIVE + "});"); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.media.Media').onStatus('" + this.id + "', " + MEDIA_ERROR + ", { \"code\":" + MEDIA_ERR_NONE_ACTIVE + "});"); } } Loading @@ -284,7 +284,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On public long getCurrentPosition() { if ((this.state == STATE.MEDIA_RUNNING) || (this.state == STATE.MEDIA_PAUSED)) { int curPos = this.player.getCurrentPosition(); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('" + this.id + "', " + MEDIA_POSITION + ", " + curPos / 1000.0f + ");"); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.media.Media').onStatus('" + this.id + "', " + MEDIA_POSITION + ", " + curPos / 1000.0f + ");"); return curPos; } else { Loading Loading @@ -363,7 +363,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On this.prepareOnly = true; // Send status notification to JavaScript this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('" + this.id + "', " + MEDIA_DURATION + "," + this.duration + ");"); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.media.Media').onStatus('" + this.id + "', " + MEDIA_DURATION + "," + this.duration + ");"); } /** Loading Loading @@ -391,7 +391,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On this.player.release(); // Send error notification to JavaScript this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('" + this.id + "', { \"code\":" + arg1 + "});"); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.media.Media').onStatus('" + this.id + "', { \"code\":" + arg1 + "});"); return false; } Loading @@ -402,7 +402,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On */ private void setState(STATE state) { if (this.state != state) { this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('" + this.id + "', " + MEDIA_STATE + ", " + state.ordinal() + ");"); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.media.Media').onStatus('" + this.id + "', " + MEDIA_STATE + ", " + state.ordinal() + ");"); } this.state = state; } Loading @@ -415,7 +415,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On private void setMode(MODE mode) { if (this.mode != mode) { //mode is not part of the expected behavior, so no notification //this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('" + this.id + "', " + MEDIA_STATE + ", " + mode + ");"); //this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.media.Media').onStatus('" + this.id + "', " + MEDIA_STATE + ", " + mode + ");"); } this.mode = mode; } Loading Loading @@ -451,7 +451,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On break; case RECORD: Log.d(LOG_TAG, "AudioPlayer Error: Can't play in record mode."); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('" + this.id + "', " + MEDIA_ERROR + ", { \"code\":" + MEDIA_ERR_ABORTED + "});"); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.media.Media').onStatus('" + this.id + "', " + MEDIA_ERROR + ", { \"code\":" + MEDIA_ERR_ABORTED + "});"); return false; //player is not ready } return true; Loading @@ -472,7 +472,7 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On try { this.loadAudioFile(file); } catch (Exception e) { this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('" + this.id + "', "+MEDIA_ERROR+", { \"code\":"+MEDIA_ERR_ABORTED+"});"); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.media.Media').onStatus('" + this.id + "', "+MEDIA_ERROR+", { \"code\":"+MEDIA_ERR_ABORTED+"});"); } return false; case MEDIA_LOADING: Loading @@ -497,14 +497,14 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener, On try { this.loadAudioFile(file); } catch (Exception e) { this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('" + this.id + "', " + MEDIA_ERROR + ", { \"code\":" + MEDIA_ERR_ABORTED + "});"); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.media.Media').onStatus('" + this.id + "', " + MEDIA_ERROR + ", { \"code\":" + MEDIA_ERR_ABORTED + "});"); } //if we had to prepare= the file, we won't be in the correct state for playback return false; } default: Log.d(LOG_TAG, "AudioPlayer Error: startPlaying() called during invalid state: " + this.state); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('" + this.id + "', " + MEDIA_ERROR + ", { \"code\":" + MEDIA_ERR_ABORTED + "});"); this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.media.Media').onStatus('" + this.id + "', " + MEDIA_ERROR + ", { \"code\":" + MEDIA_ERR_ABORTED + "});"); } } return false; Loading
src/ios/CDVSound.m +22 −22 Changes for src/ios/CDVSound.m: 22 added lines, 22 removed lines. Original line number Diff line number Diff line Loading @@ -206,7 +206,7 @@ } if (bError) { jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:errcode message:errMsg]]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:errcode message:errMsg]]; [self.commandDelegate evalJs:jsString]; } Loading Loading @@ -251,7 +251,7 @@ if (audioFile == nil) { NSString* errorMessage = [NSString stringWithFormat:@"Failed to initialize Media file with path %@", resourcePath]; NSString* jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_ABORTED message:errorMessage]]; NSString* jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_ABORTED message:errorMessage]]; [self.commandDelegate evalJs:jsString]; } else { CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; Loading Loading @@ -336,7 +336,7 @@ [audioFile.player play]; double position = round(audioFile.player.duration * 1000) / 1000; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%.3f);\n%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_DURATION, position, @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_STATE, MEDIA_RUNNING]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%.3f);\n%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_DURATION, position, @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_STATE, MEDIA_RUNNING]; [self.commandDelegate evalJs:jsString]; } } Loading @@ -354,8 +354,8 @@ [audioFile.player play]; } */ // error creating the session or player // jsString = [NSString stringWithFormat: @"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_ERROR, MEDIA_ERR_NONE_SUPPORTED]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_NONE_SUPPORTED message:nil]]; // jsString = [NSString stringWithFormat: @"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_ERROR, MEDIA_ERR_NONE_SUPPORTED]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_NONE_SUPPORTED message:nil]]; [self.commandDelegate evalJs:jsString]; } } Loading Loading @@ -423,7 +423,7 @@ NSLog(@"Stopped playing audio sample '%@'", audioFile.resourcePath); [audioFile.player stop]; audioFile.player.currentTime = 0; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_STATE, MEDIA_STOPPED]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_STATE, MEDIA_STOPPED]; } // ignore if no media playing if (jsString) { [self.commandDelegate evalJs:jsString]; Loading @@ -439,7 +439,7 @@ if ((audioFile != nil) && (audioFile.player != nil)) { NSLog(@"Paused playing audio sample '%@'", audioFile.resourcePath); [audioFile.player pause]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_STATE, MEDIA_PAUSED]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_STATE, MEDIA_PAUSED]; } // ignore if no media playing Loading Loading @@ -467,11 +467,11 @@ // The seek is past the end of file. Stop media and reset to beginning instead of seeking past the end. [audioFile.player stop]; audioFile.player.currentTime = 0; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%.3f);\n%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_POSITION, 0.0, @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_STATE, MEDIA_STOPPED]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%.3f);\n%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_POSITION, 0.0, @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_STATE, MEDIA_STOPPED]; // NSLog(@"seekToEndJsString=%@",jsString); } else { audioFile.player.currentTime = posInSeconds; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%f);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_POSITION, posInSeconds]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%f);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_POSITION, posInSeconds]; // NSLog(@"seekJsString=%@",jsString); } Loading Loading @@ -515,7 +515,7 @@ position = round(audioFile.player.currentTime * 1000) / 1000; } CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDouble:position]; NSString* jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%.3f);\n%@", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_POSITION, position, [result toSuccessCallbackString:callbackId]]; NSString* jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%.3f);\n%@", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_POSITION, position, [result toSuccessCallbackString:callbackId]]; [self.commandDelegate evalJs:jsString]; } Loading Loading @@ -544,8 +544,8 @@ if (![self.avSession setActive:YES error:&error]) { // other audio with higher priority that does not allow mixing could cause this to fail errorMsg = [NSString stringWithFormat:@"Unable to record audio: %@", [error localizedFailureReason]]; // jsString = [NSString stringWithFormat: @"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_ERROR, MEDIA_ERR_ABORTED]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_ABORTED message:errorMsg]]; // jsString = [NSString stringWithFormat: @"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_ERROR, MEDIA_ERR_ABORTED]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_ABORTED message:errorMsg]]; [self.commandDelegate evalJs:jsString]; return; } Loading @@ -561,7 +561,7 @@ recordingSuccess = [audioFile.recorder record]; if (recordingSuccess) { NSLog(@"Started recording audio sample '%@'", audioFile.resourcePath); jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_STATE, MEDIA_RUNNING]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_STATE, MEDIA_RUNNING]; } } Loading @@ -575,7 +575,7 @@ if (self.avSession) { [self.avSession setActive:NO error:nil]; } jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_ABORTED message:errorMsg]]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_ABORTED message:errorMsg]]; } }; Loading @@ -594,7 +594,7 @@ if (self.avSession) { [self.avSession setActive:NO error:nil]; } jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_ABORTED message:msg]]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_ABORTED message:msg]]; [self.commandDelegate evalJs:jsString]; } }]; Loading @@ -606,7 +606,7 @@ } else { // file did not validate NSString* errorMsg = [NSString stringWithFormat:@"Could not record audio at '%@'", audioFile.resourcePath]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_ABORTED message:errorMsg]]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_ABORTED message:errorMsg]]; [self.commandDelegate evalJs:jsString]; } } Loading Loading @@ -640,10 +640,10 @@ NSLog(@"Finished recording audio sample '%@'", audioFile.resourcePath); } if (flag) { jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_STATE, MEDIA_STOPPED]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_STATE, MEDIA_STOPPED]; } else { // jsString = [NSString stringWithFormat: @"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_ERROR, MEDIA_ERR_DECODE]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_DECODE message:nil]]; // jsString = [NSString stringWithFormat: @"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_ERROR, MEDIA_ERR_DECODE]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_DECODE message:nil]]; } if (self.avSession) { [self.avSession setActive:NO error:nil]; Loading @@ -663,10 +663,10 @@ } if (flag) { audioFile.player.currentTime = 0; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_STATE, MEDIA_STOPPED]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_STATE, MEDIA_STOPPED]; } else { // jsString = [NSString stringWithFormat: @"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_ERROR, MEDIA_ERR_DECODE]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_DECODE message:nil]]; // jsString = [NSString stringWithFormat: @"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_ERROR, MEDIA_ERR_DECODE]; jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.media.Media').onStatus", mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_DECODE message:nil]]; } if (self.avSession) { [self.avSession setActive:NO error:nil]; Loading
src/windows8/MediaProxy.js +2 −2 Changes for src/windows8/MediaProxy.js: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -22,9 +22,9 @@ /*global Windows:true */ var cordova = require('cordova'), Media = require('org.apache.cordova.core.AudioHandler.Media'); Media = require('org.apache.cordova.AudioHandler.Media'); var MediaError = require('org.apache.cordova.core.AudioHandler.MediaError'); var MediaError = require('org.apache.cordova.AudioHandler.MediaError'); module.exports = { mediaCaptureMrg:null, Loading