cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject [06/15] git commit: [CB-4799] Fix incorrect JS references within native code on Android & iOS
Date Thu, 26 Sep 2013 22:27:15 GMT
[CB-4799] Fix incorrect JS references within native code on Android & 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/49c1e7da
Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/tree/49c1e7da
Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/diff/49c1e7da

Branch: refs/heads/master
Commit: 49c1e7dac1e93500086d2fe03189859d25e62e85
Parents: 0c42600
Author: David Kemp <drkemp@chromium.org>
Authored: Thu Sep 12 19:59:08 2013 -0400
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Fri Sep 13 10:59:01 2013 -0400

----------------------------------------------------------------------
 src/android/AudioPlayer.java | 30 ++++++++++++++--------------
 src/ios/CDVSound.m           | 42 +++++++++++++++++++--------------------
 2 files changed, 36 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/blob/49c1e7da/src/android/AudioPlayer.java
----------------------------------------------------------------------
diff --git a/src/android/AudioPlayer.java b/src/android/AudioPlayer.java
index 513d5ff..29c4990 100644
--- a/src/android/AudioPlayer.java
+++ b/src/android/AudioPlayer.java
@@ -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.AudioHandler.Media').onStatus('"
+ this.id + "', "+MEDIA_ERROR+", { \"code\":"+MEDIA_ERR_ABORTED+"});");
+            this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('"
+ this.id + "', "+MEDIA_ERROR+", { \"code\":"+MEDIA_ERR_ABORTED+"});");
             break;
         case NONE:
             this.audioFile = file;
@@ -152,11 +152,11 @@ public class AudioPlayer implements OnCompletionListener, OnPreparedListener,
On
                 e.printStackTrace();
             }
 
-            this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.AudioHandler.Media').onStatus('"
+ this.id + "', "+MEDIA_ERROR+", { \"code\":"+MEDIA_ERR_ABORTED+"});");
+            this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.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.AudioHandler.Media').onStatus('"
+ this.id + "', "+MEDIA_ERROR+", { \"code\":"+MEDIA_ERR_ABORTED+"});");
+            this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('"
+ this.id + "', "+MEDIA_ERROR+", { \"code\":"+MEDIA_ERR_ABORTED+"});");
         }
     }
 
@@ -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.AudioHandler.Media').onStatus('"
+ this.id + "', " + MEDIA_POSITION + ", " + milliseconds / 1000.0f + ");");
+            this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('"
+ this.id + "', " + MEDIA_POSITION + ", " + milliseconds / 1000.0f + ");");
         }
         else {
             this.seekOnPrepared = milliseconds;
@@ -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.AudioHandler.Media').onStatus('"
+ this.id + "', " + MEDIA_ERROR + ", { \"code\":" + MEDIA_ERR_NONE_ACTIVE + "});");
+            this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('"
+ this.id + "', " + MEDIA_ERROR + ", { \"code\":" + MEDIA_ERR_NONE_ACTIVE + "});");
         }
     }
 
@@ -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.AudioHandler.Media').onStatus('"
+ this.id + "', " + MEDIA_ERROR + ", { \"code\":" + MEDIA_ERR_NONE_ACTIVE + "});");
+            this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('"
+ this.id + "', " + MEDIA_ERROR + ", { \"code\":" + MEDIA_ERR_NONE_ACTIVE + "});");
         }
     }
 
