You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ti...@apache.org on 2020/07/04 17:36:23 UTC

[cordova-plugin-media] branch feat/eslint created (now dd48543)

This is an automated email from the ASF dual-hosted git repository.

timbru31 pushed a change to branch feat/eslint
in repository https://gitbox.apache.org/repos/asf/cordova-plugin-media.git.


      at dd48543  refactor(eslint): use cordova-eslint /w fix

This branch includes the following new commits:

     new dd48543  refactor(eslint): use cordova-eslint /w fix

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



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


[cordova-plugin-media] 01/01: refactor(eslint): use cordova-eslint /w fix

Posted by ti...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

timbru31 pushed a commit to branch feat/eslint
in repository https://gitbox.apache.org/repos/asf/cordova-plugin-media.git

commit dd485432069e35fa855e662649102bd8fed8071e
Author: Tim Brust <gi...@timbrust.de>
AuthorDate: Sat Jul 4 19:36:05 2020 +0200

    refactor(eslint): use cordova-eslint /w fix
---
 .eslintrc.yml             |   23 +
 .jshintrc                 |   17 -
 package.json              |    6 +-
 src/windows/MediaProxy.js |  272 +++++---
 tests/tests.js            | 1581 +++++++++++++++++++++++++++------------------
 www/Media.js              |  216 ++++---
 www/MediaError.js         |   29 +-
 www/browser/Media.js      |  133 ++--
 8 files changed, 1378 insertions(+), 899 deletions(-)

diff --git a/.eslintrc.yml b/.eslintrc.yml
new file mode 100644
index 0000000..17277f7
--- /dev/null
+++ b/.eslintrc.yml
@@ -0,0 +1,23 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+root: true
+extends: '@cordova/eslint-config/browser'
+
+overrides:
+    - files: [tests/**/*.js]
+      extends: '@cordova/eslint-config/node-tests'
diff --git a/.jshintrc b/.jshintrc
deleted file mode 100644
index df32482..0000000
--- a/.jshintrc
+++ /dev/null
@@ -1,17 +0,0 @@
-{
-    "browser": true
-  , "devel": true
-  , "bitwise": true
-  , "undef": true
-  , "trailing": true
-  , "quotmark": false
-  , "indent": 4
-  , "unused": "vars"
-  , "latedef": "nofunc"
-  , "globals": {
-        "module": false,
-        "exports": false,
-        "require": false,
-        "cordova": true
-    }
-}
diff --git a/package.json b/package.json
index b866919..0f491d7 100644
--- a/package.json
+++ b/package.json
@@ -29,8 +29,8 @@
     "cordova-windows"
   ],
   "scripts": {
-    "test": "npm run jshint",
-    "jshint": "jshint www && jshint src && jshint tests"
+    "test": "npm run lint",
+    "lint": "eslint ."
   },
   "author": "Apache Software Foundation",
   "license": "Apache-2.0",
@@ -48,6 +48,6 @@
     }
   },
   "devDependencies": {
-    "jshint": "^2.6.0"
+    "@cordova/eslint-config": "^3.0.0"
   }
 }
diff --git a/src/windows/MediaProxy.js b/src/windows/MediaProxy.js
index d7fe294..6425481 100644
--- a/src/windows/MediaProxy.js
+++ b/src/windows/MediaProxy.js
@@ -17,21 +17,33 @@
  * specific language governing permissions and limitations
  * under the License.
  *
-*/
+ */
 
-/*global Windows:true */
+/* global Windows */
 
 var Media = require('cordova-plugin-media.Media');
 var MediaError = require('cordova-plugin-media.MediaError');
 
 var recordedFile;
-var tempFolderAppDataBasePath = 'ms-appdata:///temp/',
-    localFolderAppDataBasePath = 'ms-appdata:///local/',
-    tempFolderFullPath = Windows.Storage.ApplicationData.current.temporaryFolder.path,
-    localFolderFullPath = Windows.Storage.ApplicationData.current.localFolder.path;
+var tempFolderAppDataBasePath = 'ms-appdata:///temp/';
+var localFolderAppDataBasePath = 'ms-appdata:///local/';
+var tempFolderFullPath =
+    Windows.Storage.ApplicationData.current.temporaryFolder.path;
+var localFolderFullPath =
+    Windows.Storage.ApplicationData.current.localFolder.path;
 
 var PARAMETER_IS_INCORRECT = -2147024809;