@@ -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.AudioHandler.Media').onStatus('"
+ this.id + "', " + MEDIA_POSITION + ", " + curPos / 1000.0f + ");");
+            this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('"
+ this.id + "', " + MEDIA_POSITION + ", " + curPos / 1000.0f + ");");
             return curPos;
         }
         else {
@@ -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.AudioHandler.Media').onStatus('"
+ this.id + "', " + MEDIA_DURATION + "," + this.duration + ");");
+        this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('"
+ this.id + "', " + MEDIA_DURATION + "," + this.duration + ");");
     }
 
     /**
@@ -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.AudioHandler.Media').onStatus('"
+ this.id + "', { \"code\":" + arg1 + "});");
+        this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('"
+ this.id + "', { \"code\":" + arg1 + "});");
         return false;
     }
 
@@ -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.AudioHandler.Media').onStatus('"
+ this.id + "', " + MEDIA_STATE + ", " + state.ordinal() + ");");
+            this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('"
+ this.id + "', " + MEDIA_STATE + ", " + state.ordinal() + ");");
         }
         this.state = state;
     }
@@ -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.AudioHandler.Media').onStatus('"
+ this.id + "', " + MEDIA_STATE + ", " + mode + ");");
+            //this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('"
+ this.id + "', " + MEDIA_STATE + ", " + mode + ");");
         }
         this.mode = mode;
     }
@@ -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.AudioHandler.Media').onStatus('"
+ this.id + "', " + MEDIA_ERROR + ", { \"code\":" + MEDIA_ERR_ABORTED + "});");
+            this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('"
+ this.id + "', " + MEDIA_ERROR + ", { \"code\":" + MEDIA_ERR_ABORTED + "});");
             return false; //player is not ready
         }
         return true;
@@ -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.AudioHandler.Media').onStatus('"
+ this.id + "', "+MEDIA_ERROR+", { \"code\":"+MEDIA_ERR_ABORTED+"});");
+                        this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('"
+ this.id + "', "+MEDIA_ERROR+", { \"code\":"+MEDIA_ERR_ABORTED+"});");
                     }
                     return false;
                 case MEDIA_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.AudioHandler.Media').onStatus('"
+ this.id + "', " + MEDIA_ERROR + ", { \"code\":" + MEDIA_ERR_ABORTED + "});");
+                            this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.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.AudioHandler.Media').onStatus('"
+ this.id + "', " + MEDIA_ERROR + ", { \"code\":" + MEDIA_ERR_ABORTED + "});");
+                    this.handler.webView.sendJavascript("cordova.require('org.apache.cordova.core.media.Media').onStatus('"
+ this.id + "', " + MEDIA_ERROR + ", { \"code\":" + MEDIA_ERR_ABORTED + "});");
             }
         }
         return false;

http://git-wip-us.apache.org/repos/asf/cordova-plugin-media/blob/49c1e7da/src/ios/CDVSound.m
----------------------------------------------------------------------
diff --git a/src/ios/CDVSound.m b/src/ios/CDVSound.m
index 5e9fd25..ca6985e 100644
--- a/src/ios/CDVSound.m
+++ b/src/ios/CDVSound.m
@@ -206,7 +206,7 @@
     }
 
     if (bError) {
-        jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.core.AudioHandler.Media').onStatus",
mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:errcode message:errMsg]];
+        jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus",
mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:errcode message:errMsg]];
         [self.commandDelegate evalJs:jsString];
     }
 
@@ -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.AudioHandler.Media').onStatus",
mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_ABORTED message:errorMessage]];
+        NSString* jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus",
mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_ABORTED message:errorMessage]];
         [self.commandDelegate evalJs:jsString];
     } else {
         CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
@@ -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.AudioHandler.Media').onStatus", mediaId, MEDIA_DURATION,
position, @"cordova.require('org.apache.cordova.core.AudioHandler.Media').onStatus", mediaId,
MEDIA_STATE, MEDIA_RUNNING];
+                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];
                 [self.commandDelegate evalJs:jsString];
             }
         }
@@ -354,8 +354,8 @@
                 [audioFile.player play];
             } */
             // error creating the session or player
-            // jsString = [NSString stringWithFormat: @"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.core.AudioHandler.Media').onStatus",
mediaId, MEDIA_ERROR,  MEDIA_ERR_NONE_SUPPORTED];
-            jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.core.AudioHandler.Media').onStatus",
mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_NONE_SUPPORTED message:nil]];
+            // 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]];
             [self.commandDelegate evalJs:jsString];
         }
     }
@@ -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.AudioHandler.Media').onStatus",
mediaId, MEDIA_STATE, MEDIA_STOPPED];
+        jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus",
mediaId, MEDIA_STATE, MEDIA_STOPPED];
     }  // ignore if no media playing
     if (jsString) {
         [self.commandDelegate evalJs:jsString];
@@ -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.AudioHandler.Media').onStatus",
mediaId, MEDIA_STATE, MEDIA_PAUSED];
+        jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus",
mediaId, MEDIA_STATE, MEDIA_PAUSED];
     }
     // ignore if no media playing
 