-var SUPPORTED_EXTENSIONS = ['.mp3', '.wma', '.wav', '.cda', '.adx', '.wm', '.m3u', '.wmx', '.m4a'];
+var SUPPORTED_EXTENSIONS = [
+    '.mp3',
+    '.wma',
+    '.wav',
+    '.cda',
+    '.adx',
+    '.wm',
+    '.m3u',
+    '.wmx',
+    '.m4a'
+];
 var SUPPORTED_PREFIXES = ['http', 'https', 'rstp'];
 
 var fsTypes = {
@@ -40,10 +52,10 @@ var fsTypes = {
 };
 
 module.exports = {
-    mediaCaptureMrg:null,
+    mediaCaptureMrg: null,
 
     // Initiates the audio file
-    create:function(win, lose, args) {
+    create: function (win, lose, args) {
         var id = args[0];
 
         var srcUri = processUri(args[1]);
@@ -56,7 +68,10 @@ module.exports = {
         var prefix = args[1].split(':').shift();
         var extension = srcUri.extension;
         if (thisM.node === null) {
-            if (SUPPORTED_EXTENSIONS.indexOf(extension) === -1 && SUPPORTED_PREFIXES.indexOf(prefix) === -1) {
+            if (
+                SUPPORTED_EXTENSIONS.indexOf(extension) === -1 &&
+                SUPPORTED_PREFIXES.indexOf(prefix) === -1
+            ) {
                 if (lose) {
                     lose({ code: MediaError.MEDIA_ERR_ABORTED });
                 }
@@ -66,7 +81,7 @@ module.exports = {
             // Don't create Audio object in case of record mode
             if (createAudioNode === true) {
                 thisM.node = new Audio();
-                thisM.node.msAudioCategory = "BackgroundCapableMedia";
+                thisM.node.msAudioCategory = 'BackgroundCapableMedia';
                 thisM.node.src = srcUri.absoluteCanonicalUri;
 
                 thisM.node.onloadstart = function () {
@@ -74,7 +89,11 @@ module.exports = {
                 };
 
                 thisM.node.ontimeupdate = function (e) {
-                    Media.onStatus(id, Media.MEDIA_POSITION, e.target.currentTime);
+                    Media.onStatus(
+                        id,
+                        Media.MEDIA_POSITION,
+                        e.target.currentTime
+                    );
                 };
 
                 thisM.node.onplaying = function () {
@@ -82,14 +101,20 @@ module.exports = {
                 };
 
                 thisM.node.ondurationchange = function (e) {
-                    Media.onStatus(id, Media.MEDIA_DURATION, e.target.duration || -1);
+                    Media.onStatus(
+                        id,
+                        Media.MEDIA_DURATION,
+                        e.target.duration || -1
+                    );
                 };
 
                 thisM.node.onerror = function (e) {
                     // Due to media.spec.15 It should return MediaError for bad filename
-                    var err = e.target.error.code === MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED ?
-                        { code: MediaError.MEDIA_ERR_ABORTED } :
-                        e.target.error;
+                    var err =
+                        e.target.error.code ===
+                        MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED
+                            ? { code: MediaError.MEDIA_ERR_ABORTED }
+                            : e.target.error;
 
                     Media.onStatus(id, Media.MEDIA_ERROR, err);
                 };
@@ -104,10 +129,10 @@ module.exports = {
     },
 
     // Start playing the audio
-    startPlayingAudio:function(win, lose, args) {
+    startPlayingAudio: function (win, lose, args) {
         var id = args[0];
-        //var src = args[1];
-        //var options = args[2];
+        // var src = args[1];
+        // var options = args[2];
 
         var thisM = Media.get(id);
         // if Media was released, then node will be null and we need to create it again
@@ -124,13 +149,13 @@ module.exports = {
             thisM.node.play();
         } catch (err) {
             if (lose) {
-                lose({code:MediaError.MEDIA_ERR_ABORTED});
+                lose({ code: MediaError.MEDIA_ERR_ABORTED });
             }
         }
     },
 
     // Stops the playing audio
-    stopPlayingAudio:function(win, lose, args) {
+    stopPlayingAudio: function (win, lose, args) {
         var id = args[0];
         try {
             var thisM = Media.get(id);
@@ -138,12 +163,12 @@ module.exports = {
             thisM.node.currentTime = 0;
             Media.onStatus(id, Media.MEDIA_STATE, Media.MEDIA_STOPPED);
         } catch (err) {
-            lose("Failed to stop: "+err);
+            lose('Failed to stop: ' + err);
         }
     },
 
     // Seeks to the position in the audio
-    seekToAudio:function(win, lose, args) {
+    seekToAudio: function (win, lose, args) {
         var id = args[0];
         var milliseconds = args[1];
         var thisM = Media.get(id);
@@ -151,27 +176,27 @@ module.exports = {
             thisM.node.currentTime = milliseconds / 1000;
             win(thisM.node.currentTime);
         } catch (err) {
-            lose("Failed to seek: "+err);
+            lose('Failed to seek: ' + err);
         }
     },
 
     // Pauses the playing audio
-    pausePlayingAudio:function(win, lose, args) {
+    pausePlayingAudio: function (win, lose, args) {
         var id = args[0];
         var thisM = Media.get(id);
         try {
             thisM.node.pause();
             Media.onStatus(id, Media.MEDIA_STATE, Media.MEDIA_PAUSED);
         } catch (err) {
-            lose("Failed to pause: "+err);
+            lose('Failed to pause: ' + err);
         }
     },
 
     // Gets current position in the audio
-    getCurrentPositionAudio:function(win, lose, args) {
+    getCurrentPositionAudio: function (win, lose, args) {
         var id = args[0];
         try {
-            var p = (Media.get(id)).node.currentTime;
+            var p = Media.get(id).node.currentTime;
             win(p);
         } catch (err) {
             lose(err);
@@ -179,7 +204,7 @@ module.exports = {
     },
 
     // Start recording audio
-    startRecordingAudio:function(win, lose, args) {
+    startRecordingAudio: function (win, lose, args) {
         var id = args[0];
         var srcUri = processUri(args[1]);
 
@@ -196,41 +221,66 @@ module.exports = {
 
         // Initialize device
         Media.prototype.mediaCaptureMgr = null;
-        var thisM = (Media.get(id));
+        var thisM = Media.get(id);
         var captureInitSettings = new Windows.Media.Capture.MediaCaptureInitializationSettings();
-        captureInitSettings.streamingCaptureMode = Windows.Media.Capture.StreamingCaptureMode.audio;
+        captureInitSettings.streamingCaptureMode =
+            Windows.Media.Capture.StreamingCaptureMode.audio;
         thisM.mediaCaptureMgr = new Windows.Media.Capture.MediaCapture();
-        thisM.mediaCaptureMgr.addEventListener("failed", error);
-
-        thisM.mediaCaptureMgr.initializeAsync(captureInitSettings).done(function (result) {
-            thisM.mediaCaptureMgr.addEventListener("recordlimitationexceeded", error);
-            thisM.mediaCaptureMgr.addEventListener("failed", error);
-
-            // Start recording
-            Windows.Storage.ApplicationData.current.temporaryFolder.createFileAsync(destFileName, Windows.Storage.CreationCollisionOption.replaceExisting).done(function (newFile) {
-                recordedFile = newFile;
-                var encodingProfile = null;
-                switch (newFile.fileType) {
-                    case '.m4a':
-                        encodingProfile = Windows.Media.MediaProperties.MediaEncodingProfile.createM4a(Windows.Media.MediaProperties.AudioEncodingQuality.auto);
-                        break;
-                    case '.mp3':
-                        encodingProfile = Windows.Media.MediaProperties.MediaEncodingProfile.createMp3(Windows.Media.MediaProperties.AudioEncodingQuality.auto);
-                        break;
-                    case '.wma':
-                        encodingProfile = Windows.Media.MediaProperties.MediaEncodingProfile.createWma(Windows.Media.MediaProperties.AudioEncodingQuality.auto);
-                        break;
-                    default:
-                        error("Invalid file type for record");
-                        break;
-                }
-                thisM.mediaCaptureMgr.startRecordToStorageFileAsync(encodingProfile, newFile).done(success, error);
+        thisM.mediaCaptureMgr.addEventListener('failed', error);
+
+        thisM.mediaCaptureMgr
+            .initializeAsync(captureInitSettings)
+            .done(function (result) {
+                thisM.mediaCaptureMgr.addEventListener(
+                    'recordlimitationexceeded',
+                    error
+                );
+                thisM.mediaCaptureMgr.addEventListener('failed', error);
+
+                // Start recording
+                Windows.Storage.ApplicationData.current.temporaryFolder
+                    .createFileAsync(
+                        destFileName,
+                        Windows.Storage.CreationCollisionOption.replaceExisting
+                    )
+                    .done(function (newFile) {
+                        recordedFile = newFile;
+                        var encodingProfile = null;
+                        switch (newFile.fileType) {
+                        case '.m4a':
+                            encodingProfile = Windows.Media.MediaProperties.MediaEncodingProfile.createM4a(
+                                Windows.Media.MediaProperties
+                                    .AudioEncodingQuality.auto
+                            );
+                            break;
+                        case '.mp3':
+                            encodingProfile = Windows.Media.MediaProperties.MediaEncodingProfile.createMp3(
+                                Windows.Media.MediaProperties
+                                    .AudioEncodingQuality.auto
+                            );
+                            break;
+                        case '.wma':
+                            encodingProfile = Windows.Media.MediaProperties.MediaEncodingProfile.createWma(
+                                Windows.Media.MediaProperties
+                                    .AudioEncodingQuality.auto
+                            );
+                            break;
+                        default:
+                            error('Invalid file type for record');
+                            break;
+                        }
+                        thisM.mediaCaptureMgr
+                            .startRecordToStorageFileAsync(
+                                encodingProfile,
+                                newFile
+                            )
+                            .done(success, error);
+                    }, error);
             }, error);
-        }, error);
     },
 
     // Stop recording audio
-    stopRecordingAudio:function(win, lose, args) {
+    stopRecordingAudio: function (win, lose, args) {
         var id = args[0];
         var thisM = Media.get(id);
         var srcUri = processUri(thisM.src);
@@ -254,25 +304,50 @@ module.exports = {
                     // if path is not defined, we leave recorded file in temporary folder (similar to iOS)
                     success();
                 } else {
-                    Windows.Storage.ApplicationData.current.temporaryFolder.getFolderAsync(destPath).done(function (destFolder) {
-                        recordedFile.copyAsync(destFolder, destFileName, Windows.Storage.CreationCollisionOption.replaceExisting).done(success, error);
-                    }, error);
+                    Windows.Storage.ApplicationData.current.temporaryFolder
+                        .getFolderAsync(destPath)
+                        .done(function (destFolder) {
+                            recordedFile
+                                .copyAsync(
+                                    destFolder,
+                                    destFileName,
+                                    Windows.Storage.CreationCollisionOption
+                                        .replaceExisting
+                                )
+                                .done(success, error);
+                        }, error);
                 }
             } else {
                 // Copying file to persistent storage
                 if (!destPath) {
-                    recordedFile.copyAsync(Windows.Storage.ApplicationData.current.localFolder, destFileName, Windows.Storage.CreationCollisionOption.replaceExisting).done(success, error);
+                    recordedFile
+                        .copyAsync(
+                            Windows.Storage.ApplicationData.current.localFolder,
+                            destFileName,
+                            Windows.Storage.CreationCollisionOption
+                                .replaceExisting
+                        )
+                        .done(success, error);
                 } else {
-                    Windows.Storage.ApplicationData.current.localFolder.getFolderAsync(destPath).done(function (destFolder) {
-                        recordedFile.copyAsync(destFolder, destFileName, Windows.Storage.CreationCollisionOption.replaceExisting).done(success, error);
-                    }, error);
+                    Windows.Storage.ApplicationData.current.localFolder
+                        .getFolderAsync(destPath)
+                        .done(function (destFolder) {
+                            recordedFile
+                                .copyAsync(
+                                    destFolder,
+                                    destFileName,
+                                    Windows.Storage.CreationCollisionOption
+                                        .replaceExisting
+                                )
+                                .done(success, error);
+                        }, error);
                 }
             }
         }, error);
     },
 
     // Release the media object
-    release:function(win, lose, args) {
+    release: function (win, lose, args) {
         var id = args[0];
         var thisM = Media.get(id);
         try {
@@ -285,10 +360,10 @@ module.exports = {
                 delete thisM.node;
             }
         } catch (err) {
-            lose("Failed to release: "+err);
+            lose('Failed to release: ' + err);
         }
     },
-    setVolume:function(win, lose, args) {
+    setVolume: function (win, lose, args) {
         var id = args[0];
         var volume = args[1];
         var thisM = Media.get(id);
@@ -297,12 +372,12 @@ module.exports = {
 };
 
 /**
- * Converts a path to Windows.Foundation.Uri basing on App data temporary folder 
+ * Converts a path to Windows.Foundation.Uri basing on App data temporary folder
  * if scheme is not defined, e.g.: path/to/file.m4a -> ms-appdata:///temp/path/to/file.m4a
  * @param  {String} src Input path
  * @return {Object}     Windows.Foundation.Uri
  */
-function setTemporaryFsByDefault(src) {
+function setTemporaryFsByDefault (src) {
     var uri;
     try {
         uri = new Windows.Foundation.Uri(src);
@@ -313,9 +388,8 @@ function setTemporaryFsByDefault(src) {
         } else {
             throw e;
         }
-    } finally {
-        return uri;
     }
+    return uri;
 }
 
 /**
@@ -323,13 +397,31 @@ function setTemporaryFsByDefault(src) {
  * @param  {Object} uri Windows.Foundation.Uri
  * @return {Object}     ms-appdata Windows.Foundation.Uri
  */
-function fullPathToAppData(uri) {
+function fullPathToAppData (uri) {
     if (uri.schemeName === 'file') {
-        if (uri.rawUri.indexOf(Windows.Storage.ApplicationData.current.localFolder.path) !== -1) {
+        if (
+            uri.rawUri.indexOf(
+                Windows.Storage.ApplicationData.current.localFolder.path
+            ) !== -1
+        ) {
             // Also remove path' beginning slash to avoid losing folder name part
-            uri = new Windows.Foundation.Uri(localFolderAppDataBasePath, uri.rawUri.replace(localFolderFullPath, '').replace(/^[\\\/]{1,2}/, ''));
-        } else if (uri.rawUri.indexOf(Windows.Storage.ApplicationData.current.temporaryFolder.path) !== -1) {
-            uri = new Windows.Foundation.Uri(tempFolderAppDataBasePath, uri.rawUri.replace(tempFolderFullPath, '').replace(/^[\\\/]{1,2}/, ''));
+            uri = new Windows.Foundation.Uri(
+                localFolderAppDataBasePath,
+                uri.rawUri
+                    .replace(localFolderFullPath, '')
+                    .replace(/^[\\/]{1,2}/, '')
+            );
+        } else if (
+            uri.rawUri.indexOf(
+                Windows.Storage.ApplicationData.current.temporaryFolder.path
+            ) !== -1
+        ) {
+            uri = new Windows.Foundation.Uri(
+                tempFolderAppDataBasePath,
+                uri.rawUri
+                    .replace(tempFolderFullPath, '')
+                    .replace(/^[\\/]{1,2}/, '')
+            );
         } else {
             throw new Error('Not supported file uri: ' + uri.rawUri);
         }
@@ -343,17 +435,25 @@ function fullPathToAppData(uri) {
  * @param  {Object} uri Input cdvfile scheme Windows.Foundation.Uri
  * @return {Object}     Windows.Foundation.Uri based on App data path
  */
-function cdvfileToAppData(uri) {
+function cdvfileToAppData (uri) {
     var cdvFsRoot;
 
     if (uri.schemeName === 'cdvfile') {
         cdvFsRoot = uri.path.split('/')[1];
         if (cdvFsRoot === 'temporary') {
-            return new Windows.Foundation.Uri(tempFolderAppDataBasePath, uri.path.split('/').slice(2).join('/'));
+            return new Windows.Foundation.Uri(
+                tempFolderAppDataBasePath,
+                uri.path.split('/').slice(2).join('/')
+            );
         } else if (cdvFsRoot === 'persistent') {
-            return new Windows.Foundation.Uri(localFolderAppDataBasePath, uri.path.split('/').slice(2).join('/'));
+            return new Windows.Foundation.Uri(
+                localFolderAppDataBasePath,
+                uri.path.split('/').slice(2).join('/')
+            );
         } else {
-            throw new Error(cdvFsRoot + ' cdvfile root is not supported on Windows');
+            throw new Error(
+                cdvFsRoot + ' cdvfile root is not supported on Windows'
+            );
         }
     }
 
@@ -365,12 +465,12 @@ function cdvfileToAppData(uri) {
  * @param  {String} src Input media path
  * @return {Object}     Windows.Foundation.Uri
  */
-function processUri(src) {
+function processUri (src) {
     // Collapse double slashes (File plugin issue): ms-appdata:///temp//recs/memos/media.m4a => ms-appdata:///temp/recs/memos/media.m4a
-    src = src.replace(/([^\/:])(\/\/)([^\/])/g, '$1/$3');
+    src = src.replace(/([^/:])(\/\/)([^/])/g, '$1/$3');
 
     // Remove beginning slashes
-    src = src.replace(/^[\\\/]{1,2}/, '');
+    src = src.replace(/^[\\/]{1,2}/, '');
 
     var uri = setTemporaryFsByDefault(src);
 
@@ -385,7 +485,7 @@ function processUri(src) {
  * @param  {Object} uri Windows.Foundation.Uri
  * @return {Object}     Object containing path, filename and filesystem type
  */
-function parseUriToPathAndFilename(uri) {
+function parseUriToPathAndFilename (uri) {
     // Removing scheme and location, using backslashes: ms-appdata:///local/path/to/file.m4a -> path\\to\\file.m4a
     var normalizedSrc = uri.path.split('/').slice(2).join('\\');
 
@@ -407,4 +507,4 @@ function parseUriToPathAndFilename(uri) {
     };
 }
 
-require("cordova/exec/proxy").add("Media",module.exports);
+require('cordova/exec/proxy').add('Media', module.exports);
diff --git a/tests/tests.js b/tests/tests.js
index 953b954..9639257 100644
--- a/tests/tests.js
+++ b/tests/tests.js
@@ -19,8 +19,7 @@
  *
  */
 
-/* jshint jasmine: true */
-/* global Windows, Media, MediaError, LocalFileSystem, halfSpeedBtn */
+/* global cordova, Windows, Media, MediaError, LocalFileSystem, halfSpeedBtn */
 
 // increased timeout for actual playback to give device chance to download and play mp3 file
 // some emulators can be REALLY slow at this, so two minutes
@@ -29,21 +28,30 @@ var ACTUAL_PLAYBACK_TEST_TIMEOUT = 2 * 60 * 1000;
 var WEB_MP3_FILE = 'https://cordova.apache.org/downloads/BlueZedEx.mp3';
 var WEB_MP3_STREAM = 'https://cordova.apache.org/downloads/BlueZedEx.mp3';
 
-var isWindows = cordova.platformId === 'windows8' || cordova.platformId === 'windows';
+var isWindows =
+    cordova.platformId === 'windows8' || cordova.platformId === 'windows';
 var isBrowser = cordova.platformId === 'browser';
 // Detect whether audio hardware is available and enabled. For iOS playing audio is
 // not supported on emulators w/out sound device connected to host PC but (which is
 // the case for Sauce Labs emulators - see CB-11430)
-var isAudioSupported = isWindows ? !!Windows.Media.Devices.MediaDevice.getDefaultAudioRenderId(Windows.Media.Devices.AudioDeviceRole.default) :
-    cordova.platformId === 'ios' ? !window.SAUCELABS_ENV : true;
-
-var isKitKat = cordova.platformId === 'android' && /Android\s4\.4/.test(window.navigator.userAgent);
+var isAudioSupported = isWindows
+    ? !!Windows.Media.Devices.MediaDevice.getDefaultAudioRenderId(
+        Windows.Media.Devices.AudioDeviceRole.default
+    )
+    : cordova.platformId === 'ios'
+        ? !window.SAUCELABS_ENV
+        : true;
+
+var isKitKat =
+    cordova.platformId === 'android' &&
+    /Android\s4\.4/.test(window.navigator.userAgent);
 
 exports.defineAutoTests = function () {
     var failed = function (done, msg, context) {
         if (context && context.done) return;
         context.done = true;
-        var info = typeof msg == 'undefined' ? 'Unexpected error callback' : msg;
+        var info =
+            typeof msg === 'undefined' ? 'Unexpected error callback' : msg;
         expect(true).toFailWithMessage(info);
         done();
     };
@@ -51,23 +59,23 @@ exports.defineAutoTests = function () {
     var succeed = function (done, msg, context) {
         if (context && context.done) return;
         context.done = true;
-        var info = typeof msg == 'undefined' ? 'Unexpected success callback' : msg;
+        var info =
+            typeof msg === 'undefined' ? 'Unexpected success callback' : msg;
         expect(true).toFailWithMessage(info);
         done();
     };
 
     describe('Media', function () {
-
         beforeEach(function () {
             // Custom Matcher
             jasmine.Expectation.addMatchers({
-                toFailWithMessage : function () {
+                toFailWithMessage: function () {
                     return {
-                        compare : function (error, message) {
+                        compare: function (_, message) {
                             var pass = false;
                             return {
-                                pass : pass,
-                                message : message
+                                pass: pass,
+                                message: message
                             };
                         }
                     };
@@ -75,13 +83,13 @@ exports.defineAutoTests = function () {
             });
         });
 
-        it("media.spec.1 should exist", function () {
+        it('media.spec.1 should exist', function () {
             expect(Media).toBeDefined();
-            expect(typeof Media).toBe("function");
+            expect(typeof Media).toBe('function');
         });
 
-        it("media.spec.2 should have the following properties", function () {
-            var media1 = new Media("dummy");
+        it('media.spec.2 should have the following properties', function () {
+            var media1 = new Media('dummy');
             expect(media1.id).toBeDefined();
             expect(media1.src).toBeDefined();
             expect(media1._duration).toBeDefined();
@@ -89,7 +97,7 @@ exports.defineAutoTests = function () {
             media1.release();
         });
 
-        it("media.spec.3 should define constants for Media status", function () {
+        it('media.spec.3 should define constants for Media status', function () {
             expect(Media).toBeDefined();
             expect(Media.MEDIA_NONE).toBe(0);
             expect(Media.MEDIA_STARTING).toBe(1);
@@ -98,7 +106,7 @@ exports.defineAutoTests = function () {
             expect(Media.MEDIA_STOPPED).toBe(4);
         });
 
-        it("media.spec.4 should define constants for Media errors", function () {
+        it('media.spec.4 should define constants for Media errors', function () {
             expect(MediaError).toBeDefined();
             expect(MediaError.MEDIA_ERR_NONE_ACTIVE).toBe(0);
             expect(MediaError.MEDIA_ERR_ABORTED).toBe(1);
@@ -107,106 +115,113 @@ exports.defineAutoTests = function () {
             expect(MediaError.MEDIA_ERR_NONE_SUPPORTED).toBe(4);
         });
 
-        it("media.spec.5 should contain a play function", function () {
-            var media1 = new Media("dummy");
+        it('media.spec.5 should contain a play function', function () {
+            var media1 = new Media('dummy');
             expect(media1.play).toBeDefined();
             expect(typeof media1.play).toBe('function');
             media1.release();
         });
 
-        it("media.spec.6 should contain a stop function", function () {
-            var media1 = new Media("dummy");
+        it('media.spec.6 should contain a stop function', function () {
+            var media1 = new Media('dummy');
             expect(media1.stop).toBeDefined();
             expect(typeof media1.stop).toBe('function');
             media1.release();
         });
 
-        it("media.spec.7 should contain a seekTo function", function () {
-            var media1 = new Media("dummy");
+        it('media.spec.7 should contain a seekTo function', function () {
+            var media1 = new Media('dummy');
             expect(media1.seekTo).toBeDefined();
             expect(typeof media1.seekTo).toBe('function');
             media1.release();
         });
 
-        it("media.spec.8 should contain a pause function", function () {
-            var media1 = new Media("dummy");
+        it('media.spec.8 should contain a pause function', function () {
+            var media1 = new Media('dummy');
             expect(media1.pause).toBeDefined();
             expect(typeof media1.pause).toBe('function');
             media1.release();
         });
 
-        it("media.spec.9 should contain a getDuration function", function () {
-            var media1 = new Media("dummy");
+        it('media.spec.9 should contain a getDuration function', function () {
+            var media1 = new Media('dummy');
             expect(media1.getDuration).toBeDefined();
             expect(typeof media1.getDuration).toBe('function');
             media1.release();
         });
 
-        it("media.spec.10 should contain a getCurrentPosition function", function () {
-            var media1 = new Media("dummy");
+        it('media.spec.10 should contain a getCurrentPosition function', function () {
+            var media1 = new Media('dummy');
             expect(media1.getCurrentPosition).toBeDefined();
             expect(typeof media1.getCurrentPosition).toBe('function');
             media1.release();
         });
 
-        it("media.spec.11 should contain a startRecord function", function () {
-            var media1 = new Media("dummy");
+        it('media.spec.11 should contain a startRecord function', function () {
+            var media1 = new Media('dummy');
             expect(media1.startRecord).toBeDefined();
             expect(typeof media1.startRecord).toBe('function');
             media1.release();
         });
 
-        it("media.spec.12 should contain a stopRecord function", function () {
-            var media1 = new Media("dummy");
+        it('media.spec.12 should contain a stopRecord function', function () {
+            var media1 = new Media('dummy');
             expect(media1.stopRecord).toBeDefined();
             expect(typeof media1.stopRecord).toBe('function');
             media1.release();
         });
 
-        it("media.spec.13 should contain a release function", function () {
-            var media1 = new Media("dummy");
+        it('media.spec.13 should contain a release function', function () {
+            var media1 = new Media('dummy');
             expect(media1.release).toBeDefined();
             expect(typeof media1.release).toBe('function');
             media1.release();
         });
 
-        it("media.spec.14 should contain a setVolume function", function () {
-            var media1 = new Media("dummy");
+        it('media.spec.14 should contain a setVolume function', function () {
+            var media1 = new Media('dummy');
             expect(media1.setVolume).toBeDefined();
             expect(typeof media1.setVolume).toBe('function');
             media1.release();
         });
 
-        it("media.spec.15 should contain a getCurrentAmplitude function", function () {
-            var media1 = new Media("dummy");
+        it('media.spec.15 should contain a getCurrentAmplitude function', function () {
+            var media1 = new Media('dummy');
             expect(media1.getCurrentAmplitude).toBeDefined();
             expect(typeof media1.getCurrentAmplitude).toBe('function');
             media1.release();
         });
 
-        it("media.spec.16 should contain a pauseRecord function", function () {
-            var media1 = new Media("dummy");
+        it('media.spec.16 should contain a pauseRecord function', function () {
+            var media1 = new Media('dummy');
             expect(media1.pauseRecord).toBeDefined();
             expect(typeof media1.pauseRecord).toBe('function');
             media1.release();
         });
 
-        it("media.spec.17 should contain a resumeRecord function", function () {
-            var media1 = new Media("dummy");
+        it('media.spec.17 should contain a resumeRecord function', function () {
+            var media1 = new Media('dummy');
             expect(media1.resumeRecord).toBeDefined();
             expect(typeof media1.resumeRecord).toBe('function');
             media1.release();
         });
 
-        it("media.spec.18 should return MediaError for bad filename", function (done) {
-            //bb10 dialog pops up, preventing tests from running
+        it('media.spec.18 should return MediaError for bad filename', function (done) {
+            // bb10 dialog pops up, preventing tests from running
             if (cordova.platformId === 'blackberry10') {
                 pending();
             }
 
-            var context = this,
-                fileName = 'invalid.file.name',
-                badMedia = new Media(fileName, succeed.bind(null, done, ' badMedia = new Media , Unexpected succees callback, it should not create Media object with invalid file name'), function (result) {
+            var context = this;
+            var fileName = 'invalid.file.name';
+            var badMedia = new Media(
+                fileName,
+                succeed.bind(
+                    null,
+                    done,
+                    ' badMedia = new Media , Unexpected succees callback, it should not create Media object with invalid file name'
+                ),
+                function (result) {
                     if (context.done) return;
                     context.done = true;
 
@@ -216,15 +231,15 @@ exports.defineAutoTests = function () {
                         badMedia.release();
                     }
                     done();
-                });
+                }
+            );
             badMedia.play();
         });
 
-        describe('actual playback', function() {
-            var checkInterval,
-                media;
+        describe('actual playback', function () {
+            var checkInterval, media;
 
-            afterEach(function() {
+            afterEach(function () {
                 clearInterval(checkInterval);
                 if (media) {
                     media.stop();
@@ -233,211 +248,343 @@ exports.defineAutoTests = function () {
                 }
             });
 
-            it("media.spec.19 position should be set properly", function (done) {
-                // no audio hardware available
-                if (!isAudioSupported || isBrowser || isKitKat) {
-                    pending();
-                }
+            it(
+                'media.spec.19 position should be set properly',
+                function (done) {
+                    // no audio hardware available
+                    if (!isAudioSupported || isBrowser || isKitKat) {
+                        pending();
+                    }
 
-                //context variable used as an extra security statement to ensure that the callback is processed only once,
-                //in case the statusChange callback is reached more than one time with the same status code.
-                //Some information about this kind of behaviour can be found at JIRA: CB-7099.
-                var context = this,
-                    mediaFile = WEB_MP3_FILE,
-                    successCallback = function () { },
-                    statusChange = function (statusCode) {
-                        if (!context.done && statusCode == Media.MEDIA_RUNNING) {
+                    // context variable used as an extra security statement to ensure that the callback is processed only once,
+                    // in case the statusChange callback is reached more than one time with the same status code.
+                    // Some information about this kind of behaviour can be found at JIRA: CB-7099.
+                    var context = this;
+                    var mediaFile = WEB_MP3_FILE;
+                    var successCallback = function () {};
+                    var statusChange = function (statusCode) {
+                        if (
+                            !context.done &&
+                            statusCode === Media.MEDIA_RUNNING
+                        ) {
                             checkInterval = setInterval(function () {
                                 if (context.done) return;
-                                media.getCurrentPosition(function successCallback(position) {
-                                    if (position > 0.0) {
-                                        context.done = true;
-                                        expect(true).toBe(true);
-                                        done();
-                                    }
-                                }, failed.bind(null, done, 'media1.getCurrentPosition - Error getting media current position', context));
+                                media.getCurrentPosition(
+                                    function successCallback (position) {
+                                        if (position > 0.0) {
+                                            context.done = true;
+                                            expect(true).toBe(true);
+                                            done();
+                                        }
+                                    },
+                                    failed.bind(
+                                        null,
+                                        done,
+                                        'media1.getCurrentPosition - Error getting media current position',
+                                        context
+                                    )
+                                );
                             }, 1000);
                         }
                     };
-                media = new Media(mediaFile, successCallback, failed.bind(null, done, 'media1 = new Media - Error creating Media object. Media file: ' + mediaFile, context), statusChange);
-                media.play();
-            }, ACTUAL_PLAYBACK_TEST_TIMEOUT);
-
-            it("media.spec.20 duration should be set properly", function (done) {
-                if (!isAudioSupported || cordova.platformId === 'blackberry10' || isBrowser || isKitKat) {
-                    pending();
-                }
+                    media = new Media(
+                        mediaFile,
+                        successCallback,
+                        failed.bind(
+                            null,
+                            done,
+                            'media1 = new Media - Error creating Media object. Media file: ' +
+                                mediaFile,
+                            context
+                        ),
+                        statusChange
+                    );
+                    media.play();
+                },
+                ACTUAL_PLAYBACK_TEST_TIMEOUT
+            );
+
+            it(
+                'media.spec.20 duration should be set properly',
+                function (done) {
+                    if (
+                        !isAudioSupported ||
+                        cordova.platformId === 'blackberry10' ||
+                        isBrowser ||
+                        isKitKat
+                    ) {
+                        pending();
+                    }
 
-                //context variable used as an extra security statement to ensure that the callback is processed only once,
-                //in case the statusChange callback is reached more than one time with the same status code.
-                //Some information about this kind of behaviour can be found at JIRA: CB-7099.
-                var context = this,
-                    mediaFile = WEB_MP3_FILE,
-                    successCallback = function () { },
-                    statusChange = function (statusCode) {
-                        if (!context.done && statusCode == Media.MEDIA_RUNNING) {
+                    // context variable used as an extra security statement to ensure that the callback is processed only once,
+                    // in case the statusChange callback is reached more than one time with the same status code.
+                    // Some information about this kind of behaviour can be found at JIRA: CB-7099.
+                    var context = this;
+                    var mediaFile = WEB_MP3_FILE;
+                    var successCallback = function () {};
+                    var statusChange = function (statusCode) {
+                        if (
+                            !context.done &&
+                            statusCode === Media.MEDIA_RUNNING
+                        ) {
                             checkInterval = setInterval(function () {
                                 if (context.done) return;
                                 media.getCurrentPosition(function (position) {
                                     if (position > 0.0) {
                                         context.done = true;
-                                        expect(media.getDuration()).toBeGreaterThan(0.0);
+                                        expect(
+                                            media.getDuration()
+                                        ).toBeGreaterThan(0.0);
                                         done();
                                     }
-                                }, failed.bind(null, done, 'media1.getCurrentPosition - Error getting media current position', context));
+                                }, failed.bind(
+                                    null,
+                                    done,
+                                    'media1.getCurrentPosition - Error getting media current position',
+                                    context
+                                ));
                             }, 1000);
                         }
                     };
-                media = new Media(mediaFile, successCallback, failed.bind(null, done, 'media1 = new Media - Error creating Media object. Media file: ' + mediaFile, context), statusChange);
-                media.play();
-            }, ACTUAL_PLAYBACK_TEST_TIMEOUT);
-
-            it("media.spec.21 should be able to resume playback after pause", function (done) {
-                if (!isAudioSupported || cordova.platformId === 'blackberry10' || isKitKat) {
-                    pending();
-                }
-
-                //context variable used as an extra security statement to ensure that the callback is processed only once,
-                //in case the statusChange callback is reached more than one time with the same status code.
-                //Some information about this kind of behaviour can be found at JIRA: CB-7099.
-                var context = this;
-                var resumed = false;
-                var mediaFile = WEB_MP3_FILE;
-                var successCallback = function () { };
-                var statusChange = function (statusCode) {
-                    if (context.done) return;
-
-                    if (statusCode == Media.MEDIA_RUNNING) {
-                        if (!resumed) {
-                            media.seekTo(20000);
-                            media.pause();
-                            return;
-                        }
-
-                        media.getCurrentPosition(function (position) {
-                            expect(position).toBeGreaterThan(19);
-                            expect(position).toBeLessThan(21);
-                            context.done = true;
-                            done();
-                        }, failed.bind(null, done, 'media1.getCurrentPosition - Error getting media current position', context));
-                    }
-
-                    if (statusCode == Media.MEDIA_PAUSED) {
-                        resumed = true;
-                        media.play();
-                    }
-                };
-                media = new Media(mediaFile, successCallback, failed.bind(null, done, 'media1 = new Media - Error creating Media object. Media file: ' + mediaFile, context), statusChange);
-
-                // CB-10535: Play after a few secs, to give allow enough buffering of media file before seeking
-                setTimeout(function() {
+                    media = new Media(
+                        mediaFile,
+                        successCallback,
+                        failed.bind(
+                            null,
+                            done,
+                            'media1 = new Media - Error creating Media object. Media file: ' +
+                                mediaFile,
+                            context
+                        ),
+                        statusChange
+                    );
                     media.play();
-                }, 4000);
+                },
+                ACTUAL_PLAYBACK_TEST_TIMEOUT
+            );
+
+            it(
+                'media.spec.21 should be able to resume playback after pause',
+                function (done) {
+                    if (
+                        !isAudioSupported ||
+                        cordova.platformId === 'blackberry10' ||
+                        isKitKat
+                    ) {
+                        pending();
+                    }
 
-            }, ACTUAL_PLAYBACK_TEST_TIMEOUT);
+                    // context variable used as an extra security statement to ensure that the callback is processed only once,
+                    // in case the statusChange callback is reached more than one time with the same status code.
+                    // Some information about this kind of behaviour can be found at JIRA: CB-7099.
+                    var context = this;
+                    var resumed = false;
+                    var mediaFile = WEB_MP3_FILE;
+                    var successCallback = function () {};
+                    var statusChange = function (statusCode) {
+                        if (context.done) return;
+
+                        if (statusCode === Media.MEDIA_RUNNING) {
+                            if (!resumed) {
+                                media.seekTo(20000);
+                                media.pause();
+                                return;
+                            }
 
-            it("media.spec.22 should be able to seek through file", function (done) {
-                if (!isAudioSupported || cordova.platformId === 'blackberry10' || isKitKat) {
-                    pending();
-                }
-
-                //context variable used as an extra security statement to ensure that the callback is processed only once,
-                //in case the statusChange callback is reached more than one time with the same status code.
-                //Some information about this kind of behaviour can be found at JIRA: CB-7099.
-                var context = this;
-                var mediaFile = WEB_MP3_FILE;
-                var successCallback = function () { };
-                var statusChange = function (statusCode) {
-                    if (!context.done && statusCode == Media.MEDIA_RUNNING) {
-                        checkInterval = setInterval(function () {
-                            if (context.done) return;
-                            media.seekTo(5000);
                             media.getCurrentPosition(function (position) {
-                                expect(position).toBeCloseTo(5, 0);
+                                expect(position).toBeGreaterThan(19);
+                                expect(position).toBeLessThan(21);
                                 context.done = true;
                                 done();
-                            }, failed.bind(null, done, 'media1.getCurrentPosition - Error getting media current position', context));
-                        }, 1000);
-                    }
-                };
-                media = new Media(mediaFile, successCallback, failed.bind(null, done, 'media1 = new Media - Error creating Media object. Media file: ' + mediaFile, context), statusChange);
+                            }, failed.bind(
+                                null,
+                                done,
+                                'media1.getCurrentPosition - Error getting media current position',
+                                context
+                            ));
+                        }
 
-                // CB-10535: Play after a few secs, to give allow enough buffering of media file before seeking
-                setTimeout(function() {
-                    media.play();
-                }, 4000);
+                        if (statusCode === Media.MEDIA_PAUSED) {
+                            resumed = true;
+                            media.play();
+                        }
+                    };
+                    media = new Media(
+                        mediaFile,
+                        successCallback,
+                        failed.bind(
+                            null,
+                            done,
+                            'media1 = new Media - Error creating Media object. Media file: ' +
+                                mediaFile,
+                            context
+                        ),
+                        statusChange
+                    );
+
+                    // CB-10535: Play after a few secs, to give allow enough buffering of media file before seeking
+                    setTimeout(function () {
+                        media.play();
+                    }, 4000);
+                },
+                ACTUAL_PLAYBACK_TEST_TIMEOUT
+            );
+
+            it(
+                'media.spec.22 should be able to seek through file',
+                function (done) {
+                    if (
+                        !isAudioSupported ||
+                        cordova.platformId === 'blackberry10' ||
+                        isKitKat
+                    ) {
+                        pending();
+                    }
 
-            }, ACTUAL_PLAYBACK_TEST_TIMEOUT);
+                    // context variable used as an extra security statement to ensure that the callback is processed only once,
+                    // in case the statusChange callback is reached more than one time with the same status code.
+                    // Some information about this kind of behaviour can be found at JIRA: CB-7099.
+                    var context = this;
+                    var mediaFile = WEB_MP3_FILE;
+                    var successCallback = function () {};
+                    var statusChange = function (statusCode) {
+                        if (
+                            !context.done &&
+                            statusCode === Media.MEDIA_RUNNING
+                        ) {
+                            checkInterval = setInterval(function () {
+                                if (context.done) return;
+                                media.seekTo(5000);
+                                media.getCurrentPosition(function (position) {
+                                    expect(position).toBeCloseTo(5, 0);
+                                    context.done = true;
+                                    done();
+                                }, failed.bind(
+                                    null,
+                                    done,
+                                    'media1.getCurrentPosition - Error getting media current position',
+                                    context
+                                ));
+                            }, 1000);
+                        }
+                    };
+                    media = new Media(
+                        mediaFile,
+                        successCallback,
+                        failed.bind(
+                            null,
+                            done,
+                            'media1 = new Media - Error creating Media object. Media file: ' +
+                                mediaFile,
+                            context
+                        ),
+                        statusChange
+                    );
+
+                    // CB-10535: Play after a few secs, to give allow enough buffering of media file before seeking
+                    setTimeout(function () {
+                        media.play();
+                    }, 4000);
+                },
+                ACTUAL_PLAYBACK_TEST_TIMEOUT
+            );
         });
 
-        it("media.spec.23 should contain a setRate function", function () {
-            var media1 = new Media("dummy");
+        it('media.spec.23 should contain a setRate function', function () {
+            var media1 = new Media('dummy');
             expect(media1.setRate).toBeDefined();
             expect(typeof media1.setRate).toBe('function');
             media1.release();
         });
 
-        it("media.spec.24 playback rate should be set properly using setRate", function (done) {
-            if (cordova.platformId !== 'ios') {
-                expect(true).toFailWithMessage('Platform does not supported this feature');
-                pending();
-            }
+        it(
+            'media.spec.24 playback rate should be set properly using setRate',
+            function (done) {
+                if (cordova.platformId !== 'ios') {
+                    expect(true).toFailWithMessage(
+                        'Platform does not supported this feature'
+                    );
+                    pending();
+                }
 
-            // no audio hardware available
-            if (!isAudioSupported) {
-                pending();
-            }
+                // no audio hardware available
+                if (!isAudioSupported) {
+                    pending();
+                }
 
-            var mediaFile = WEB_MP3_FILE,
-                successCallback,
-                context = this,
-                flag = true,
-                statusChange = function (statusCode) {
-                    console.log("status code: " + statusCode);
-                    if (statusCode == Media.MEDIA_RUNNING && flag) {
-                        //flag variable used to ensure an extra security statement to ensure that the callback is processed only once,
-                        //in case for some reason the statusChange callback is reached more than one time with the same status code.
-                        //Some information about this kind of behavior it can be found at JIRA: CB-7099
+                var mediaFile = WEB_MP3_FILE;
+                var successCallback;
+                var context = this;
+                var flag = true;
+                var statusChange = function (statusCode) {
+                    console.log('status code: ' + statusCode);
+                    if (statusCode === Media.MEDIA_RUNNING && flag) {
+                        // flag variable used to ensure an extra security statement to ensure that the callback is processed only once,
+                        // in case for some reason the statusChange callback is reached more than one time with the same status code.
+                        // Some information about this kind of behavior it can be found at JIRA: CB-7099
                         flag = false;
                         setTimeout(function () {
-                            media1.getCurrentPosition(function (position) {
-                                //in four seconds expect position to be between 4 & 10. Here, the values are chosen to give
-                                //a large enough buffer range for the position to fall in and are not based on any calculation.
-                                expect(position).not.toBeLessThan(4);
-                                expect(position).toBeLessThan(10);
-                                media1.stop();
-                                media1.release();
-                                context.done = true;
-                                done();
-                            }, failed.bind(null, done, 'media1.getCurrentPosition - Error getting media current position'),context);
+                            media1.getCurrentPosition(
+                                function (position) {
+                                    // in four seconds expect position to be between 4 & 10. Here, the values are chosen to give
+                                    // a large enough buffer range for the position to fall in and are not based on any calculation.
+                                    expect(position).not.toBeLessThan(4);
+                                    expect(position).toBeLessThan(10);
+                                    media1.stop();
+                                    media1.release();
+                                    context.done = true;
+                                    done();
+                                },
+                                failed.bind(
+                                    null,
+                                    done,
+                                    'media1.getCurrentPosition - Error getting media current position'
+                                ),
+                                context
+                            );
                         }, 4000);
                     }
                 };
 
-            var media1 = new Media(mediaFile, successCallback, failed.bind(null, done, 'media1 = new Media - Error creating Media object. Media file: ' + mediaFile, context), statusChange); // jshint ignore:line
-            //make audio playback two times faster
-            media1.setRate(2);
-            media1.play();
-        }, ACTUAL_PLAYBACK_TEST_TIMEOUT);
-
-        it("media.spec.25 should be able to play an audio stream", function (done) {
-            // no audio hardware available, OR
-            // O_o Safari can't play the stream, so we're skipping this test on all browsers o_O
-            if (!isAudioSupported || isBrowser || isKitKat) {
-                pending();
-            }
+                var media1 = new Media(
+                    mediaFile,
+                    successCallback,
+                    failed.bind(
+                        null,
+                        done,
+                        'media1 = new Media - Error creating Media object. Media file: ' +
+                            mediaFile,
+                        context
+                    ),
+                    statusChange
+                );
+                // make audio playback two times faster
+                media1.setRate(2);
+                media1.play();
+            },
+            ACTUAL_PLAYBACK_TEST_TIMEOUT
+        );
+
+        it(
+            'media.spec.25 should be able to play an audio stream',
+            function (done) {
+                // no audio hardware available, OR
+                // O_o Safari can't play the stream, so we're skipping this test on all browsers o_O
+                if (!isAudioSupported || isBrowser || isKitKat) {
+                    pending();
+                }
 
-            // The link below points to an infinite mp3 stream
-            var mediaFile = WEB_MP3_STREAM,
-                successCallback,
-                context = this,
-                flag = true,
-                statusChange = function (statusCode) {
-                    console.log("status code: " + statusCode);
-                    if (statusCode == Media.MEDIA_RUNNING && flag) {
-                        //flag variable used to ensure an extra security statement to ensure that the callback is processed only once,
-                        //in case for some reason the statusChange callback is reached more than one time with the same status code.
-                        //Some information about this kind of behavior it can be found at JIRA: CB-7099
+                // The link below points to an infinite mp3 stream
+                var mediaFile = WEB_MP3_STREAM;
+                var successCallback;
+                var context = this;
+                var flag = true;
+                var statusChange = function (statusCode) {
+                    console.log('status code: ' + statusCode);
+                    if (statusCode === Media.MEDIA_RUNNING && flag) {
+                        // flag variable used to ensure an extra security statement to ensure that the callback is processed only once,
+                        // in case for some reason the statusChange callback is reached more than one time with the same status code.
+                        // Some information about this kind of behavior it can be found at JIRA: CB-7099
                         flag = false;
                         expect(true).toBe(true);
                         media1.stop();
@@ -447,12 +594,25 @@ exports.defineAutoTests = function () {
                     }
                 };
 
-            var media1 = new Media(mediaFile, successCallback, failed.bind(null, done, 'media1 = new Media - Error creating Media object. Media file: ' + mediaFile, context), statusChange); // jshint ignore:line
-            media1.play();
-        }, ACTUAL_PLAYBACK_TEST_TIMEOUT);
+                var media1 = new Media(
+                    mediaFile,
+                    successCallback,
+                    failed.bind(
+                        null,
+                        done,
+                        'media1 = new Media - Error creating Media object. Media file: ' +
+                            mediaFile,
+                        context
+                    ),
+                    statusChange
+                );
+                media1.play();
+            },
+            ACTUAL_PLAYBACK_TEST_TIMEOUT
+        );
 
-        it("media.spec.26 should not crash or throw when setting the volume right after creating the media", function (done) {
-            //bb10 dialog pops up, preventing tests from running
+        it('media.spec.26 should not crash or throw when setting the volume right after creating the media', function (done) {
+            // bb10 dialog pops up, preventing tests from running
             if (cordova.platformId === 'blackberry10') {
                 pending();
             }
@@ -474,8 +634,8 @@ exports.defineAutoTests = function () {
             }, 3000);
         });
 
-        it("media.spec.27 should call success or error when trying to stop a media that is in starting state", function (done) {
-            //bb10 dialog pops up, preventing tests from running
+        it('media.spec.27 should call success or error when trying to stop a media that is in starting state', function (done) {
+            // bb10 dialog pops up, preventing tests from running
             if (!isAudioSupported || cordova.platformId === 'blackberry10') {
                 pending();
             }
@@ -492,19 +652,21 @@ exports.defineAutoTests = function () {
                 }
             };
 
-            var errorCallback = jasmine.createSpy('errorCallback').and.callFake(function (e) {
-                expect(true).toBe(true);
-                safeDone();
-            });
+            var errorCallback = jasmine
+                .createSpy('errorCallback')
+                .and.callFake(function (e) {
+                    expect(true).toBe(true);
+                    safeDone();
+                });
             var successCallback = function () {
                 expect(true).toBe(true);
                 safeDone();
             };
             var statusChange = function (s) {
-                if ((s == Media.MEDIA_STARTING) && !context.done) {
+                if (s === Media.MEDIA_STARTING && !context.done) {
                     beenStarting = true;
                     media.stop();
-                } else if (s == Media.MEDIA_RUNNING) {
+                } else if (s === Media.MEDIA_RUNNING) {
                     // Some plugin implementations may skip "Starting" state
                     // so we'll also try to call stop in "Running" state,
                     // but in this case we should check that the "Starting" state wasn't really reached,
@@ -514,30 +676,34 @@ exports.defineAutoTests = function () {
                 }
             };
 
-            media = new Media(mediaFile, successCallback, errorCallback, statusChange);
+            media = new Media(
+                mediaFile,
+                successCallback,
+                errorCallback,
+                statusChange
+            );
             media.play();
         });
-
     });
 };
 
-//******************************************************************************************
-//***************************************Manual Tests***************************************
-//******************************************************************************************
+//* *****************************************************************************************
+//* **************************************Manual Tests***************************************
+//* *****************************************************************************************
 
 exports.defineManualTests = function (contentEl, createActionButton) {
-    //-------------------------------------------------------------------------
+    // -------------------------------------------------------------------------
     // Audio player
-    //-------------------------------------------------------------------------
+    // -------------------------------------------------------------------------
     var media1 = null;
     var media1Timer = null;
     var audioSrc = null;
     var defaultaudio = WEB_MP3_FILE;
 
-    //Play audio function
-    function playAudio(url) {
-        console.log("playAudio()");
-        console.log(" -- media=" + media1);
+    // Play audio function
+    function playAudio (url) {
+        console.log('playAudio()');
+        console.log(' -- media=' + media1);
 
         var src = defaultaudio;
 
@@ -554,84 +720,84 @@ exports.defineManualTests = function (contentEl, createActionButton) {
         }
 
         if (media1 === null) {
-
             // TEST STREAMING AUDIO PLAYBACK
-            //var src = "http://nunzioweb.com/misc/Bon_Jovi-Crush_Mystery_Train.mp3";   // works
-            //var src = "http://nunzioweb.com/misc/Bon_Jovi-Crush_Mystery_Train.m3u"; // doesn't work
-            //var src = "http://www.wav-sounds.com/cartoon/bugsbunny1.wav"; // works
-            //var src = "http://www.angelfire.com/fl5/html-tutorial/a/couldyou.mid"; // doesn't work
-            //var src = "MusicSearch/mp3/train.mp3";    // works
-            //var src = "bryce.mp3";  // works
-            //var src = "/android_asset/www/bryce.mp3"; // works
-
-            media1 = new Media(src,
-                    function () {
-                    console.log("playAudio():Audio Success");
+            // var src = "http://nunzioweb.com/misc/Bon_Jovi-Crush_Mystery_Train.mp3";   // works
+            // var src = "http://nunzioweb.com/misc/Bon_Jovi-Crush_Mystery_Train.m3u"; // doesn't work
+            // var src = "http://www.wav-sounds.com/cartoon/bugsbunny1.wav"; // works
+            // var src = "http://www.angelfire.com/fl5/html-tutorial/a/couldyou.mid"; // doesn't work
+            // var src = "MusicSearch/mp3/train.mp3";    // works
+            // var src = "bryce.mp3";  // works
+            // var src = "/android_asset/www/bryce.mp3"; // works
+
+            media1 = new Media(
+                src,
+                function () {
+                    console.log('playAudio():Audio Success');
                 },
-                    function (err) {
-                    console.log("playAudio():Audio Error: " + err.code);
-                    setAudioStatus("Error: " + err.code);
+                function (err) {
+                    console.log('playAudio():Audio Error: ' + err.code);
+                    setAudioStatus('Error: ' + err.code);
                 },
-                    function (status) {
-                    console.log("playAudio():Audio Status: " + status);
+                function (status) {
+                    console.log('playAudio():Audio Status: ' + status);
                     setAudioStatus(Media.MEDIA_MSG[status]);
 
                     // If stopped, then stop getting current position
-                    if (Media.MEDIA_STOPPED == status) {
+                    if (Media.MEDIA_STOPPED === status) {
                         clearInterval(media1Timer);
                         media1Timer = null;
-                        setAudioPosition("0 sec");
+                        setAudioPosition('0 sec');
                     }
-                });
+                }
+            );
         }
         audioSrc = src;
-        document.getElementById('durationValue').innerHTML = "";
+        document.getElementById('durationValue').innerHTML = '';
         // Play audio
         media1.play();
         if (media1Timer === null && media1.getCurrentPosition) {
-            media1Timer = setInterval(
-                    function () {
-                    media1.getCurrentPosition(
-                        function (position) {
+            media1Timer = setInterval(function () {
+                media1.getCurrentPosition(
+                    function (position) {
                         if (position >= 0.0) {
-                            setAudioPosition(position + " sec");
+                            setAudioPosition(position + ' sec');
                         }
                     },
-                        function (e) {
-                        console.log("Error getting pos=" + e);
-                        setAudioPosition("Error: " + e);
-                    });
-                },
-                    1000);
+                    function (e) {
+                        console.log('Error getting pos=' + e);
+                        setAudioPosition('Error: ' + e);
+                    }
+                );
+            }, 1000);
         }
 
         // Get duration
         var counter = 0;
-        var timerDur = setInterval(
-                function () {
-                counter = counter + 100;
-                if (counter > 2000) {
-                    clearInterval(timerDur);
-                }
-                var dur = media1.getDuration();
-                if (dur > 0) {
-                    clearInterval(timerDur);
-                    document.getElementById('durationValue').innerHTML = dur + " sec";
-                }
-            }, 100);
+        var timerDur = setInterval(function () {
+            counter = counter + 100;
+            if (counter > 2000) {
+                clearInterval(timerDur);
+            }
+            var dur = media1.getDuration();
+            if (dur > 0) {
+                clearInterval(timerDur);
+                document.getElementById('durationValue').innerHTML =
+                    dur + ' sec';
+            }
+        }, 100);
     }
 
-    //Pause audio playback
-    function pauseAudio() {
-        console.log("pauseAudio()");
+    // Pause audio playback
+    function pauseAudio () {
+        console.log('pauseAudio()');
         if (media1) {
             media1.pause();
         }
     }
 
-    //Stop audio
-    function stopAudio() {
-        console.log("stopAudio()");
+    // Stop audio
+    function stopAudio () {
+        console.log('stopAudio()');
         if (media1) {
             media1.stop();
         }
@@ -639,132 +805,140 @@ exports.defineManualTests = function (contentEl, createActionButton) {
         media1Timer = null;
     }
 
-    //Release audio
-    function releaseAudio() {
-        console.log("releaseAudio()");
+    // Release audio
+    function releaseAudio () {
+        console.log('releaseAudio()');
         if (media1) {
-            media1.stop(); //imlied stop of playback, resets timer
+            media1.stop(); // imlied stop of playback, resets timer
             media1.release();
         }
     }
 
-    //Set audio status
-    function setAudioStatus(status) {
+    // Set audio status
+    function setAudioStatus (status) {
         document.getElementById('statusValue').innerHTML = status;
     }
 
-    //Set audio position
-    function setAudioPosition(position) {
+    // Set audio position
+    function setAudioPosition (position) {
         document.getElementById('positionValue').innerHTML = position;
     }
 
-    //Seek audio
-    function seekAudio(mode) {
-        var time = document.getElementById("seekInput").value;
-        if (time === "") {
+    // Seek audio
+    function seekAudio (mode) {
+        var time = document.getElementById('seekInput').value;
+        if (time === '') {
             time = 5000;
         } else {
-            time = time * 1000; //we expect the input to be in seconds
+            time = time * 1000; // we expect the input to be in seconds
         }
         if (media1 === null) {
-            console.log("seekTo requested while media1 is null");
+            console.log('seekTo requested while media1 is null');
             if (audioSrc === null) {
                 audioSrc = defaultaudio;
             }
-            media1 = new Media(audioSrc,
-                    function () {
-                    console.log("seekToAudio():Audio Success");
+            media1 = new Media(
+                audioSrc,
+                function () {
+                    console.log('seekToAudio():Audio Success');
                 },
-                    function (err) {
-                    console.log("seekAudio():Audio Error: " + err.code);
-                    setAudioStatus("Error: " + err.code);
+                function (err) {
+                    console.log('seekAudio():Audio Error: ' + err.code);
+                    setAudioStatus('Error: ' + err.code);
                 },
-                    function (status) {
-                    console.log("seekAudio():Audio Status: " + status);
+                function (status) {
+                    console.log('seekAudio():Audio Status: ' + status);
                     setAudioStatus(Media.MEDIA_MSG[status]);
 
                     // If stopped, then stop getting current position
-                    if (Media.MEDIA_STOPPED == status) {
+                    if (Media.MEDIA_STOPPED === status) {
                         clearInterval(media1Timer);
                         media1Timer = null;
-                        setAudioPosition("0 sec");
+                        setAudioPosition('0 sec');
                     }
-                });
+                }
+            );
         }
 
         media1.getCurrentPosition(
             function (position) {
-            var deltat = time;
-            if (mode === "by") {
-                deltat = time + position * 1000;
-            }
-            media1.seekTo(deltat,
-                function () {
-                console.log("seekAudioTo():Audio Success");
-                //force an update on the position display
-                updatePosition();
+                var deltat = time;
+                if (mode === 'by') {
+                    deltat = time + position * 1000;
+                }
+                media1.seekTo(
+                    deltat,
+                    function () {
+                        console.log('seekAudioTo():Audio Success');
+                        // force an update on the position display
+                        updatePosition();
+                    },
+                    function (err) {
+                        console.log('seekAudioTo():Audio Error: ' + err.code);
+                    }
+                );
             },
-                function (err) {
-                console.log("seekAudioTo():Audio Error: " + err.code);
-            });
-        },
             function (e) {
-            console.log("Error getting pos=" + e);
-            setAudioPosition("Error: " + e);
-        });
+                console.log('Error getting pos=' + e);
+                setAudioPosition('Error: ' + e);
+            }
+        );
     }
 
-    //set audio volume
-    function setVolume() {
-        console.log("setVolume()");
-        var volume = document.getElementById("volumeInput").value;
+    // set audio volume
+    function setVolume () {
+        console.log('setVolume()');
+        var volume = document.getElementById('volumeInput').value;
         if (media1 !== null) {
             media1.setVolume(volume);
         }
     }
 
-    //for forced updates of position after a successful seek
+    // for forced updates of position after a successful seek
 
-    function updatePosition() {
+    function updatePosition () {
         media1.getCurrentPosition(
             function (position) {
-            if (position >= 0.0) {
-                setAudioPosition(position + " sec");
-            }
-        },
+                if (position >= 0.0) {
+                    setAudioPosition(position + ' sec');
+                }
+            },
             function (e) {
-            console.log("Error getting pos=" + e);
-            setAudioPosition("Error: " + e);
-        });
+                console.log('Error getting pos=' + e);
+                setAudioPosition('Error: ' + e);
+            }
+        );
     }
 
-    //-------------------------------------------------------------------------
+    // -------------------------------------------------------------------------
     // Audio recorder
-    //-------------------------------------------------------------------------
+    // -------------------------------------------------------------------------
     var mediaRec = null;
     var recTime = 0;
-    var recordSrc = "myRecording.mp3";
+    var recordSrc = 'myRecording.mp3';
 
-    //Record audio
-    function recordAudio() {
-        console.log("recordAudio(), recording to " + recordSrc);
-        console.log(" -- media=" + mediaRec);
+    // Record audio
+    function recordAudio () {
+        console.log('recordAudio(), recording to ' + recordSrc);
+        console.log(' -- media=' + mediaRec);
 
         releaseAudio();
 
         if (!mediaRec) {
-            mediaRec = new Media(recordSrc,
+            mediaRec = new Media(
+                recordSrc,
                 function () {
-                    console.log("recordAudio():Audio Success");
+                    console.log('recordAudio():Audio Success');
                 },
-                    function (err) {
-                    console.log("recordAudio():Audio Error: " + err.code);
-                    setAudioStatus("Error: " + err.code);
+                function (err) {
+                    console.log('recordAudio():Audio Error: ' + err.code);
+                    setAudioStatus('Error: ' + err.code);
                 },
-                    function (status) {
-                    console.log("recordAudio():Audio Status: " + status);
+                function (status) {
+                    console.log('recordAudio():Audio Status: ' + status);
                     setAudioStatus(Media.MEDIA_MSG[status]);
-                });
+                }
+            );
         }
 
         // Record audio
@@ -773,334 +947,406 @@ exports.defineManualTests = function (contentEl, createActionButton) {
         // Stop recording after 10 sec
         recTime = 0;
         var recInterval = setInterval(function () {
-                recTime = recTime + 1;
-                setAudioPosition(recTime + " sec");
-                if (recTime >= 10) {
-                    clearInterval(recInterval);
-                    if (mediaRec.stopAudioRecord) {
-                        mediaRec.stopAudioRecord();
-                    } else {
-                        mediaRec.stopRecord();
-                    }
-                    console.log("recordAudio(): stop");
+            recTime = recTime + 1;
+            setAudioPosition(recTime + ' sec');
+            if (recTime >= 10) {
+                clearInterval(recInterval);
+                if (mediaRec.stopAudioRecord) {
+                    mediaRec.stopAudioRecord();
+                } else {
+                    mediaRec.stopRecord();
                 }
-            }, 1000);
+                console.log('recordAudio(): stop');
+            }
+        }, 1000);
     }
 
-    //Play back recorded audio
-    function playRecording() {
+    // Play back recorded audio
+    function playRecording () {
         playAudio(recordSrc);
     }
 
-    //Function to get a filename for iOS recording
-    //Ensures that file doesn't exist to test CB-11380
-    function getRecordSrc() {
+    // Function to get a filename for iOS recording
+    // Ensures that file doesn't exist to test CB-11380
+    function getRecordSrc () {
         var noop = function () {};
-        recordSrc = "cdvfile://localhost/temporary/iOSRecording.wav";
-        window.resolveLocalFileSystemURL(recordSrc, function (file) {
-            file.remove(function() {
-                console.log("Successfully removed " + recordSrc);
-            }, noop);
-        }, noop);
+        recordSrc = 'cdvfile://localhost/temporary/iOSRecording.wav';
+        window.resolveLocalFileSystemURL(
+            recordSrc,
+            function (file) {
+                file.remove(function () {
+                    console.log('Successfully removed ' + recordSrc);
+                }, noop);
+            },
+            noop
+        );
     }
 
-    //Function to create a file for BB recording
-    function getRecordSrcBB() {
+    // Function to create a file for BB recording
+    function getRecordSrcBB () {
         var fsFail = function (error) {
-            console.log("error creating file for BB recording");
+            console.log('error creating file for BB recording', error);
         };
         var gotFile = function (file) {
             recordSrc = file.fullPath;
         };
         var gotFS = function (fileSystem) {
-            fileSystem.root.getFile("BBRecording.amr", {
-                create : true
-            }, gotFile, fsFail);
+            fileSystem.root.getFile(
+                'BBRecording.amr',
+                {
+                    create: true
+                },
+                gotFile,
+                fsFail
+            );
         };
         window.requestFileSystem(LocalFileSystem.TEMPORARY, 0, gotFS, fsFail);
     }
 
-    //Function to create a file for Windows recording
-    function getRecordSrcWin() {
+    // Function to create a file for Windows recording
+    function getRecordSrcWin () {
         var fsFail = function (error) {
-            console.log("error creating file for Win recording");
+            console.log('error creating file for Win recording', error);
         };
         var gotFile = function (file) {
             recordSrc = file.name;
         };
         var gotFS = function (fileSystem) {
-            fileSystem.root.getFile("WinRecording.m4a", {
-                create: true
-            }, gotFile, fsFail);
+            fileSystem.root.getFile(
+                'WinRecording.m4a',
+                {
+                    create: true
+                },
+                gotFile,
+                fsFail
+            );
         };
         window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, gotFS, fsFail);
     }
 
-//Generate Dynamic Table
-    function generateTable(tableId, rows, cells, elements) {
+    // Generate Dynamic Table
+    function generateTable (tableId, rows, cells, elements) {
         var table = document.createElement('table');
         for (var r = 0; r < rows; r++) {
             var row = table.insertRow(r);
             for (var c = 0; c < cells; c++) {
                 var cell = row.insertCell(c);
-                cell.setAttribute("align", "center");
+                cell.setAttribute('align', 'center');
                 for (var e in elements) {
-                    if (elements[e].position.row == r && elements[e].position.cell == c) {
-                        var htmlElement = document.createElement(elements[e].tag);
+                    if (
+                        elements[e].position.row === r &&
+                        elements[e].position.cell === c
+                    ) {
+                        var htmlElement = document.createElement(
+                            elements[e].tag
+                        );
                         var content;
 
-                        if (elements[e].content !== "") {
-                            content = document.createTextNode(elements[e].content);
+                        if (elements[e].content !== '') {
+                            content = document.createTextNode(
+                                elements[e].content
+                            );
                             htmlElement.appendChild(content);
                         }
                         if (elements[e].type) {
                             htmlElement.type = elements[e].type;
                         }
-                        htmlElement.setAttribute("id", elements[e].id);
+                        htmlElement.setAttribute('id', elements[e].id);
                         cell.appendChild(htmlElement);
                     }
                 }
             }
         }
-        table.setAttribute("align", "center");
-        table.setAttribute("id", tableId);
+        table.setAttribute('align', 'center');
+        table.setAttribute('id', tableId);
         return table;
     }
 
-//Audio && Record Elements
-    var elementsResultsAudio=
-    [{
-            id : "statusTag",
-            content : "Status:",
-            tag : "div",
-            position : {
-                row : 0,
-                cell : 0
+    // Audio && Record Elements
+    var elementsResultsAudio = [
+        {
+            id: 'statusTag',
+            content: 'Status:',
+            tag: 'div',
+            position: {
+                row: 0,
+                cell: 0
             }
-        }, {
-            id : "statusValue",
-            content : "",
-            tag : "div",
-            position : {
-                row : 0,
-                cell : 2
+        },
+        {
+            id: 'statusValue',
+            content: '',
+            tag: 'div',
+            position: {
+                row: 0,
+                cell: 2
             }
-        }, {
-            id : "durationTag",
-            content : "Duration:",
-            tag : "div",
-            position : {
-                row : 1,
-                cell : 0
+        },
+        {
+            id: 'durationTag',
+            content: 'Duration:',
+            tag: 'div',
+            position: {
+                row: 1,
+                cell: 0
             }
-        }, {
-            id : "durationValue",
-            content : "",
-            tag : "div",
-            position : {
-                row : 1,
-                cell : 2
+        },
+        {
+            id: 'durationValue',
+            content: '',
+            tag: 'div',
+            position: {
+                row: 1,
+                cell: 2
             }
-        }, {
-            id : "positionTag",
-            content : "Position:",
-            tag : "div",
-            position : {
-                row : 2,
-                cell : 0
+        },
+        {
+            id: 'positionTag',
+            content: 'Position:',
+            tag: 'div',
+            position: {
+                row: 2,
+                cell: 0
             }
-        }, {
-            id : "positionValue",
-            content : "",
-            tag : "div",
-            position : {
-                row : 2,
-                cell : 2
+        },
+        {
+            id: 'positionValue',
+            content: '',
+            tag: 'div',
+            position: {
+                row: 2,
+                cell: 2
             }
-        }],
-        elementsAudio =
-        [{
-            id : "playBtn",
-            content : "",
-            tag : "div",
-            position : {
-                row : 0,
-                cell : 0
+        }
+    ];
+    var elementsAudio = [
+        {
+            id: 'playBtn',
+            content: '',
+            tag: 'div',
+            position: {
+                row: 0,
+                cell: 0
             }
-        }, {
-            id : "pauseBtn",
-            content : "",
-            tag : "div",
-            position : {
-                row : 0,
-                cell : 1
+        },
+        {
+            id: 'pauseBtn',
+            content: '',
+            tag: 'div',
+            position: {
+                row: 0,
+                cell: 1
             }
-        }, {
-            id : "stopBtn",
-            content : "",
-            tag : "div",
-            position : {
-                row : 1,
-                cell : 0
+        },
+        {
+            id: 'stopBtn',
+            content: '',
+            tag: 'div',
+            position: {
+                row: 1,
+                cell: 0
             }
-        }, {
-            id : "releaseBtn",
-            content : "",
-            tag : "div",
-            position : {
-                row : 1,
-                cell : 1
+        },
+        {
+            id: 'releaseBtn',
+            content: '',
+            tag: 'div',
+            position: {
+                row: 1,
+                cell: 1
             }
-        }, {
-            id : "seekByBtn",
-            content : "",
-            tag : "div",
-            position : {
-                row : 2,
-                cell : 0
+        },
+        {
+            id: 'seekByBtn',
+            content: '',
+            tag: 'div',
+            position: {
+                row: 2,
+                cell: 0
             }
-        }, {
-            id : "seekToBtn",
-            content : "",
-            tag : "div",
-            position : {
-                row : 2,
-                cell : 1
+        },
+        {
+            id: 'seekToBtn',
+            content: '',
+            tag: 'div',
+            position: {
+                row: 2,
+                cell: 1
             }
-        }, {
-            id : "seekInput",
-            content : "",
-            tag : "input",
-            type : "number",
-            position : {
-                row : 2,
-                cell : 2
+        },
+        {
+            id: 'seekInput',
+            content: '',
+            tag: 'input',
+            type: 'number',
+            position: {
+                row: 2,
+                cell: 2
             }
-        }, {
-            id: "halfSpeedBtn",
-            content:"",
-            tag:"div",
-            position:{
-                row:0,
-                cell:2
+        },
+        {
+            id: 'halfSpeedBtn',
+            content: '',
+            tag: 'div',
+            position: {
+                row: 0,
+                cell: 2
             }
         },
-         {
-            id: "setVolumeBtn",
-            content: "",
-            tag: "div",
+        {
+            id: 'setVolumeBtn',
+            content: '',
+            tag: 'div',
             position: {
                 row: 3,
                 cell: 0
             }
         },
         {
-            id: "volumeInput",
-            tag: "input",
-            type: "text",
+            id: 'volumeInput',
+            tag: 'input',
+            type: 'text',
             position: {
                 row: 3,
                 cell: 1
             }
         }
-    ],
-    elementsRecord =
-        [{
-            id : "recordbtn",
-            content : "",
-            tag : "div",
-            position : {
-                row : 1,
-                cell : 0
+    ];
+    var elementsRecord = [
+        {
+            id: 'recordbtn',
+            content: '',
+            tag: 'div',
+            position: {
+                row: 1,
+                cell: 0
             }
-        }, {
-            id : "recordplayBtn",
-            content : "",
-            tag : "div",
-            position : {
-                row : 1,
-                cell : 1
+        },
+        {
+            id: 'recordplayBtn',
+            content: '',
+            tag: 'div',
+            position: {
+                row: 1,
+                cell: 1
             }
-        }, {
-            id : "recordpauseBtn",
-            content : "",
-            tag : "div",
-            position : {
-                row : 2,
-                cell : 0
+        },
+        {
+            id: 'recordpauseBtn',
+            content: '',
+            tag: 'div',
+            position: {
+                row: 2,
+                cell: 0
             }
-        }, {
-            id : "recordstopBtn",
-            content : "",
-            tag : "div",
-            position : {
-                row : 2,
-                cell : 1
+        },
+        {
+            id: 'recordstopBtn',
+            content: '',
+            tag: 'div',
+            position: {
+                row: 2,
+                cell: 1
             }
         }
     ];
 
-    //Title audio results
+    // Title audio results
     var div = document.createElement('h2');
     div.appendChild(document.createTextNode('Audio'));
-    div.setAttribute("align", "center");
+    div.setAttribute('align', 'center');
     contentEl.appendChild(div);
-    //Generate and add results table
+    // Generate and add results table
     contentEl.appendChild(generateTable('info', 3, 3, elementsResultsAudio));
 
-    //Title audio actions
+    // Title audio actions
     div = document.createElement('h2');
     div.appendChild(document.createTextNode('Actions'));
-    div.setAttribute("align", "center");
+    div.setAttribute('align', 'center');
     contentEl.appendChild(div);
-    //Generate and add buttons table
+    // Generate and add buttons table
     contentEl.appendChild(generateTable('audioActions', 4, 3, elementsAudio));
-    createActionButton('Play', function () {
-        playAudio();
-    }, 'playBtn');
-    createActionButton('Pause', function () {
-        pauseAudio();
-    }, 'pauseBtn');
-    createActionButton('HalfSpeed', function() {
-        if(halfSpeedBtn.firstChild.firstChild.innerText == 'HalfSpeed') {
-            halfSpeedBtn.firstChild.firstChild.innerText = 'FullSpeed';
-            media1.setRate(0.5);
-        }
-        else if(halfSpeedBtn.firstChild.firstChild.innerText == 'FullSpeed') {
-            halfSpeedBtn.firstChild.firstChild.innerText = 'DoubleSpeed';
-            media1.setRate(1.0);
-        }
-        else {
-            halfSpeedBtn.firstChild.firstChild.innerText = 'HalfSpeed';
-            media1.setRate(2.0);
-        }
-    }, 'halfSpeedBtn');
-    createActionButton('Stop', function () {
-        stopAudio();
-    }, 'stopBtn');
-    createActionButton('Release', function () {
-        releaseAudio();
-    }, 'releaseBtn');
-    createActionButton('Seek By', function () {
-        seekAudio('by');
-    }, 'seekByBtn');
-    createActionButton('Seek To', function () {
-        seekAudio('to');
-    }, 'seekToBtn');
-    createActionButton('Set volume', function() {
-        setVolume();
-    }, 'setVolumeBtn');
-    //get Special path to record if iOS || Blackberry
-    if (cordova.platformId === 'ios')
+    createActionButton(
+        'Play',
+        function () {
+            playAudio();
+        },
+        'playBtn'
+    );
+    createActionButton(
+        'Pause',
+        function () {
+            pauseAudio();
+        },
+        'pauseBtn'
+    );
+    createActionButton(
+        'HalfSpeed',
+        function () {
+            if (halfSpeedBtn.firstChild.firstChild.innerText === 'HalfSpeed') {
+                halfSpeedBtn.firstChild.firstChild.innerText = 'FullSpeed';
+                media1.setRate(0.5);
+            } else if (
+                halfSpeedBtn.firstChild.firstChild.innerText === 'FullSpeed'
+            ) {
+                halfSpeedBtn.firstChild.firstChild.innerText = 'DoubleSpeed';
+                media1.setRate(1.0);
+            } else {
+                halfSpeedBtn.firstChild.firstChild.innerText = 'HalfSpeed';
+                media1.setRate(2.0);
+            }
+        },
+        'halfSpeedBtn'
+    );
+    createActionButton(
+        'Stop',
+        function () {
+            stopAudio();
+        },
+        'stopBtn'
+    );
+    createActionButton(
+        'Release',
+        function () {
+            releaseAudio();
+        },
+        'releaseBtn'
+    );
+    createActionButton(
+        'Seek By',
+        function () {
+            seekAudio('by');
+        },
+        'seekByBtn'
+    );
+    createActionButton(
+        'Seek To',
+        function () {
+            seekAudio('to');
+        },
+        'seekToBtn'
+    );
+    createActionButton(
+        'Set volume',
+        function () {
+            setVolume();
+        },
+        'setVolumeBtn'
+    );
+    // get Special path to record if iOS || Blackberry
+    if (cordova.platformId === 'ios') {
         getRecordSrc();
-    else if (cordova.platformId === 'blackberry')
+    } else if (cordova.platformId === 'blackberry') {
         getRecordSrcBB();
-    else if (cordova.platformId === 'windows' || cordova.platformId === 'windows8')
+    } else if (
+        cordova.platformId === 'windows' ||
+        cordova.platformId === 'windows8'
+    ) {
         getRecordSrcWin();
+    }
 
-    //testing process and details
-    function addItemToList(_list, _text)
-    {
+    // testing process and details
+    function addItemToList (_list, _text) {
         var item = document.createElement('li');
         item.appendChild(document.createTextNode(_text));
         _list.appendChild(item);
@@ -1111,63 +1357,136 @@ exports.defineManualTests = function (contentEl, createActionButton) {
     contentEl.appendChild(div);
 
     var list = document.createElement('ol');
-    addItemToList(list, 'Press play - Will start playing audio. Status: Running, Duration: 61.333 sec, Position: Current position of audio track');
-    addItemToList(list, 'Press pause - Will pause the audio. Status: Paused, Duration: 61.333 sec, Position: Position where track was paused');
-    addItemToList(list, 'Press play - Will begin playing where track left off from the pause');
-    addItemToList(list, 'Press stop - Will stop the audio. Status: Stopped, Duration: 61.333 sec, Position: 0 sec');
-    addItemToList(list, 'Press play - Will begin playing the audio track from the beginning');
-    addItemToList(list, 'Press release - Will stop the audio. Status: Stopped, Duration: 61.333 sec, Position: 0 sec');
-    addItemToList(list, 'Press play - Will begin playing the audio track from the beginning');
+    addItemToList(
+        list,
+        'Press play - Will start playing audio. Status: Running, Duration: 61.333 sec, Position: Current position of audio track'
+    );
+    addItemToList(
+        list,
+        'Press pause - Will pause the audio. Status: Paused, Duration: 61.333 sec, Position: Position where track was paused'
+    );
+    addItemToList(
+        list,
+        'Press play - Will begin playing where track left off from the pause'
+    );
+    addItemToList(
+        list,
+        'Press stop - Will stop the audio. Status: Stopped, Duration: 61.333 sec, Position: 0 sec'
+    );
+    addItemToList(
+        list,
+        'Press play - Will begin playing the audio track from the beginning'
+    );
+    addItemToList(
+        list,
+        'Press release - Will stop the audio. Status: Stopped, Duration: 61.333 sec, Position: 0 sec'
+    );
+    addItemToList(
+        list,
+        'Press play - Will begin playing the audio track from the beginning'
+    );
     addItemToList(list, 'Type 10 in the text box beside Seek To button');
-    addItemToList(list, 'Press seek by - Will jump 10 seconds ahead in the audio track. Position: should jump by 10 sec');
+    addItemToList(
+        list,
+        'Press seek by - Will jump 10 seconds ahead in the audio track. Position: should jump by 10 sec'
+    );
     addItemToList(list, 'Press stop if track is not already stopped');
     addItemToList(list, 'Type 30 in the text box beside Seek To button');
-    addItemToList(list, 'Press play then seek to - Should jump to Position 30 sec');
+    addItemToList(
+        list,
+        'Press play then seek to - Should jump to Position 30 sec'
+    );
     addItemToList(list, 'Press stop');
     addItemToList(list, 'Type 5 in the text box beside Seek To button');
-    addItemToList(list, 'Press play, let play past 10 seconds then press seek to - should jump back to position 5 sec');
+    addItemToList(
+        list,
+        'Press play, let play past 10 seconds then press seek to - should jump back to position 5 sec'
+    );
 
     div = document.createElement('div');
-    div.setAttribute("style", "background:#B0C4DE;border:1px solid #FFA07A;margin:15px 6px 0px;min-width:295px;max-width:97%;padding:4px 0px 2px 10px;min-height:160px;max-height:200px;overflow:auto");
+    div.setAttribute(
+        'style',
+        'background:#B0C4DE;border:1px solid #FFA07A;margin:15px 6px 0px;min-width:295px;max-width:97%;padding:4px 0px 2px 10px;min-height:160px;max-height:200px;overflow:auto'
+    );
     div.appendChild(list);
     contentEl.appendChild(div);
 
-    //Title Record Audio
+    // Title Record Audio
     div = document.createElement('h2');
     div.appendChild(document.createTextNode('Record Audio'));
-    div.setAttribute("align", "center");
+    div.setAttribute('align', 'center');
     contentEl.appendChild(div);
-    //Generate and add Record buttons table
+    // Generate and add Record buttons table
     contentEl.appendChild(generateTable('recordContent', 3, 3, elementsRecord));
-    createActionButton('Record Audio \n 10 sec', function () {
-        recordAudio();
-    }, 'recordbtn');
-    createActionButton('Play', function () {
-        playRecording();
-    }, 'recordplayBtn');
-    createActionButton('Pause', function () {
-        pauseAudio();
-    }, 'recordpauseBtn');
-    createActionButton('Stop', function () {
-        stopAudio();
-    }, 'recordstopBtn');
-
-    //testing process and details
+    createActionButton(
+        'Record Audio \n 10 sec',
+        function () {
+            recordAudio();
+        },
+        'recordbtn'
+    );
+    createActionButton(
+        'Play',
+        function () {
+            playRecording();
+        },
+        'recordplayBtn'
+    );
+    createActionButton(
+        'Pause',
+        function () {
+            pauseAudio();
+        },
+        'recordpauseBtn'
+    );
+    createActionButton(
+        'Stop',
+        function () {
+            stopAudio();
+        },
+        'recordstopBtn'
+    );
+
+    // testing process and details
     div = document.createElement('h4');
     div.appendChild(document.createTextNode('Recommended Test Procedure'));
     contentEl.appendChild(div);
 
     list = document.createElement('ol');
-    addItemToList(list, 'Press Record Audio 10 sec - Will start recording audio for 10 seconds. Status: Running, Position: number of seconds recorded (will stop at 10)');
-    addItemToList(list, 'Status will change to Stopped when finished recording');
-    addItemToList(list, 'Press play - Will begin playing the recording. Status: Running, Duration: # of seconds of recording, Position: Current position of recording');
-    addItemToList(list, 'Press stop - Will stop playing the recording. Status: Stopped, Duration: # of seconds of recording, Position: 0 sec');
-    addItemToList(list, 'Press play - Will begin playing the recording from the beginning');
-    addItemToList(list, 'Press pause - Will pause the playback of the recording. Status: Paused, Duration: # of seconds of recording, Position: Position where recording was paused');
-    addItemToList(list, 'Press play - Will begin playing the recording from where it was paused');
+    addItemToList(
+        list,
+        'Press Record Audio 10 sec - Will start recording audio for 10 seconds. Status: Running, Position: number of seconds recorded (will stop at 10)'
+    );
+    addItemToList(
+        list,
+        'Status will change to Stopped when finished recording'
+    );
+    addItemToList(
+        list,
+        'Press play - Will begin playing the recording. Status: Running, Duration: # of seconds of recording, Position: Current position of recording'
+    );
+    addItemToList(
+        list,
+        'Press stop - Will stop playing the recording. Status: Stopped, Duration: # of seconds of recording, Position: 0 sec'
+    );
+    addItemToList(
+        list,
+        'Press play - Will begin playing the recording from the beginning'
+    );
+    addItemToList(
+        list,
+        'Press pause - Will pause the playback of the recording. Status: Paused, Duration: # of seconds of recording, Position: Position where recording was paused'
+    );
+    addItemToList(
+        list,
+        'Press play - Will begin playing the recording from where it was paused'
+    );
 
     div = document.createElement('div');
-    div.setAttribute("style", "background:#B0C4DE;border:1px solid #FFA07A;margin:15px 6px 0px;min-width:295px;max-width:97%;padding:4px 0px 2px 10px;min-height:160px;max-height:200px;overflow:auto");
+    div.setAttribute(
+        'style',
+        'background:#B0C4DE;border:1px solid #FFA07A;margin:15px 6px 0px;min-width:295px;max-width:97%;padding:4px 0px 2px 10px;min-height:160px;max-height:200px;overflow:auto'
+    );
     div.appendChild(list);
     contentEl.appendChild(div);
 };
diff --git a/www/Media.js b/www/Media.js
index 8a3d4ae..ff7af44 100644
--- a/www/Media.js
+++ b/www/Media.js
@@ -17,11 +17,13 @@
  * specific language governing permissions and limitations
  * under the License.
  *
-*/
+ */
+
+/* global cordova */
 
-var argscheck = require('cordova/argscheck'),
-    utils = require('cordova/utils'),
-    exec = require('cordova/exec');
+var argscheck = require('cordova/argscheck');
+var utils = require('cordova/utils');
+var exec = require('cordova/exec');
 
 var mediaObjects = {};
 
@@ -37,7 +39,7 @@ var mediaObjects = {};
  * @param statusCallback        The callback to be called when media status has changed.
  *                                  statusCallback(int statusCode) - OPTIONAL
  */
-var Media = function(src, successCallback, errorCallback, statusCallback) {
+var Media = function (src, successCallback, errorCallback, statusCallback) {
     argscheck.checkArgs('sFFF', 'Media', arguments);
     this.id = utils.createUUID();
     mediaObjects[this.id] = this;
@@ -47,7 +49,7 @@ var Media = function(src, successCallback, errorCallback, statusCallback) {
     this.statusCallback = statusCallback;
     this._duration = -1;
     this._position = -1;
-    exec(null, this.errorCallback, "Media", "create", [this.id, this.src]);
+    exec(null, this.errorCallback, 'Media', 'create', [this.id, this.src]);
 };
 
 // Media messages
@@ -62,45 +64,61 @@ Media.MEDIA_STARTING = 1;
 Media.MEDIA_RUNNING = 2;
 Media.MEDIA_PAUSED = 3;
 Media.MEDIA_STOPPED = 4;
-Media.MEDIA_MSG = ["None", "Starting", "Running", "Paused", "Stopped"];
+Media.MEDIA_MSG = ['None', 'Starting', 'Running', 'Paused', 'Stopped'];
 
 // "static" function to return existing objs.
-Media.get = function(id) {
+Media.get = function (id) {
     return mediaObjects[id];
 };
 
 /**
  * Start or resume playing audio file.
  */
-Media.prototype.play = function(options) {
-    exec(null, null, "Media", "startPlayingAudio", [this.id, this.src, options]);
+Media.prototype.play = function (options) {
+    exec(null, null, 'Media', 'startPlayingAudio', [
+        this.id,
+        this.src,
+        options
+    ]);
 };
 
 /**
  * Stop playing audio file.
  */
-Media.prototype.stop = function() {
+Media.prototype.stop = function () {
     var me = this;
-    exec(function() {
-        me._position = 0;
-    }, this.errorCallback, "Media", "stopPlayingAudio", [this.id]);
+    exec(
+        function () {
+            me._position = 0;
+        },
+        this.errorCallback,
+        'Media',
+        'stopPlayingAudio',
+        [this.id]
+    );
 };
 
 /**
  * Seek or jump to a new time in the track..
  */
-Media.prototype.seekTo = function(milliseconds) {
+Media.prototype.seekTo = function (milliseconds) {
     var me = this;
-    exec(function(p) {
-        me._position = p;
-    }, this.errorCallback, "Media", "seekToAudio", [this.id, milliseconds]);
+    exec(
+        function (p) {
+            me._position = p;
+        },
+        this.errorCallback,
+        'Media',
+        'seekToAudio',
+        [this.id, milliseconds]
+    );
 };
 
 /**
  * Pause playing audio file.
  */
-Media.prototype.pause = function() {
-    exec(null, this.errorCallback, "Media", "pausePlayingAudio", [this.id]);
+Media.prototype.pause = function () {
+    exec(null, this.errorCallback, 'Media', 'pausePlayingAudio', [this.id]);
 };
 
 /**
@@ -109,84 +127,109 @@ Media.prototype.pause = function() {
  *
  * @return      duration or -1 if not known.
  */
-Media.prototype.getDuration = function() {
+Media.prototype.getDuration = function () {
     return this._duration;
 };
 
 /**
  * Get position of audio.
  */
-Media.prototype.getCurrentPosition = function(success, fail) {
+Media.prototype.getCurrentPosition = function (success, fail) {
     var me = this;
-    exec(function(p) {
-        me._position = p;
-        success(p);
-    }, fail, "Media", "getCurrentPositionAudio", [this.id]);
+    exec(
+        function (p) {
+            me._position = p;
+            success(p);
+        },
+        fail,
+        'Media',
+        'getCurrentPositionAudio',
+        [this.id]
+    );
 };
 
 /**
  * Start recording audio file.
  */
-Media.prototype.startRecord = function() {
-    exec(null, this.errorCallback, "Media", "startRecordingAudio", [this.id, this.src]);
+Media.prototype.startRecord = function () {
+    exec(null, this.errorCallback, 'Media', 'startRecordingAudio', [
+        this.id,
+        this.src
+    ]);
 };
 
 /**
  * Stop recording audio file.
  */
-Media.prototype.stopRecord = function() {
-    exec(null, this.errorCallback, "Media", "stopRecordingAudio", [this.id]);
+Media.prototype.stopRecord = function () {
+    exec(null, this.errorCallback, 'Media', 'stopRecordingAudio', [this.id]);
 };
 
 /**
  * Pause recording audio file.
  */
-Media.prototype.pauseRecord = function() {
-    exec(null, this.errorCallback, "Media", "pauseRecordingAudio", [this.id]);
+Media.prototype.pauseRecord = function () {
+    exec(null, this.errorCallback, 'Media', 'pauseRecordingAudio', [this.id]);
 };
 
 /**
-* Resume recording audio file.
-*/
-Media.prototype.resumeRecord = function() {
-    exec(null, this.errorCallback, "Media", "resumeRecordingAudio", [this.id]);
+ * Resume recording audio file.
+ */
+Media.prototype.resumeRecord = function () {
+    exec(null, this.errorCallback, 'Media', 'resumeRecordingAudio', [this.id]);
 };
 
 /**
  * Release the resources.
  */
-Media.prototype.release = function() {
+Media.prototype.release = function () {
     var me = this;
-    exec(function() {
-      delete mediaObjects[me.id];
-    }, this.errorCallback, "Media", "release", [this.id]);
+    exec(
+        function () {
+            delete mediaObjects[me.id];
+        },
+        this.errorCallback,
+        'Media',
+        'release',
+        [this.id]
+    );
 };
 
 /**
  * Adjust the volume.
  */
-Media.prototype.setVolume = function(volume) {
-    exec(null, null, "Media", "setVolume", [this.id, volume]);
+Media.prototype.setVolume = function (volume) {
+    exec(null, null, 'Media', 'setVolume', [this.id, volume]);
 };
 
 /**
  * Adjust the playback rate.
  */
-Media.prototype.setRate = function(rate) {
-    if (cordova.platformId === 'ios'){
-        exec(null, null, "Media", "setRate", [this.id, rate]);
+Media.prototype.setRate = function (rate) {
+    if (cordova.platformId === 'ios') {
+        exec(null, null, 'Media', 'setRate', [this.id, rate]);
     } else {
-        console.warn('media.setRate method is currently not supported for', cordova.platformId, 'platform.');
+        console.warn(
+            'media.setRate method is currently not supported for',
+            cordova.platformId,
+            'platform.'
+        );
     }
 };
 
 /**
  * Get amplitude of audio.
  */
-Media.prototype.getCurrentAmplitude = function(success, fail) {
-    exec(function(p) {
-        success(p);
-    }, fail, "Media", "getCurrentAmplitudeAudio", [this.id]);
+Media.prototype.getCurrentAmplitude = function (success, fail) {
+    exec(
+        function (p) {
+            success(p);
+        },
+        fail,
+        'Media',
+        'getCurrentAmplitudeAudio',
+        [this.id]
+    );
 };
 
 /**
@@ -197,63 +240,66 @@ Media.prototype.getCurrentAmplitude = function(success, fail) {
  * @param msgType       The 'type' of update this is
  * @param value         Use of value is determined by the msgType
  */
-Media.onStatus = function(id, msgType, value) {
-
+Media.onStatus = function (id, msgType, value) {
     var media = mediaObjects[id];
 
     if (media) {
-        switch(msgType) {
-            case Media.MEDIA_STATE :
-                if (media.statusCallback) {
-                    media.statusCallback(value);
-                }
-                if (value == Media.MEDIA_STOPPED) {
-                    if (media.successCallback) {
-                        media.successCallback();
-                    }
+        switch (msgType) {
+        case Media.MEDIA_STATE:
+            if (media.statusCallback) {
+                media.statusCallback(value);
+            }
+            if (value === Media.MEDIA_STOPPED) {
+                if (media.successCallback) {
+                    media.successCallback();
                 }
-                break;
-            case Media.MEDIA_DURATION :
-                media._duration = value;
-                break;
-            case Media.MEDIA_ERROR :
-                if (media.errorCallback) {
-                    media.errorCallback(value);
-                }
-                break;
-            case Media.MEDIA_POSITION :
-                media._position = Number(value);
-                break;
-            default :
-                if (console.error) {
-                    console.error("Unhandled Media.onStatus :: " + msgType);
-                }
-                break;
+            }
+            break;
+        case Media.MEDIA_DURATION:
+            media._duration = value;
+            break;
+        case Media.MEDIA_ERROR:
+            if (media.errorCallback) {
+                media.errorCallback(value);
+            }
+            break;
+        case Media.MEDIA_POSITION:
+            media._position = Number(value);
+            break;
+        default:
+            if (console.error) {
+                console.error('Unhandled Media.onStatus :: ' + msgType);
+            }
+            break;
         }
     } else if (console.error) {
-        console.error("Received Media.onStatus callback for unknown media :: " + id);
+        console.error(
+            'Received Media.onStatus callback for unknown media :: ' + id
+        );
     }
-
 };
 
 module.exports = Media;
 
-function onMessageFromNative(msg) {
-    if (msg.action == 'status') {
+function onMessageFromNative (msg) {
+    if (msg.action === 'status') {
         Media.onStatus(msg.status.id, msg.status.msgType, msg.status.value);
     } else {
         throw new Error('Unknown media action' + msg.action);
     }
 }
 
-if (cordova.platformId === 'android' || cordova.platformId === 'amazon-fireos' || cordova.platformId === 'windowsphone') {
-
+if (
+    cordova.platformId === 'android' ||
+    cordova.platformId === 'amazon-fireos' ||
+    cordova.platformId === 'windowsphone'
+) {
     var channel = require('cordova/channel');
 
     channel.createSticky('onMediaPluginReady');
     channel.waitForInitialization('onMediaPluginReady');
 
-    channel.onCordovaReady.subscribe(function() {
+    channel.onCordovaReady.subscribe(function () {
         exec(onMessageFromNative, undefined, 'Media', 'messageChannel', []);
         channel.initializationComplete('onMediaPluginReady');
     });
diff --git a/www/MediaError.js b/www/MediaError.js
index 38002ac..aada83a 100644
--- a/www/MediaError.js
+++ b/www/MediaError.js
@@ -17,11 +17,11 @@
  * specific language governing permissions and limitations
  * under the License.
  *
-*/
+ */
 
 /**
  * This class contains information about any Media errors.
-*/
+ */
 /*
  According to :: http://dev.w3.org/html5/spec-author-view/video.html#mediaerror
  We should never be creating these objects, we should just implement the interface
@@ -33,23 +33,24 @@ we should simply use a literal :
     errorCallbackFunction( {'code':3} );
  */
 
- var _MediaError = window.MediaError;
-
+var _MediaError = window.MediaError;
 
-if(!_MediaError) {
-    window.MediaError = _MediaError = function(code, msg) {
-        this.code = (typeof code != 'undefined') ? code : null;
-        this.message = msg || ""; // message is NON-standard! do not use!
+if (!_MediaError) {
+    window.MediaError = _MediaError = function (code, msg) {
+        this.code = typeof code !== 'undefined' ? code : null;
+        this.message = msg || ''; // message is NON-standard! do not use!
     };
 }
 
-_MediaError.MEDIA_ERR_NONE_ACTIVE    = _MediaError.MEDIA_ERR_NONE_ACTIVE    || 0;
-_MediaError.MEDIA_ERR_ABORTED        = _MediaError.MEDIA_ERR_ABORTED        || 1;
-_MediaError.MEDIA_ERR_NETWORK        = _MediaError.MEDIA_ERR_NETWORK        || 2;
-_MediaError.MEDIA_ERR_DECODE         = _MediaError.MEDIA_ERR_DECODE         || 3;
-_MediaError.MEDIA_ERR_NONE_SUPPORTED = _MediaError.MEDIA_ERR_NONE_SUPPORTED || 4;
+_MediaError.MEDIA_ERR_NONE_ACTIVE = _MediaError.MEDIA_ERR_NONE_ACTIVE || 0;
+_MediaError.MEDIA_ERR_ABORTED = _MediaError.MEDIA_ERR_ABORTED || 1;
+_MediaError.MEDIA_ERR_NETWORK = _MediaError.MEDIA_ERR_NETWORK || 2;
+_MediaError.MEDIA_ERR_DECODE = _MediaError.MEDIA_ERR_DECODE || 3;
+_MediaError.MEDIA_ERR_NONE_SUPPORTED =
+    _MediaError.MEDIA_ERR_NONE_SUPPORTED || 4;
 // TODO: MediaError.MEDIA_ERR_NONE_SUPPORTED is legacy, the W3 spec now defines it as below.
 // as defined by http://dev.w3.org/html5/spec-author-view/video.html#error-codes
-_MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED = _MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED || 4;
+_MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED =
+    _MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED || 4;
 
 module.exports = _MediaError;
diff --git a/www/browser/Media.js b/www/browser/Media.js
index 633e425..726f630 100644
--- a/www/browser/Media.js
+++ b/www/browser/Media.js
@@ -17,12 +17,12 @@
  * specific language governing permissions and limitations
  * under the License.
  *
-*/
+ */
 
 /* global MediaError */
 
-var argscheck = require('cordova/argscheck'),
-    utils = require('cordova/utils');
+var argscheck = require('cordova/argscheck');
+var utils = require('cordova/utils');
 
 var mediaObjects = {};
 
@@ -38,7 +38,7 @@ var mediaObjects = {};
  * @param statusCallback        The callback to be called when media status has changed.
  *                                  statusCallback(int statusCode) - OPTIONAL
  */
-var Media = function(src, successCallback, errorCallback, statusCallback) {
+var Media = function (src, successCallback, errorCallback, statusCallback) {
     argscheck.checkArgs('SFFF', 'Media', arguments);
     this.id = utils.createUUID();
     mediaObjects[this.id] = this;
@@ -52,14 +52,16 @@ var Media = function(src, successCallback, errorCallback, statusCallback) {
     try {
         this.node = createNode(this);
     } catch (err) {
-        Media.onStatus(this.id, Media.MEDIA_ERROR, { code: MediaError.MEDIA_ERR_ABORTED });
+        Media.onStatus(this.id, Media.MEDIA_ERROR, {
+            code: MediaError.MEDIA_ERR_ABORTED
+        });
     }
 };
 
 /**
  * Creates new Audio node and with necessary event listeners attached
  * @param  {Media} media Media object
- * @return {Audio}       Audio element 
+ * @return {Audio}       Audio element
  */
 function createNode (media) {
     var node = new Audio();
@@ -78,9 +80,10 @@ function createNode (media) {
 
     node.onerror = function (e) {
         // Due to media.spec.15 It should return MediaError for bad filename
-        var err = e.target.error.code === MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED ?
-            { code: MediaError.MEDIA_ERR_ABORTED } :
-            e.target.error;
+        var err =
+            e.target.error.code === MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED
+                ? { code: MediaError.MEDIA_ERR_ABORTED }
+                : e.target.error;
 
         Media.onStatus(media.id, Media.MEDIA_ERROR, err);
     };
@@ -108,19 +111,20 @@ Media.MEDIA_STARTING = 1;
 Media.MEDIA_RUNNING = 2;
 Media.MEDIA_PAUSED = 3;
 Media.MEDIA_STOPPED = 4;
-Media.MEDIA_MSG = ["None", "Starting", "Running", "Paused", "Stopped"];
+Media.MEDIA_MSG = ['None', 'Starting', 'Running', 'Paused', 'Stopped'];
 
 /**
  * Start or resume playing audio file.
  */
-Media.prototype.play = function() {
-
+Media.prototype.play = function () {
     // if Media was released, then node will be null and we need to create it again
     if (!this.node) {
         try {
             this.node = createNode(this);
         } catch (err) {
-            Media.onStatus(this.id, Media.MEDIA_ERROR, { code: MediaError.MEDIA_ERR_ABORTED });
+            Media.onStatus(this.id, Media.MEDIA_ERROR, {
+                code: MediaError.MEDIA_ERR_ABORTED
+            });
         }
     }
 
@@ -130,7 +134,7 @@ Media.prototype.play = function() {
 /**
  * Stop playing audio file.
  */
-Media.prototype.stop = function() {
+Media.prototype.stop = function () {
     try {
         this.pause();
         this.seekTo(0);
@@ -143,7 +147,7 @@ Media.prototype.stop = function() {
 /**
  * Seek or jump to a new time in the track..
  */
-Media.prototype.seekTo = function(milliseconds) {
+Media.prototype.seekTo = function (milliseconds) {
     try {
         this.node.currentTime = milliseconds / 1000;
     } catch (err) {
@@ -154,13 +158,14 @@ Media.prototype.seekTo = function(milliseconds) {
 /**
  * Pause playing audio file.
  */
-Media.prototype.pause = function() {
+Media.prototype.pause = function () {
     try {
         this.node.pause();
         Media.onStatus(this.id, Media.MEDIA_STATE, Media.MEDIA_PAUSED);
     } catch (err) {
         Media.onStatus(this.id, Media.MEDIA_ERROR, err);
-    }};
+    }
+};
 
 /**
  * Get duration of an audio file.
@@ -168,14 +173,14 @@ Media.prototype.pause = function() {
  *
  * @return      duration or -1 if not known.
  */
-Media.prototype.getDuration = function() {
+Media.prototype.getDuration = function () {
     return this._duration;
 };
 
 /**
  * Get position of audio.
  */
-Media.prototype.getCurrentPosition = function(success, fail) {
+Media.prototype.getCurrentPosition = function (success, fail) {
     try {
         var p = this.node.currentTime;
         Media.onStatus(this.id, Media.MEDIA_POSITION, p);
@@ -188,59 +193,60 @@ Media.prototype.getCurrentPosition = function(success, fail) {
 /**
  * Start recording audio file.
  */
-Media.prototype.startRecord = function() {
-    Media.onStatus(this.id, Media.MEDIA_ERROR, "Not supported");
+Media.prototype.startRecord = function () {
+    Media.onStatus(this.id, Media.MEDIA_ERROR, 'Not supported');
 };
 
 /**
  * Stop recording audio file.
  */
-Media.prototype.stopRecord = function() {
-    Media.onStatus(this.id, Media.MEDIA_ERROR, "Not supported");
+Media.prototype.stopRecord = function () {
+    Media.onStatus(this.id, Media.MEDIA_ERROR, 'Not supported');
 };
 
 /**
  * Pause recording audio file.
  */
-Media.prototype.pauseRecord = function() {
-    Media.onStatus(this.id, Media.MEDIA_ERROR, "Not supported");
+Media.prototype.pauseRecord = function () {
+    Media.onStatus(this.id, Media.MEDIA_ERROR, 'Not supported');
 };
 
 /**
  * Returns the current amplitude of the current recording.
  */
-Media.prototype.getCurrentAmplitude = function() {
-    Media.onStatus(this.id, Media.MEDIA_ERROR, "Not supported");
+Media.prototype.getCurrentAmplitude = function () {
+    Media.onStatus(this.id, Media.MEDIA_ERROR, 'Not supported');
 };
 
 /**
  * Resume recording an audio file.
  */
-Media.prototype.resumeRecord = function() {
-    Media.onStatus(this.id, Media.MEDIA_ERROR, "Not supported");
+Media.prototype.resumeRecord = function () {
+    Media.onStatus(this.id, Media.MEDIA_ERROR, 'Not supported');
 };
 
 /**
  * Set rate of an autio file.
  */
-Media.prototype.setRate = function() {
-    Media.onStatus(this.id, Media.MEDIA_ERROR, "Not supported");
+Media.prototype.setRate = function () {
+    Media.onStatus(this.id, Media.MEDIA_ERROR, 'Not supported');
 };
 
 /**
  * Release the resources.
  */
-Media.prototype.release = function() {
+Media.prototype.release = function () {
     try {
         delete this.node;
     } catch (err) {
         Media.onStatus(this.id, Media.MEDIA_ERROR, err);
-    }};
+    }
+};
 
 /**
  * Adjust the volume.
  */
-Media.prototype.setVolume = function(volume) {
+Media.prototype.setVolume = function (volume) {
     this.node.volume = volume;
 };
 
@@ -252,41 +258,42 @@ Media.prototype.setVolume = function(volume) {
  * @param msgType       The 'type' of update this is
  * @param value         Use of value is determined by the msgType
  */
-Media.onStatus = function(id, msgType, value) {
-
+Media.onStatus = function (id, msgType, value) {
     var media = mediaObjects[id];
 
     if (media) {
-        switch(msgType) {
-            case Media.MEDIA_STATE :
-                if (media.statusCallback) {
-                    media.statusCallback(value);
-                }
-                if (value === Media.MEDIA_STOPPED) {
-                    if (media.successCallback) {
-                        media.successCallback();
-                    }
-                }
-                break;
-            case Media.MEDIA_DURATION :
-                media._duration = value;
-                break;
-            case Media.MEDIA_ERROR :
-                if (media.errorCallback) {
-                    media.errorCallback(value);
-                }
-                break;
-            case Media.MEDIA_POSITION :
-                media._position = Number(value);
-                break;
-            default :
-                if (console.error) {
-                    console.error("Unhandled Media.onStatus :: " + msgType);
+        switch (msgType) {
+        case Media.MEDIA_STATE:
+            if (media.statusCallback) {
+                media.statusCallback(value);
+            }
+            if (value === Media.MEDIA_STOPPED) {
+                if (media.successCallback) {
+                    media.successCallback();
                 }
-                break;
+            }
+            break;
+        case Media.MEDIA_DURATION:
+            media._duration = value;
+            break;
+        case Media.MEDIA_ERROR:
+            if (media.errorCallback) {
+                media.errorCallback(value);
+            }
+            break;
+        case Media.MEDIA_POSITION:
+            media._position = Number(value);
+            break;
+        default:
+            if (console.error) {
+                console.error('Unhandled Media.onStatus :: ' + msgType);
+            }
+            break;
         }
     } else if (console.error) {
-        console.error("Received Media.onStatus callback for unknown media :: " + id);
+        console.error(
+            'Received Media.onStatus callback for unknown media :: ' + id
+        );
     }
 };
 


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