@@ -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.AudioHandler.Media').onStatus", mediaId, MEDIA_POSITION,
0.0, @"cordova.require('org.apache.cordova.core.AudioHandler.Media').onStatus", mediaId, MEDIA_STATE,
MEDIA_STOPPED];
+            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];
             // NSLog(@"seekToEndJsString=%@",jsString);
         } else {
             audioFile.player.currentTime = posInSeconds;
-            jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%f);", @"cordova.require('org.apache.cordova.core.AudioHandler.Media').onStatus",
mediaId, MEDIA_POSITION, posInSeconds];
+            jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%f);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus",
mediaId, MEDIA_POSITION, posInSeconds];
             // NSLog(@"seekJsString=%@",jsString);
         }
 
@@ -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.AudioHandler.Media').onStatus",
mediaId, MEDIA_POSITION, position, [result toSuccessCallbackString:callbackId]];
+    NSString* jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%.3f);\n%@", @"cordova.require('org.apache.cordova.core.media.Media').onStatus",
mediaId, MEDIA_POSITION, position, [result toSuccessCallbackString:callbackId]];
     [self.commandDelegate evalJs:jsString];
 }
 
@@ -543,8 +543,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.AudioHandler.Media').onStatus",
mediaId, MEDIA_ERROR, MEDIA_ERR_ABORTED];
-                jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.core.AudioHandler.Media').onStatus",
mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_ABORTED message:errorMsg]];
+                // 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]];
                 [self.commandDelegate evalJs:jsString];
                 return;
             }
@@ -560,7 +560,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.AudioHandler.Media').onStatus",
mediaId, MEDIA_STATE, MEDIA_RUNNING];
+                jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus",
mediaId, MEDIA_STATE, MEDIA_RUNNING];
             }
         }
 
@@ -574,12 +574,12 @@
             if (self.avSession) {
                 [self.avSession setActive:NO error:nil];
             }
-            jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.core.AudioHandler.Media').onStatus",
mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_ABORTED message:errorMsg]];
+            jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus",
mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_ABORTED message:errorMsg]];
         }
     } 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.AudioHandler.Media').onStatus",
mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_ABORTED message:errorMsg]];
+        jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus",
mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_ABORTED message:errorMsg]];
     }
     if (jsString) {
         [self.commandDelegate evalJs:jsString];
@@ -616,10 +616,10 @@
         NSLog(@"Finished recording audio sample '%@'", audioFile.resourcePath);
     }
     if (flag) {
-        jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.core.AudioHandler.Media').onStatus",
mediaId, MEDIA_STATE, MEDIA_STOPPED];
+        jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus",
mediaId, MEDIA_STATE, MEDIA_STOPPED];
     } else {
-        // jsString = [NSString stringWithFormat: @"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.core.AudioHandler.Media').onStatus",
mediaId, MEDIA_ERROR, MEDIA_ERR_DECODE];
-        jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.core.AudioHandler.Media').onStatus",
mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_DECODE message:nil]];
+        // 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]];
     }
     if (self.avSession) {
         [self.avSession setActive:NO error:nil];
@@ -639,10 +639,10 @@
     }
     if (flag) {
         audioFile.player.currentTime = 0;
-        jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.core.AudioHandler.Media').onStatus",
mediaId, MEDIA_STATE, MEDIA_STOPPED];
+        jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.core.media.Media').onStatus",
mediaId, MEDIA_STATE, MEDIA_STOPPED];
     } else {
-        // jsString = [NSString stringWithFormat: @"%@(\"%@\",%d,%d);", @"cordova.require('org.apache.cordova.core.AudioHandler.Media').onStatus",
mediaId, MEDIA_ERROR, MEDIA_ERR_DECODE];
-        jsString = [NSString stringWithFormat:@"%@(\"%@\",%d,%@);", @"cordova.require('org.apache.cordova.core.AudioHandler.Media').onStatus",
mediaId, MEDIA_ERROR, [self createMediaErrorWithCode:MEDIA_ERR_DECODE message:nil]];
+        // 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]];
     }
     if (self.avSession) {
         [self.avSession setActive:NO error:nil];


Mime
View raw message