cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mwbro...@apache.org
Subject svn commit: r1449255 [21/34] - in /cordova/site/public/docs: en/1.5.0/ en/1.5.0rc1/ en/1.6.0/ en/1.6.0rc1/ en/1.6.1/ en/1.7.0/ en/1.7.0rc1/ en/1.8.0/ en/1.8.0rc1/ en/1.8.1/ en/1.9.0/ en/1.9.0rc1/ en/2.0.0/ en/2.0.0rc1/ en/2.1.0/ en/2.1.0rc1/ en/2.1.0rc...
Date Fri, 22 Feb 2013 23:43:56 GMT
Added: cordova/site/public/docs/en/2.5.0rc1/cordova_media_media.md.html
URL: http://svn.apache.org/viewvc/cordova/site/public/docs/en/2.5.0rc1/cordova_media_media.md.html?rev=1449255&view=auto
==============================================================================
--- cordova/site/public/docs/en/2.5.0rc1/cordova_media_media.md.html (added)
+++ cordova/site/public/docs/en/2.5.0rc1/cordova_media_media.md.html Fri Feb 22 23:42:47 2013
@@ -0,0 +1,1828 @@
+<!DOCTYPE html>
+<!--
+    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.
+--><html lang="en">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width">
+<meta name="generator" content="joDoc">
+<title>Apache Cordova API Documentation</title>
+<link rel="stylesheet" type="text/css" href="index.css">
+<link rel="stylesheet" type="text/css" href="mobile.css" media="only screen and (max-device-width: 1024px)">
+<link rel="stylesheet" type="text/css" href="prettify/prettify.css">
+</head>
+<body>
+        <div id="header">
+            <h1><a href="index.html">Apache <strong>Cordova</strong> Documentation</a></h1>
+            <small>
+                <select><optgroup label="English" value="en">
+<option value="edge">edge</option>
+<option selected value="2.5.0rc1">2.5.0rc1</option>
+<option value="2.4.0rc1">2.4.0rc1</option>
+<option value="2.4.0">2.4.0</option>
+<option value="2.3.0rc2">2.3.0rc2</option>
+<option value="2.3.0rc1">2.3.0rc1</option>
+<option value="2.3.0">2.3.0</option>
+<option value="2.2.0rc2">2.2.0rc2</option>
+<option value="2.2.0rc1">2.2.0rc1</option>
+<option value="2.2.0">2.2.0</option>
+<option value="2.1.0rc2">2.1.0rc2</option>
+<option value="2.1.0rc1">2.1.0rc1</option>
+<option value="2.1.0">2.1.0</option>
+<option value="2.0.0rc1">2.0.0rc1</option>
+<option value="2.0.0">2.0.0</option>
+<option value="1.9.0rc1">1.9.0rc1</option>
+<option value="1.9.0">1.9.0</option>
+<option value="1.8.1">1.8.1</option>
+<option value="1.8.0rc1">1.8.0rc1</option>
+<option value="1.8.0">1.8.0</option>
+<option value="1.7.0rc1">1.7.0rc1</option>
+<option value="1.7.0">1.7.0</option>
+<option value="1.6.1">1.6.1</option>
+<option value="1.6.0rc1">1.6.0rc1</option>
+<option value="1.6.0">1.6.0</option>
+<option value="1.5.0rc1">1.5.0rc1</option>
+<option value="1.5.0">1.5.0</option>
+</optgroup>
+<optgroup label="Japanese" value="jp">
+<option value="2.2.0">2.2.0</option>
+<option value="2.1.0">2.1.0</option>
+<option value="2.0.0">2.0.0</option>
+<option value="1.9.0">1.9.0</option>
+<option value="1.8.1">1.8.1</option>
+<option value="1.7.0">1.7.0</option>
+</optgroup>
+<optgroup label="Korean" value="kr"><option value="2.0.0">2.0.0</option></optgroup></select></small>
+        </div>
+        <div id="subheader">
+            <h1>Media</h1>
+            <small><select><option value="Media">Media</option>
+<option value="Media_parameters">      - Parameters</option>
+<option value="Media_constants">      - Constants</option>
+<option value="Media_methods">      - Methods</option>
+<option value="Media_additional_readonly_parameters">      - Additional ReadOnly Parameters</option>
+<option value="Media_supported_platforms">      - Supported Platforms</option>
+<option value="Media_permissions">      - Permissions</option>
+<option value="media.getCurrentPosition">media.getCurrentPosition</option>
+<option value="media.getCurrentPosition_parameters">      - Parameters</option>
+<option value="media.getCurrentPosition_description">      - Description</option>
+<option value="media.getCurrentPosition_supported_platforms">      - Supported Platforms</option>
+<option value="media.getCurrentPosition_quick_example">      - Quick Example</option>
+<option value="media.getCurrentPosition_full_example">      - Full Example</option>
+<option value="media.getDuration">media.getDuration</option>
+<option value="media.getDuration_description">      - Description</option>
+<option value="media.getDuration_supported_platforms">      - Supported Platforms</option>
+<option value="media.getDuration_quick_example">      - Quick Example</option>
+<option value="media.getDuration_full_example">      - Full Example</option>
+<option value="media.pause">media.pause</option>
+<option value="media.pause_description">      - Description</option>
+<option value="media.pause_supported_platforms">      - Supported Platforms</option>
+<option value="media.pause_quick_example">      - Quick Example</option>
+<option value="media.pause_full_example">      - Full Example</option>
+<option value="media.play">media.play</option>
+<option value="media.play_description">      - Description</option>
+<option value="media.play_supported_platforms">      - Supported Platforms</option>
+<option value="media.play_quick_example">      - Quick Example</option>
+<option value="media.play_full_example">      - Full Example</option>
+<option value="media.play_blackberry_webworks_quirks">      - BlackBerry WebWorks Quirks</option>
+<option value="media.play_ios_quirk">      - iOS Quirk</option>
+<option value="media.release">media.release</option>
+<option value="media.release_description">      - Description</option>
+<option value="media.release_supported_platforms">      - Supported Platforms</option>
+<option value="media.release_quick_example">      - Quick Example</option>
+<option value="media.release_full_example">      - Full Example</option>
+<option value="media.seekTo">media.seekTo</option>
+<option value="media.seekTo_parameters">      - Parameters</option>
+<option value="media.seekTo_description">      - Description</option>
+<option value="media.seekTo_supported_platforms">      - Supported Platforms</option>
+<option value="media.seekTo_quick_example">      - Quick Example</option>
+<option value="media.seekTo_full_example">      - Full Example</option>
+<option value="media.seekTo_blackberry_webworks_quirks">      - BlackBerry WebWorks Quirks</option>
+<option value="media.startRecord">media.startRecord</option>
+<option value="media.startRecord_description">      - Description</option>
+<option value="media.startRecord_supported_platforms">      - Supported Platforms</option>
+<option value="media.startRecord_quick_example">      - Quick Example</option>
+<option value="media.startRecord_full_example">      - Full Example</option>
+<option value="media.startRecord_android_quirks">      - Android Quirks</option>
+<option value="media.startRecord_blackberry_webworks_quirks">      - BlackBerry WebWorks Quirks</option>
+<option value="media.startRecord_ios_quirks">      - iOS Quirks</option>
+<option value="media.startRecord_tizen_quirks">      - Tizen Quirks</option>
+<option value="media.stop">media.stop</option>
+<option value="media.stop_description">      - Description</option>
+<option value="media.stop_supported_platforms">      - Supported Platforms</option>
+<option value="media.stop_quick_example">      - Quick Example</option>
+<option value="media.stop_full_example">      - Full Example</option>
+<option value="media.stopRecord">media.stopRecord</option>
+<option value="media.stopRecord_description">      - Description</option>
+<option value="media.stopRecord_supported_platforms">      - Supported Platforms</option>
+<option value="media.stopRecord_quick_example">      - Quick Example</option>
+<option value="media.stopRecord_full_example">      - Full Example</option>
+<option value="media.stopRecord_tizen_quirks">      - Tizen Quirks</option>
+<option value="MediaError">MediaError</option>
+<option value="MediaError_properties">      - Properties</option>
+<option value="MediaError_constants">      - Constants</option>
+<option value="MediaError_description">      - Description</option>
+<option value="mediaError">mediaError</option>
+<option value="mediaError_parameters">      - Parameters</option></select></small>
+        </div>
+
+        <div id="sidebar">
+            <div class="vertical_divider"></div>
+        <h1>API Reference</h1>
+<ul>
+<li><a href="cordova_accelerometer_accelerometer.md.html#Accelerometer">Accelerometer</a></li>
+<li><a href="cordova_camera_camera.md.html#Camera">Camera</a></li>
+<li><a href="cordova_media_capture_capture.md.html#Capture">Capture</a></li>
+<li><a href="cordova_compass_compass.md.html#Compass">Compass</a></li>
+<li><a href="cordova_connection_connection.md.html#Connection">Connection</a></li>
+<li><a href="cordova_contacts_contacts.md.html#Contacts">Contacts</a></li>
+<li><a href="cordova_device_device.md.html#Device">Device</a></li>
+<li><a href="cordova_events_events.md.html#Events">Events</a></li>
+<li><a href="cordova_file_file.md.html#File">File</a></li>
+<li><a href="cordova_geolocation_geolocation.md.html#Geolocation">Geolocation</a></li>
+<li><a href="cordova_globalization_globalization.md.html#Globalization">Globalization</a></li>
+<li><a href="cordova_inappbrowser_inappbrowser.md.html#InAppBrowser">InAppBrowser</a></li>
+<li><a href="cordova_media_media.md.html#Media">Media</a></li>
+<li><a href="cordova_notification_notification.md.html#Notification">Notification</a></li>
+<li><a href="cordova_splashscreen_splashscreen.md.html#Splashscreen">Splashscreen</a></li>
+<li><a href="cordova_storage_storage.md.html#Storage">Storage</a></li>
+</ul>
+<h1>Guides</h1>
+<ul>
+<li><a href="guide_getting-started_index.md.html#Getting%20Started%20Guides">Getting Started Guides</a></li>
+<li><a href="guide_command-line_index.md.html#Command-Line%20Usage">Command-Line Usage</a></li>
+<li><a href="guide_upgrading_index.md.html#Upgrading%20Guides">Upgrading Guides</a></li>
+<li><a href="guide_project-settings_index.md.html#Project%20Settings">Project Settings</a></li>
+<li><a href="guide_plugin-development_index.md.html#Plugin%20Development%20Guide">Plugin Development Guide</a></li>
+<li><a href="guide_whitelist_index.md.html#Domain%20Whitelist%20Guide">Domain Whitelist Guide</a></li>
+<li><a href="guide_cordova-webview_index.md.html#Embedding%20WebView">Embedding WebView</a></li>
+<li><a href="_index.html">Keyword Index</a></li>
+</ul>
+</div>
+
+        <div id="scrollable">
+            <div id="content">
+                <h1><a name="Media">Media</a></h1>
+
+<blockquote>
+  <p>The <code><a href="cordova_media_media.md.html#Media">Media</a></code> object provides the ability to record and play back audio files on a device.</p>
+</blockquote>
+
+<pre class="prettyprint"><code>var media = new <a href="cordova_media_media.md.html#Media">Media</a>(src, mediaSuccess, [<a href="cordova_media_media.md.html#mediaError">mediaError</a>], [mediaStatus]);
+</code></pre>
+
+<p>Note: The current implementation does not adhere to a W3C specification for media capture, and is provided for convenience only.  A future implementation will adhere to the latest W3C specification and may deprecate the current APIs.</p>
+
+<h2>
+<a name="Media_parameters">Parameters</a>
+</h2>
+
+<ul>
+<li>
+<strong>src</strong>: A URI containing the audio content. <em>(DOMString)</em>
+</li>
+<li>
+<strong>mediaSuccess</strong>: (Optional) The callback that is invoked after a <a href="cordova_media_media.md.html#Media">Media</a> object has completed the current play/record or stop action. <em>(Function)</em>
+</li>
+<li>
+<strong><a href="cordova_media_media.md.html#mediaError">mediaError</a></strong>: (Optional) The callback that is invoked if there was an error. <em>(Function)</em>
+</li>
+<li>
+<strong>mediaStatus</strong>: (Optional) The callback that is invoked to indicate status changes. <em>(Function)</em>
+</li>
+</ul>
+<h2>
+<a name="Media_constants">Constants</a>
+</h2>
+
+<p>The following constants are reported as the only parameter to the <strong>mediaStatus</strong> callback function.</p>
+
+<ul>
+<li>
+<code><a href="cordova_media_media.md.html#Media">Media</a>.MEDIA_NONE</code>     = 0;</li>
+<li>
+<code><a href="cordova_media_media.md.html#Media">Media</a>.MEDIA_STARTING</code> = 1;</li>
+<li>
+<code><a href="cordova_media_media.md.html#Media">Media</a>.MEDIA_RUNNING</code>  = 2;</li>
+<li>
+<code><a href="cordova_media_media.md.html#Media">Media</a>.MEDIA_PAUSED</code>   = 3;</li>
+<li>
+<code><a href="cordova_media_media.md.html#Media">Media</a>.MEDIA_STOPPED</code>  = 4;</li>
+</ul>
+<h2>
+<a name="Media_methods">Methods</a>
+</h2>
+
+<ul>
+<li>
+<a href="cordova_media_media.md.html#media.getCurrentPosition">media.getCurrentPosition</a>: Returns the current position within an audio file.</li>
+<li>
+<a href="cordova_media_media.md.html#media.getDuration">media.getDuration</a>: Returns the duration of an audio file.</li>
+<li>
+<a href="cordova_media_media.md.html#media.play">media.play</a>: Start or <a href="cordova_events_events.md.html#resume">resume</a> playing audio file.</li>
+<li>
+<a href="cordova_media_media.md.html#media.pause">media.pause</a>: Pause playing audio file.</li>
+<li>
+<a href="cordova_media_media.md.html#media.release">media.release</a>: Releases the underlying OS'es audio resources.</li>
+<li>
+<a href="cordova_media_media.md.html#media.seekTo">media.seekTo</a>: Moves the position within the audio file.</li>
+<li>
+<a href="cordova_media_media.md.html#media.startRecord">media.startRecord</a>: Start recording audio file.</li>
+<li>
+<a href="cordova_media_media.md.html#media.stopRecord">media.stopRecord</a>: Stop recording audio file.</li>
+<li>
+<a href="cordova_media_media.md.html#media.stop">media.stop</a>: Stop playing audio file.</li>
+</ul>
+<h2>
+<a name="Media_additional_readonly_parameters">Additional ReadOnly Parameters</a>
+</h2>
+
+<ul>
+<li>
+<strong>position</strong>: The position within the audio playback in seconds.
+<ul>
+<li>Not automatically updated during play, call <code>getCurrentPosition</code> to update.</li>
+</ul>
+</li>
+<li>
+<strong>duration</strong>: The duration of the media in seconds.</li>
+</ul>
+<h2>
+<a name="Media_supported_platforms">Supported Platforms</a>
+</h2>
+
+<ul>
+<li>Android</li>
+<li>BlackBerry WebWorks (OS 5.0 and higher)</li>
+<li>iOS</li>
+<li>Windows Phone 7.5</li>
+<li>Tizen</li>
+<li>Windows 8</li>
+</ul>
+<h2>
+<a name="Media_permissions">Permissions</a>
+</h2>
+
+<h3>Android</h3>
+
+<h4>app/res/xml/config.xml</h4>
+
+<pre class="prettyprint"><code>&lt;plugin name="<a href="cordova_media_media.md.html#Media">Media</a>" value="org.apache.cordova.AudioHandler" /&gt;
+</code></pre>
+
+<h4>app/AndroidManifest.xml</h4>
+
+<pre class="prettyprint"><code>&lt;uses-permission android:name="android.permission.RECORD_AUDIO" /&gt;
+&lt;uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /&gt;
+&lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
+</code></pre>
+
+<h3>Bada</h3>
+
+<h4>manifest.xml</h4>
+
+<pre class="prettyprint"><code>&lt;Privilege&gt;
+    &lt;Name&gt;RECORDING&lt;/Name&gt;
+&lt;/Privilege&gt;
+</code></pre>
+
+<h3>BlackBerry WebWorks</h3>
+
+<h4>www/plugins.xml</h4>
+
+<pre class="prettyprint"><code>&lt;plugin name="<a href="cordova_media_capture_capture.md.html#Capture">Capture</a>" value="org.apache.cordova.media.MediaCapture" /&gt;
+</code></pre>
+
+<h3>iOS</h3>
+
+<h4>config.xml</h4>
+
+<pre class="prettyprint"><code>&lt;plugin name="<a href="cordova_media_media.md.html#Media">Media</a>" value="CDVSound" /&gt;
+</code></pre>
+
+<h3>webOS</h3>
+
+<pre class="prettyprint"><code>No permissions are required.
+</code></pre>
+
+<h3>Windows Phone</h3>
+
+<h4>Properties/WPAppManifest.xml</h4>
+
+<pre class="prettyprint"><code>&lt;Capabilities&gt;
+    &lt;Capability Name="ID_CAP_MEDIALIB" /&gt;
+    &lt;Capability Name="ID_CAP_MICROPHONE" /&gt;
+    &lt;Capability Name="ID_HW_FRONTCAMERA" /&gt;
+    &lt;Capability Name="ID_CAP_ISV_CAMERA" /&gt;
+    &lt;Capability Name="ID_CAP_CAMERA" /&gt;
+&lt;/Capabilities&gt;
+</code></pre>
+
+<p>Reference: <a class="external" href="http://msdn.microsoft.com/en-us/library/ff769509%28v=vs.92%29.aspx">Application Manifest for Windows Phone</a></p>
+
+<h3>Tizen</h3>
+
+<pre class="prettyprint"><code>No permissions are required.
+</code></pre>
+
+<h3>Windows Phone Quirks</h3>
+
+<pre class="prettyprint"><code>Only one media file can be played back at a time.
+There are strict restrictions as to how your application interacts with other media. See http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh184838(v=vs.92).aspx
+</code></pre>
+
+<hr>
+<h1><a name="media.getCurrentPosition">media.getCurrentPosition</a></h1>
+
+<p>Returns the current position within an audio file.</p>
+
+<pre class="prettyprint"><code><a href="cordova_media_media.md.html#media.getCurrentPosition">media.getCurrentPosition</a>(mediaSuccess, [<a href="cordova_media_media.md.html#mediaError">mediaError</a>]);
+</code></pre>
+
+<h2>
+<a name="media.getCurrentPosition_parameters">Parameters</a>
+</h2>
+
+<ul>
+<li>
+<strong>mediaSuccess</strong>: The callback that is called with the current position in seconds.</li>
+<li>
+<strong><a href="cordova_media_media.md.html#mediaError">mediaError</a></strong>: (Optional) The callback that is called if there was an error.</li>
+</ul>
+<h2>
+<a name="media.getCurrentPosition_description">Description</a>
+</h2>
+
+<p>Function <code><a href="cordova_media_media.md.html#media.getCurrentPosition">media.getCurrentPosition</a></code> is an asynchronous function that returns the current position of the underlying audio file of a <a href="cordova_media_media.md.html#Media">Media</a> object. Also updates the <strong>_position</strong> parameter within the <a href="cordova_media_media.md.html#Media">Media</a> object. </p>
+
+<h2>
+<a name="media.getCurrentPosition_supported_platforms">Supported Platforms</a>
+</h2>
+
+<ul>
+<li>Android</li>
+<li>BlackBerry WebWorks (OS 5.0 and higher)</li>
+<li>iOS</li>
+<li>Windows Phone 7 and 8</li>
+<li>Tizen</li>
+<li>Windows 8</li>
+</ul>
+<h2>
+<a name="media.getCurrentPosition_quick_example">Quick Example</a>
+</h2>
+
+<pre class="prettyprint"><code>    // Audio player
+    //
+    var my_media = new <a href="cordova_media_media.md.html#Media">Media</a>(src, onSuccess, onError);
+
+    // Update media position every second
+    var mediaTimer = setInterval(function() {
+        // get media position
+        my_media.getCurrentPosition(
+            // success callback
+            function(position) {
+                if (position &gt; -1) {
+                    console.log((position) + " sec");
+                }
+            },
+            // error callback
+            function(e) {
+                console.log("Error getting pos=" + e);
+            }
+        );
+    }, 1000);
+</code></pre>
+
+<h2>
+<a name="media.getCurrentPosition_full_example">Full Example</a>
+</h2>
+
+<pre class="prettyprint"><code>    &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+                  "http://www.w3.org/TR/html4/strict.dtd"&gt;
+    &lt;html&gt;
+      &lt;head&gt;
+        &lt;title&gt;<a href="cordova_media_media.md.html#Media">Media</a> Example&lt;/title&gt;
+
+        &lt;script type="text/javascript" charset="utf-8" src="cordova-2.5.0.js"&gt;&lt;/script&gt;
+        &lt;script type="text/javascript" charset="utf-8"&gt;
+
+        // Wait for Cordova to load
+        //
+        document.<a href="cordova_inappbrowser_inappbrowser.md.html#addEventListener">addEventListener</a>("<a href="cordova_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);
+
+        // Cordova is ready
+        //
+        function onDeviceReady() {
+            playAudio("http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3");
+        }
+
+        // Audio player
+        //
+        var my_media = null;
+        var mediaTimer = null;
+
+        // Play audio
+        //
+        function playAudio(src) {
+            // Create <a href="cordova_media_media.md.html#Media">Media</a> object from src
+            my_media = new <a href="cordova_media_media.md.html#Media">Media</a>(src, onSuccess, onError);
+
+            // Play audio
+            my_media.play();
+
+            // Update my_media position every second
+            if (mediaTimer == null) {
+                mediaTimer = setInterval(function() {
+                    // get my_media position
+                    my_media.getCurrentPosition(
+                        // success callback
+                        function(position) {
+                            if (position &gt; -1) {
+                                setAudioPosition((position) + " sec");
+                            }
+                        },
+                        // error callback
+                        function(e) {
+                            console.log("Error getting pos=" + e);
+                            setAudioPosition("Error: " + e);
+                        }
+                    );
+                }, 1000);
+            }
+        }
+
+        // Pause audio
+        // 
+        function pauseAudio() {
+            if (my_media) {
+                my_media.<a href="cordova_events_events.md.html#pause">pause</a>();
+            }
+        }
+
+        // Stop audio
+        // 
+        function stopAudio() {
+            if (my_media) {
+                my_media.stop();
+            }
+            clearInterval(mediaTimer);
+            mediaTimer = null;
+        }
+
+        // onSuccess Callback
+        //
+        function onSuccess() {
+            console.log("playAudio():Audio Success");
+        }
+
+        // onError Callback 
+        //
+        function onError(error) {
+            alert('code: '    + error.code    + '\n' + 
+                  'message: ' + error.message + '\n');
+        }
+
+        // Set audio position
+        // 
+        function setAudioPosition(position) {
+            document.getElementById('audio_position').innerHTML = position;
+        }
+
+        &lt;/script&gt;
+      &lt;/head&gt;
+      &lt;body&gt;
+        &lt;a href="#" class="btn large" onclick="playAudio('http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3');"&gt;Play Audio&lt;/a&gt;
+        &lt;a href="#" class="btn large" onclick="pauseAudio();"&gt;Pause Playing Audio&lt;/a&gt;
+        &lt;a href="#" class="btn large" onclick="stopAudio();"&gt;Stop Playing Audio&lt;/a&gt;
+        &lt;p id="audio_position"&gt;&lt;/p&gt;
+      &lt;/body&gt;
+    &lt;/html&gt;
+</code></pre>
+
+<hr>
+<h1><a name="media.getDuration">media.getDuration</a></h1>
+
+<p>Returns the duration of an audio file.</p>
+
+<pre class="prettyprint"><code><a href="cordova_media_media.md.html#media.getDuration">media.getDuration</a>();
+</code></pre>
+
+<h2>
+<a name="media.getDuration_description">Description</a>
+</h2>
+
+<p>Function <code><a href="cordova_media_media.md.html#media.getDuration">media.getDuration</a></code> is a synchronous function that returns the duration of the audio file in seconds, if known.  If the duration is unknown, a value of -1 is returned.</p>
+
+<h2>
+<a name="media.getDuration_supported_platforms">Supported Platforms</a>
+</h2>
+
+<ul>
+<li>Android</li>
+<li>BlackBerry WebWorks (OS 5.0 and higher)</li>
+<li>iOS</li>
+<li>Windows Phone 7 and 8</li>
+<li>Tizen</li>
+<li>Windows 8</li>
+</ul>
+<h2>
+<a name="media.getDuration_quick_example">Quick Example</a>
+</h2>
+
+<pre class="prettyprint"><code>    // Audio player
+    //
+    var my_media = new <a href="cordova_media_media.md.html#Media">Media</a>(src, onSuccess, onError);
+
+    // Get duration
+    var counter = 0;
+    var timerDur = setInterval(function() {
+        counter = counter + 100;
+        if (counter &gt; 2000) {
+            clearInterval(timerDur);
+        }
+        var dur = my_media.getDuration();
+        if (dur &gt; 0) {
+            clearInterval(timerDur);
+            document.getElementById('audio_duration').innerHTML = (dur) + " sec";
+        }
+   }, 100);
+</code></pre>
+
+<h2>
+<a name="media.getDuration_full_example">Full Example</a>
+</h2>
+
+<pre class="prettyprint"><code>    &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+                          "http://www.w3.org/TR/html4/strict.dtd"&gt;
+    &lt;html&gt;
+      &lt;head&gt;
+        &lt;title&gt;<a href="cordova_media_media.md.html#Media">Media</a> Example&lt;/title&gt;
+
+        &lt;script type="text/javascript" charset="utf-8" src="cordova-2.5.0.js"&gt;&lt;/script&gt;
+        &lt;script type="text/javascript" charset="utf-8"&gt;
+
+        // Wait for Cordova to load
+        //
+        document.<a href="cordova_inappbrowser_inappbrowser.md.html#addEventListener">addEventListener</a>("<a href="cordova_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);
+
+        // Cordova is ready
+        //
+        function onDeviceReady() {
+            playAudio("http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3");
+        }
+
+        // Audio player
+        //
+        var my_media = null;
+        var mediaTimer = null;
+
+        // Play audio
+        //
+        function playAudio(src) {
+            // Create <a href="cordova_media_media.md.html#Media">Media</a> object from src
+            my_media = new <a href="cordova_media_media.md.html#Media">Media</a>(src, onSuccess, onError);
+
+            // Play audio
+            my_media.play();
+
+            // Update my_media position every second
+            if (mediaTimer == null) {
+                mediaTimer = setInterval(function() {
+                    // get my_media position
+                    my_media.getCurrentPosition(
+                        // success callback
+                        function(position) {
+                            if (position &gt; -1) {
+                                setAudioPosition((position) + " sec");
+                            }
+                        },
+                        // error callback
+                        function(e) {
+                            console.log("Error getting pos=" + e);
+                            setAudioPosition("Error: " + e);
+                        }
+                    );
+                }, 1000);
+            }
+        }
+
+        // Pause audio
+        // 
+        function pauseAudio() {
+            if (my_media) {
+                my_media.<a href="cordova_events_events.md.html#pause">pause</a>();
+            }
+        }
+
+        // Stop audio
+        // 
+        function stopAudio() {
+            if (my_media) {
+                my_media.stop();
+            }
+            clearInterval(mediaTimer);
+            mediaTimer = null;
+        }
+
+        // onSuccess Callback
+        //
+        function onSuccess() {
+            console.log("playAudio():Audio Success");
+        }
+
+        // onError Callback 
+        //
+        function onError(error) {
+            alert('code: '    + error.code    + '\n' + 
+                  'message: ' + error.message + '\n');
+        }
+
+        // Set audio position
+        // 
+        function setAudioPosition(position) {
+            document.getElementById('audio_position').innerHTML = position;
+        }
+
+        &lt;/script&gt;
+      &lt;/head&gt;
+      &lt;body&gt;
+        &lt;a href="#" class="btn large" onclick="playAudio('http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3');"&gt;Play Audio&lt;/a&gt;
+        &lt;a href="#" class="btn large" onclick="pauseAudio();"&gt;Pause Playing Audio&lt;/a&gt;
+        &lt;a href="#" class="btn large" onclick="stopAudio();"&gt;Stop Playing Audio&lt;/a&gt;
+        &lt;p id="audio_position"&gt;&lt;/p&gt;
+      &lt;/body&gt;
+    &lt;/html&gt;
+</code></pre>
+
+<hr>
+<h1><a name="media.pause">media.pause</a></h1>
+
+<p>Pauses playing an audio file.</p>
+
+<pre class="prettyprint"><code><a href="cordova_media_media.md.html#media.pause">media.pause</a>();
+</code></pre>
+
+<h2>
+<a name="media.pause_description">Description</a>
+</h2>
+
+<p>Function <code><a href="cordova_media_media.md.html#media.pause">media.pause</a></code> is a synchronous function that pauses playing an audio file.</p>
+
+<h2>
+<a name="media.pause_supported_platforms">Supported Platforms</a>
+</h2>
+
+<ul>
+<li>Android</li>
+<li>BlackBerry WebWorks (OS 5.0 and higher)</li>
+<li>iOS</li>
+<li>Windows Phone 7 and 8</li>
+<li>Tizen</li>
+<li>Windows 8</li>
+</ul>
+<h2>
+<a name="media.pause_quick_example">Quick Example</a>
+</h2>
+
+<pre class="prettyprint"><code>// Play audio
+//
+function playAudio(url) {
+    // Play the audio file at url
+    var my_media = new <a href="cordova_media_media.md.html#Media">Media</a>(url,
+        // success callback
+        function() {
+            console.log("playAudio():Audio Success");
+        },
+        // error callback
+        function(err) {
+            console.log("playAudio():Audio Error: "+err);
+    });
+
+    // Play audio
+    my_media.play();
+
+    // Pause after 10 seconds
+    setTimeout(function() {
+        <a href="cordova_media_media.md.html#media.pause">media.pause</a>();
+    }, 10000);        
+}
+</code></pre>
+
+<h2>
+<a name="media.pause_full_example">Full Example</a>
+</h2>
+
+<pre class="prettyprint"><code>    &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+                          "http://www.w3.org/TR/html4/strict.dtd"&gt;
+    &lt;html&gt;
+      &lt;head&gt;
+        &lt;title&gt;<a href="cordova_media_media.md.html#Media">Media</a> Example&lt;/title&gt;
+
+        &lt;script type="text/javascript" charset="utf-8" src="cordova-2.5.0.js"&gt;&lt;/script&gt;
+        &lt;script type="text/javascript" charset="utf-8"&gt;
+
+        // Wait for Cordova to load
+        //
+        document.<a href="cordova_inappbrowser_inappbrowser.md.html#addEventListener">addEventListener</a>("<a href="cordova_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);
+
+        // Cordova is ready
+        //
+        function onDeviceReady() {
+            playAudio("http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3");
+        }
+
+        // Audio player
+        //
+        var my_media = null;
+        var mediaTimer = null;
+
+        // Play audio
+        //
+        function playAudio(src) {
+            // Create <a href="cordova_media_media.md.html#Media">Media</a> object from src
+            my_media = new <a href="cordova_media_media.md.html#Media">Media</a>(src, onSuccess, onError);
+
+            // Play audio
+            my_media.play();
+
+            // Update my_media position every second
+            if (mediaTimer == null) {
+                mediaTimer = setInterval(function() {
+                    // get my_media position
+                    my_media.getCurrentPosition(
+                        // success callback
+                        function(position) {
+                            if (position &gt; -1) {
+                                setAudioPosition((position) + " sec");
+                            }
+                        },
+                        // error callback
+                        function(e) {
+                            console.log("Error getting pos=" + e);
+                            setAudioPosition("Error: " + e);
+                        }
+                    );
+                }, 1000);
+            }
+        }
+
+        // Pause audio
+        // 
+        function pauseAudio() {
+            if (my_media) {
+                my_media.<a href="cordova_events_events.md.html#pause">pause</a>();
+            }
+        }
+
+        // Stop audio
+        // 
+        function stopAudio() {
+            if (my_media) {
+                my_media.stop();
+            }
+            clearInterval(mediaTimer);
+            mediaTimer = null;
+        }
+
+        // onSuccess Callback
+        //
+        function onSuccess() {
+            console.log("playAudio():Audio Success");
+        }
+
+        // onError Callback 
+        //
+        function onError(error) {
+            alert('code: '    + error.code    + '\n' + 
+                  'message: ' + error.message + '\n');
+        }
+
+        // Set audio position
+        // 
+        function setAudioPosition(position) {
+            document.getElementById('audio_position').innerHTML = position;
+        }
+
+        &lt;/script&gt;
+      &lt;/head&gt;
+      &lt;body&gt;
+        &lt;a href="#" class="btn large" onclick="playAudio('http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3');"&gt;Play Audio&lt;/a&gt;
+        &lt;a href="#" class="btn large" onclick="pauseAudio();"&gt;Pause Playing Audio&lt;/a&gt;
+        &lt;a href="#" class="btn large" onclick="stopAudio();"&gt;Stop Playing Audio&lt;/a&gt;
+        &lt;p id="audio_position"&gt;&lt;/p&gt;
+      &lt;/body&gt;
+    &lt;/html&gt;
+</code></pre>
+
+<hr>
+<h1><a name="media.play">media.play</a></h1>
+
+<p>Starts or resumes playing an audio file.</p>
+
+<pre class="prettyprint"><code><a href="cordova_media_media.md.html#media.play">media.play</a>();
+</code></pre>
+
+<h2>
+<a name="media.play_description">Description</a>
+</h2>
+
+<p>Function <code><a href="cordova_media_media.md.html#media.play">media.play</a></code> is a synchronous function that starts or resumes playing an audio file.</p>
+
+<h2>
+<a name="media.play_supported_platforms">Supported Platforms</a>
+</h2>
+
+<ul>
+<li>Android</li>
+<li>BlackBerry WebWorks (OS 5.0 and higher)</li>
+<li>iOS</li>
+<li>Windows Phone 7 and 8</li>
+<li>Tizen</li>
+<li>Windows 8</li>
+</ul>
+<h2>
+<a name="media.play_quick_example">Quick Example</a>
+</h2>
+
+<pre class="prettyprint"><code>// Play audio
+//
+function playAudio(url) {
+    // Play the audio file at url
+    var my_media = new <a href="cordova_media_media.md.html#Media">Media</a>(url,
+        // success callback
+        function() {
+            console.log("playAudio():Audio Success");
+        },
+        // error callback
+        function(err) {
+            console.log("playAudio():Audio Error: "+err);
+    });
+
+    // Play audio
+    my_media.play();
+}
+</code></pre>
+
+<h2>
+<a name="media.play_full_example">Full Example</a>
+</h2>
+
+<pre class="prettyprint"><code>    &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+                          "http://www.w3.org/TR/html4/strict.dtd"&gt;
+    &lt;html&gt;
+      &lt;head&gt;
+        &lt;title&gt;<a href="cordova_media_media.md.html#Media">Media</a> Example&lt;/title&gt;
+
+        &lt;script type="text/javascript" charset="utf-8" src="cordova-2.5.0.js"&gt;&lt;/script&gt;
+        &lt;script type="text/javascript" charset="utf-8"&gt;
+
+        // Wait for Cordova to load
+        //
+        document.<a href="cordova_inappbrowser_inappbrowser.md.html#addEventListener">addEventListener</a>("<a href="cordova_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);
+
+        // Cordova is ready
+        //
+        function onDeviceReady() {
+            playAudio("http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3");
+        }
+
+        // Audio player
+        //
+        var my_media = null;
+        var mediaTimer = null;
+
+        // Play audio
+        //
+        function playAudio(src) {
+            if (my_media == null) {
+                // Create <a href="cordova_media_media.md.html#Media">Media</a> object from src
+                my_media = new <a href="cordova_media_media.md.html#Media">Media</a>(src, onSuccess, onError);
+            } // else play current audio
+            // Play audio
+            my_media.play();
+
+            // Update my_media position every second
+            if (mediaTimer == null) {
+                mediaTimer = setInterval(function() {
+                    // get my_media position
+                    my_media.getCurrentPosition(
+                        // success callback
+                        function(position) {
+                            if (position &gt; -1) {
+                                setAudioPosition((position) + " sec");
+                            }
+                        },
+                        // error callback
+                        function(e) {
+                            console.log("Error getting pos=" + e);
+                            setAudioPosition("Error: " + e);
+                        }
+                    );
+                }, 1000);
+            }
+        }
+
+        // Pause audio
+        // 
+        function pauseAudio() {
+            if (my_media) {
+                my_media.<a href="cordova_events_events.md.html#pause">pause</a>();
+            }
+        }
+
+        // Stop audio
+        // 
+        function stopAudio() {
+            if (my_media) {
+                my_media.stop();
+            }
+            clearInterval(mediaTimer);
+            mediaTimer = null;
+        }
+
+        // onSuccess Callback
+        //
+        function onSuccess() {
+            console.log("playAudio():Audio Success");
+        }
+
+        // onError Callback 
+        //
+        function onError(error) {
+            alert('code: '    + error.code    + '\n' + 
+                  'message: ' + error.message + '\n');
+        }
+
+        // Set audio position
+        // 
+        function setAudioPosition(position) {
+            document.getElementById('audio_position').innerHTML = position;
+        }
+
+        &lt;/script&gt;
+      &lt;/head&gt;
+      &lt;body&gt;
+        &lt;a href="#" class="btn large" onclick="playAudio('http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3');"&gt;Play Audio&lt;/a&gt;
+        &lt;a href="#" class="btn large" onclick="pauseAudio();"&gt;Pause Playing Audio&lt;/a&gt;
+        &lt;a href="#" class="btn large" onclick="stopAudio();"&gt;Stop Playing Audio&lt;/a&gt;
+        &lt;p id="audio_position"&gt;&lt;/p&gt;
+      &lt;/body&gt;
+    &lt;/html&gt;
+</code></pre>
+
+<h2>
+<a name="media.play_blackberry_webworks_quirks">BlackBerry WebWorks Quirks</a>
+</h2>
+
+<ul>
+<li>BlackBerry devices support a limited number of simultaneous audio channels. CDMA devices only support a single audio channel. Other devices support up to two simultaneous channels. Attempting to play more audio files then the supported amount will result in previous playback being stopped.</li>
+</ul>
+<h2>
+<a name="media.play_ios_quirk">iOS Quirk</a>
+</h2>
+
+<ul>
+<li>
+<p><strong>numberOfLoops</strong></p>
+
+<p>Pass in this option to the <strong>play</strong> method to specify the number of times you want the media file to play. e.g:</p>
+
+<pre class="prettyprint"><code>var myMedia = new <a href="cordova_media_media.md.html#Media">Media</a>("http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3")
+myMedia.play({ numberOfLoops: 2 })
+</code></pre>
+</li>
+<li>
+<p><strong>playAudioWhenScreenIsLocked</strong></p>
+
+<p>Pass in this option to the <strong>play</strong> method to specify whether you want to play the audio of the media file when the screen is locked (this defaults to true if not set). If this is set to true, it will ignore the state of the hardware mute button. e.g:</p>
+
+<pre class="prettyprint"><code>var myMedia = new <a href="cordova_media_media.md.html#Media">Media</a>("http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3")
+myMedia.play({ playAudioWhenScreenIsLocked : false })
+</code></pre>
+</li>
+<li>
+<p><strong>order of file search</strong></p>
+
+<p>When only a file name or simple path is provided, iOS will search in the www for the file and then in the application documents/tmp directory.</p>
+
+<pre class="prettyprint"><code>var myMedia = new <a href="cordova_media_media.md.html#Media">Media</a>("audio/beer.mp3")
+myMedia.play()  // will first look for file in www/audio/beer.mp3 then in &lt;application&gt;/documents/tmp/audio/beer.mp3
+</code></pre>
+</li>
+</ul>
+<hr>
+<h1><a name="media.release">media.release</a></h1>
+
+<p>Releases the underlying operating systems audio resources.</p>
+
+<pre class="prettyprint"><code><a href="cordova_media_media.md.html#media.release">media.release</a>();
+</code></pre>
+
+<h2>
+<a name="media.release_description">Description</a>
+</h2>
+
+<p>Function <code><a href="cordova_media_media.md.html#media.release">media.release</a></code> is a synchronous function that releases the underlying operating systems audio resources.  This function is particularly important for Android as there are a finite amount of OpenCore instances for media playback.  Developers should call the 'release' function when they no longer need the <a href="cordova_media_media.md.html#Media">Media</a> resource.</p>
+
+<h2>
+<a name="media.release_supported_platforms">Supported Platforms</a>
+</h2>
+
+<ul>
+<li>Android</li>
+<li>BlackBerry WebWorks (OS 5.0 and higher)</li>
+<li>iOS</li>
+<li>Windows Phone 7 and 8</li>
+<li>Tizen</li>
+<li>Windows 8</li>
+</ul>
+<h2>
+<a name="media.release_quick_example">Quick Example</a>
+</h2>
+
+<pre class="prettyprint"><code>    // Audio player
+    //
+    var my_media = new <a href="cordova_media_media.md.html#Media">Media</a>(src, onSuccess, onError);
+
+    my_media.play();
+    my_media.stop();
+    my_media.release();
+</code></pre>
+
+<h2>
+<a name="media.release_full_example">Full Example</a>
+</h2>
+
+<pre class="prettyprint"><code>    &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+                          "http://www.w3.org/TR/html4/strict.dtd"&gt;
+    &lt;html&gt;
+      &lt;head&gt;
+        &lt;title&gt;<a href="cordova_media_media.md.html#Media">Media</a> Example&lt;/title&gt;
+
+        &lt;script type="text/javascript" charset="utf-8" src="cordova-2.5.0.js"&gt;&lt;/script&gt;
+        &lt;script type="text/javascript" charset="utf-8"&gt;
+
+        // Wait for Cordova to load
+        //
+        document.<a href="cordova_inappbrowser_inappbrowser.md.html#addEventListener">addEventListener</a>("<a href="cordova_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);
+
+        // Cordova is ready
+        //
+        function onDeviceReady() {
+            playAudio("http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3");
+        }
+
+        // Audio player
+        //
+        var my_media = null;
+        var mediaTimer = null;
+
+        // Play audio
+        //
+        function playAudio(src) {
+            // Create <a href="cordova_media_media.md.html#Media">Media</a> object from src
+            my_media = new <a href="cordova_media_media.md.html#Media">Media</a>(src, onSuccess, onError);
+
+            // Play audio
+            my_media.play();
+
+            // Update my_media position every second
+            if (mediaTimer == null) {
+                mediaTimer = setInterval(function() {
+                    // get my_media position
+                    my_media.getCurrentPosition(
+                        // success callback
+                        function(position) {
+                            if (position &gt; -1) {
+                                setAudioPosition((position) + " sec");
+                            }
+                        },
+                        // error callback
+                        function(e) {
+                            console.log("Error getting pos=" + e);
+                            setAudioPosition("Error: " + e);
+                        }
+                    );
+                }, 1000);
+            }
+        }
+
+        // Pause audio
+        // 
+        function pauseAudio() {
+            if (my_media) {
+                my_media.<a href="cordova_events_events.md.html#pause">pause</a>();
+            }
+        }
+
+        // Stop audio
+        // 
+        function stopAudio() {
+            if (my_media) {
+                my_media.stop();
+            }
+            clearInterval(mediaTimer);
+            mediaTimer = null;
+        }
+
+        // onSuccess Callback
+        //
+        function onSuccess() {
+            console.log("playAudio():Audio Success");
+        }
+
+        // onError Callback 
+        //
+        function onError(error) {
+            alert('code: '    + error.code    + '\n' + 
+                  'message: ' + error.message + '\n');
+        }
+
+        // Set audio position
+        // 
+        function setAudioPosition(position) {
+            document.getElementById('audio_position').innerHTML = position;
+        }
+
+        &lt;/script&gt;
+      &lt;/head&gt;
+      &lt;body&gt;
+        &lt;a href="#" class="btn large" onclick="playAudio('http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3');"&gt;Play Audio&lt;/a&gt;
+        &lt;a href="#" class="btn large" onclick="pauseAudio();"&gt;Pause Playing Audio&lt;/a&gt;
+        &lt;a href="#" class="btn large" onclick="stopAudio();"&gt;Stop Playing Audio&lt;/a&gt;
+        &lt;p id="audio_position"&gt;&lt;/p&gt;
+      &lt;/body&gt;
+    &lt;/html&gt;
+</code></pre>
+
+<hr>
+<h1><a name="media.seekTo">media.seekTo</a></h1>
+
+<p>Sets the current position within an audio file.</p>
+
+<pre class="prettyprint"><code><a href="cordova_media_media.md.html#media.seekTo">media.seekTo</a>(milliseconds);
+</code></pre>
+
+<h2>
+<a name="media.seekTo_parameters">Parameters</a>
+</h2>
+
+<ul>
+<li>
+<strong>milliseconds</strong>: The position to set the playback position within the audio in milliseconds. .</li>
+</ul>
+<h2>
+<a name="media.seekTo_description">Description</a>
+</h2>
+
+<p>Function <code><a href="cordova_media_media.md.html#media.seekTo">media.seekTo</a></code> is an asynchronous function that updates the current position of the underlying audio file of a <a href="cordova_media_media.md.html#Media">Media</a> object. Also updates the <strong>_position</strong> parameter within the <a href="cordova_media_media.md.html#Media">Media</a> object. </p>
+
+<h2>
+<a name="media.seekTo_supported_platforms">Supported Platforms</a>
+</h2>
+
+<ul>
+<li>Android</li>
+<li>BlackBerry WebWorks (OS 6.0 and higher)</li>
+<li>iOS</li>
+<li>Windows Phone 7 and 8</li>
+<li>Tizen</li>
+<li>Windows 8</li>
+</ul>
+<h2>
+<a name="media.seekTo_quick_example">Quick Example</a>
+</h2>
+
+<pre class="prettyprint"><code>    // Audio player
+    //
+    var my_media = new <a href="cordova_media_media.md.html#Media">Media</a>(src, onSuccess, onError);
+    my_media.play();
+    // SeekTo to 10 seconds after 5 seconds
+    setTimeout(function() {
+        my_media.seekTo(10000);
+    }, 5000);
+</code></pre>
+
+<h2>
+<a name="media.seekTo_full_example">Full Example</a>
+</h2>
+
+<pre class="prettyprint"><code>    &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+                  "http://www.w3.org/TR/html4/strict.dtd"&gt;
+    &lt;html&gt;
+      &lt;head&gt;
+        &lt;title&gt;<a href="cordova_media_media.md.html#Media">Media</a> Example&lt;/title&gt;
+
+        &lt;script type="text/javascript" charset="utf-8" src="cordova-2.5.0.js"&gt;&lt;/script&gt;
+        &lt;script type="text/javascript" charset="utf-8"&gt;
+
+        // Wait for Cordova to load
+        //
+        document.<a href="cordova_inappbrowser_inappbrowser.md.html#addEventListener">addEventListener</a>("<a href="cordova_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);
+
+        // Cordova is ready
+        //
+        function onDeviceReady() {
+            playAudio("http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3");
+        }
+
+        // Audio player
+        //
+        var my_media = null;
+        var mediaTimer = null;
+
+        // Play audio
+        //
+        function playAudio(src) {
+            // Create <a href="cordova_media_media.md.html#Media">Media</a> object from src
+            my_media = new <a href="cordova_media_media.md.html#Media">Media</a>(src, onSuccess, onError);
+
+            // Play audio
+            my_media.play();
+            // Update media position every second
+            mediaTimer = setInterval(function() {
+                // get media position
+                my_media.getCurrentPosition(
+                    // success callback
+                    function(position) {
+                        if (position &gt; -1) {
+                            setAudioPosition(position + " sec");
+                        }
+                    },
+                    // error callback
+                    function(e) {
+                        console.log("Error getting pos=" + e);
+                    }
+                );
+            }, 1000);
+            // SeekTo to 10 seconds after 5 seconds
+            setTimeout(function() {
+                my_media.seekTo(10000);
+            }, 5000);
+        }
+
+        // Stop audio
+        // 
+        function stopAudio() {
+            if (my_media) {
+                my_media.stop();
+            }
+            clearInterval(mediaTimer);
+            mediaTimer = null;
+        }
+
+        // onSuccess Callback
+        //
+        function onSuccess() {
+            console.log("playAudio():Audio Success");
+        }
+
+        // onError Callback 
+        //
+        function onError(error) {
+            alert('code: '    + error.code    + '\n' + 
+                  'message: ' + error.message + '\n');
+        }
+
+        // Set audio position
+        // 
+        function setAudioPosition(position) {
+            document.getElementById('audio_position').innerHTML = position;
+        }
+
+        &lt;/script&gt;
+      &lt;/head&gt;
+      &lt;body&gt;
+        &lt;a href="#" class="btn large" onclick="playAudio('http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3');"&gt;Play Audio&lt;/a&gt;
+        &lt;a href="#" class="btn large" onclick="stopAudio();"&gt;Stop Playing Audio&lt;/a&gt;
+        &lt;p id="audio_position"&gt;&lt;/p&gt;
+      &lt;/body&gt;
+    &lt;/html&gt;
+</code></pre>
+
+<h2>
+<a name="media.seekTo_blackberry_webworks_quirks">BlackBerry WebWorks Quirks</a>
+</h2>
+
+<ul>
+<li>This API is not supported on BlackBerry OS 5 devices.</li>
+</ul>
+<hr>
+<h1><a name="media.startRecord">media.startRecord</a></h1>
+
+<p>Starts recording an audio file.</p>
+
+<pre class="prettyprint"><code><a href="cordova_media_media.md.html#media.startRecord">media.startRecord</a>();
+</code></pre>
+
+<h2>
+<a name="media.startRecord_description">Description</a>
+</h2>
+
+<p>Function <code><a href="cordova_media_media.md.html#media.startRecord">media.startRecord</a></code> is a synchronous function that starts recording an audio file.</p>
+
+<h2>
+<a name="media.startRecord_supported_platforms">Supported Platforms</a>
+</h2>
+
+<ul>
+<li>Android</li>
+<li>BlackBerry WebWorks (OS 5.0 and higher)</li>
+<li>iOS</li>
+<li>Windows Phone 7 and 8</li>
+<li>Windows 8</li>
+</ul>
+<h2>
+<a name="media.startRecord_quick_example">Quick Example</a>
+</h2>
+
+<pre class="prettyprint"><code>// Record audio
+// 
+function recordAudio() {
+    var src = "myrecording.mp3";
+    var mediaRec = new <a href="cordova_media_media.md.html#Media">Media</a>(src,
+        // success callback
+        function() {
+            console.log("recordAudio():Audio Success");
+        },
+
+        // error callback
+        function(err) {
+            console.log("recordAudio():Audio Error: "+ err.code);
+        });
+
+    // Record audio
+    mediaRec.startRecord();
+}
+</code></pre>
+
+<h2>
+<a name="media.startRecord_full_example">Full Example</a>
+</h2>
+
+<pre class="prettyprint"><code>&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+  &lt;head&gt;
+    &lt;title&gt;<a href="cordova_device_device.md.html#Device">Device</a> Properties Example&lt;/title&gt;
+
+    &lt;script type="text/javascript" charset="utf-8" src="cordova-2.5.0.js"&gt;&lt;/script&gt;
+    &lt;script type="text/javascript" charset="utf-8"&gt;
+
+    // Wait for Cordova to load
+    //
+    document.<a href="cordova_inappbrowser_inappbrowser.md.html#addEventListener">addEventListener</a>("<a href="cordova_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);
+
+    // Record audio
+    // 
+    function recordAudio() {
+        var src = "myrecording.amr";
+        var mediaRec = new <a href="cordova_media_media.md.html#Media">Media</a>(src, onSuccess, onError);
+
+        // Record audio
+        mediaRec.startRecord();
+
+        // Stop recording after 10 sec
+        var recTime = 0;
+        var recInterval = setInterval(function() {
+            recTime = recTime + 1;
+            setAudioPosition(recTime + " sec");
+            if (recTime &gt;= 10) {
+                clearInterval(recInterval);
+                mediaRec.stopRecord();
+            }
+        }, 1000);
+    }
+
+    // Cordova is ready
+    //
+    function onDeviceReady() {
+        recordAudio();
+    }
+
+    // onSuccess Callback
+    //
+    function onSuccess() {
+        console.log("recordAudio():Audio Success");
+    }
+
+    // onError Callback 
+    //
+    function onError(error) {
+        alert('code: '    + error.code    + '\n' + 
+              'message: ' + error.message + '\n');
+    }
+
+    // Set audio position
+    // 
+    function setAudioPosition(position) {
+        document.getElementById('audio_position').innerHTML = position;
+    }
+
+    &lt;/script&gt;
+  &lt;/head&gt;
+  &lt;body&gt;
+    &lt;p id="media"&gt;Recording audio...&lt;/p&gt;
+    &lt;p id="audio_position"&gt;&lt;/p&gt;
+  &lt;/body&gt;
+&lt;/html&gt;
+</code></pre>
+
+<h2>
+<a name="media.startRecord_android_quirks">Android Quirks</a>
+</h2>
+
+<ul>
+<li>Android devices record audio in Adaptive Multi-Rate format. The specified file should end with a .amr extension.</li>
+</ul>
+<h2>
+<a name="media.startRecord_blackberry_webworks_quirks">BlackBerry WebWorks Quirks</a>
+</h2>
+
+<ul>
+<li>BlackBerry devices record audio in Adaptive Multi-Rate format. The specified file must end with a .amr extension.</li>
+</ul>
+<h2>
+<a name="media.startRecord_ios_quirks">iOS Quirks</a>
+</h2>
+
+<ul>
+<li>iOS only records to files of type .wav and returns an error if the file name extension is not correct.</li>
+<li>If a full path is not provided the recording will be placed in the <application>/documents/tmp directory.  This can be accessed via the <a href="cordova_file_file.md.html#File">File</a> apis using <a href="cordova_file_file.md.html#LocalFileSystem">LocalFileSystem</a>.TEMPORARY.  Subdirectories are not created at record time and must already exist.  Thus,  myRecording.wav will work but recordings/myRecording.wav will not if the recordings directory does not already exist at <application>/documents/tmp/.</application></application>
+</li>
+<li>
+<p>Files can be recorded and played back using the documents URI:</p>
+
+<pre class="prettyprint"><code>var myMedia = new <a href="cordova_media_media.md.html#Media">Media</a>("documents://beer.mp3")
+</code></pre>
+</li>
+</ul>
+<h2>
+<a name="media.startRecord_tizen_quirks">Tizen Quirks</a>
+</h2>
+
+<ul>
+<li>This API is not supported on Tizen devices.</li>
+</ul>
+<hr>
+<h1><a name="media.stop">media.stop</a></h1>
+
+<p>Stops playing an audio file.</p>
+
+<pre class="prettyprint"><code><a href="cordova_media_media.md.html#media.stop">media.stop</a>();
+</code></pre>
+
+<h2>
+<a name="media.stop_description">Description</a>
+</h2>
+
+<p>Function <code><a href="cordova_media_media.md.html#media.stop">media.stop</a></code> is a synchronous function that stops playing an audio file.</p>
+
+<h2>
+<a name="media.stop_supported_platforms">Supported Platforms</a>
+</h2>
+
+<ul>
+<li>Android</li>
+<li>BlackBerry WebWorks (OS 5.0 and higher)</li>
+<li>iOS</li>
+<li>Windows Phone 7 and 8</li>
+<li>Tizen</li>
+<li>Windows 8</li>
+</ul>
+<h2>
+<a name="media.stop_quick_example">Quick Example</a>
+</h2>
+
+<pre class="prettyprint"><code>// Play audio
+//
+function playAudio(url) {
+    // Play the audio file at url
+    var my_media = new <a href="cordova_media_media.md.html#Media">Media</a>(url,
+        // success callback
+        function() {
+            console.log("playAudio():Audio Success");
+        },
+        // error callback
+        function(err) {
+            console.log("playAudio():Audio Error: "+err);
+    });
+
+    // Play audio
+    my_media.play();
+
+    // Pause after 10 seconds
+    setTimeout(function() {
+        my_media.stop();
+    }, 10000);        
+}
+</code></pre>
+
+<h2>
+<a name="media.stop_full_example">Full Example</a>
+</h2>
+
+<pre class="prettyprint"><code>    &lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+                          "http://www.w3.org/TR/html4/strict.dtd"&gt;
+    &lt;html&gt;
+      &lt;head&gt;
+        &lt;title&gt;<a href="cordova_media_media.md.html#Media">Media</a> Example&lt;/title&gt;
+
+        &lt;script type="text/javascript" charset="utf-8" src="cordova-2.5.0.js"&gt;&lt;/script&gt;
+        &lt;script type="text/javascript" charset="utf-8"&gt;
+
+        // Wait for Cordova to load
+        //
+        document.<a href="cordova_inappbrowser_inappbrowser.md.html#addEventListener">addEventListener</a>("<a href="cordova_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);
+
+        // Cordova is ready
+        //
+        function onDeviceReady() {
+            playAudio("http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3");
+        }
+
+        // Audio player
+        //
+        var my_media = null;
+        var mediaTimer = null;
+
+        // Play audio
+        //
+        function playAudio(src) {
+            // Create <a href="cordova_media_media.md.html#Media">Media</a> object from src
+            my_media = new <a href="cordova_media_media.md.html#Media">Media</a>(src, onSuccess, onError);
+
+            // Play audio
+            my_media.play();
+
+            // Update my_media position every second
+            if (mediaTimer == null) {
+                mediaTimer = setInterval(function() {
+                    // get my_media position
+                    my_media.getCurrentPosition(
+                        // success callback
+                        function(position) {
+                            if (position &gt; -1) {
+                                setAudioPosition((position) + " sec");
+                            }
+                        },
+                        // error callback
+                        function(e) {
+                            console.log("Error getting pos=" + e);
+                            setAudioPosition("Error: " + e);
+                        }
+                    );
+                }, 1000);
+            }
+        }
+
+        // Pause audio
+        // 
+        function pauseAudio() {
+            if (my_media) {
+                my_media.<a href="cordova_events_events.md.html#pause">pause</a>();
+            }
+        }
+
+        // Stop audio
+        // 
+        function stopAudio() {
+            if (my_media) {
+                my_media.stop();
+            }
+            clearInterval(mediaTimer);
+            mediaTimer = null;
+        }
+
+        // onSuccess Callback
+        //
+        function onSuccess() {
+            console.log("playAudio():Audio Success");
+        }
+
+        // onError Callback 
+        //
+        function onError(error) {
+            alert('code: '    + error.code    + '\n' + 
+                  'message: ' + error.message + '\n');
+        }
+
+        // Set audio position
+        // 
+        function setAudioPosition(position) {
+            document.getElementById('audio_position').innerHTML = position;
+        }
+
+        &lt;/script&gt;
+      &lt;/head&gt;
+      &lt;body&gt;
+        &lt;a href="#" class="btn large" onclick="playAudio('http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3');"&gt;Play Audio&lt;/a&gt;
+        &lt;a href="#" class="btn large" onclick="pauseAudio();"&gt;Pause Playing Audio&lt;/a&gt;
+        &lt;a href="#" class="btn large" onclick="stopAudio();"&gt;Stop Playing Audio&lt;/a&gt;
+        &lt;p id="audio_position"&gt;&lt;/p&gt;
+      &lt;/body&gt;
+    &lt;/html&gt;
+</code></pre>
+
+<hr>
+<h1><a name="media.stopRecord">media.stopRecord</a></h1>
+
+<p>Stops recording an audio file.</p>
+
+<pre class="prettyprint"><code><a href="cordova_media_media.md.html#media.stopRecord">media.stopRecord</a>();
+</code></pre>
+
+<h2>
+<a name="media.stopRecord_description">Description</a>
+</h2>
+
+<p>Function <code><a href="cordova_media_media.md.html#media.stopRecord">media.stopRecord</a></code> is a synchronous function that stops recording an audio file.</p>
+
+<h2>
+<a name="media.stopRecord_supported_platforms">Supported Platforms</a>
+</h2>
+
+<ul>
+<li>Android</li>
+<li>BlackBerry WebWorks (OS 5.0 and higher)</li>
+<li>iOS</li>
+<li>Windows Phone 7 and 8</li>
+<li>Windows 8</li>
+</ul>
+<h2>
+<a name="media.stopRecord_quick_example">Quick Example</a>
+</h2>
+
+<pre class="prettyprint"><code>// Record audio
+// 
+function recordAudio() {
+    var src = "myrecording.mp3";
+    var mediaRec = new <a href="cordova_media_media.md.html#Media">Media</a>(src,
+        // success callback
+        function() {
+            console.log("recordAudio():Audio Success");
+        },
+
+        // error callback
+        function(err) {
+            console.log("recordAudio():Audio Error: "+ err.code);
+        });
+
+    // Record audio
+    mediaRec.startRecord();
+
+    // Stop recording after 10 seconds
+    setTimeout(function() {
+        mediaRec.stopRecord();
+    }, 10000);
+}
+</code></pre>
+
+<h2>
+<a name="media.stopRecord_full_example">Full Example</a>
+</h2>
+
+<pre class="prettyprint"><code>&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+  &lt;head&gt;
+    &lt;title&gt;<a href="cordova_device_device.md.html#Device">Device</a> Properties Example&lt;/title&gt;
+
+    &lt;script type="text/javascript" charset="utf-8" src="cordova-2.5.0.js"&gt;&lt;/script&gt;
+    &lt;script type="text/javascript" charset="utf-8"&gt;
+
+    // Wait for Cordova to load
+    //
+    document.<a href="cordova_inappbrowser_inappbrowser.md.html#addEventListener">addEventListener</a>("<a href="cordova_events_events.md.html#deviceready">deviceready</a>", onDeviceReady, false);
+
+    // Record audio
+    // 
+    function recordAudio() {
+        var src = "myrecording.mp3";
+        var mediaRec = new <a href="cordova_media_media.md.html#Media">Media</a>(src, onSuccess, onError);
+
+        // Record audio
+        mediaRec.startRecord();
+
+        // Stop recording after 10 sec
+        var recTime = 0;
+        var recInterval = setInterval(function() {
+            recTime = recTime + 1;
+            setAudioPosition(recTime + " sec");
+            if (recTime &gt;= 10) {
+                clearInterval(recInterval);
+                mediaRec.stopRecord();
+            }
+        }, 1000);
+    }
+
+    // Cordova is ready
+    //
+    function onDeviceReady() {
+        recordAudio();
+    }
+
+    // onSuccess Callback
+    //
+    function onSuccess() {
+        console.log("recordAudio():Audio Success");
+    }
+
+    // onError Callback 
+    //
+    function onError(error) {
+        alert('code: '    + error.code    + '\n' + 
+              'message: ' + error.message + '\n');
+    }
+
+    // Set audio position
+    // 
+    function setAudioPosition(position) {
+        document.getElementById('audio_position').innerHTML = position;
+    }
+
+    &lt;/script&gt;
+  &lt;/head&gt;
+  &lt;body&gt;
+    &lt;p id="media"&gt;Recording audio...&lt;/p&gt;
+    &lt;p id="audio_position"&gt;&lt;/p&gt;
+  &lt;/body&gt;
+&lt;/html&gt;
+</code></pre>
+
+<h2>
+<a name="media.stopRecord_tizen_quirks">Tizen Quirks</a>
+</h2>
+
+<ul>
+<li>This API is not supported on Tizen devices.</li>
+</ul>
+<hr>
+<h1><a name="MediaError">MediaError</a></h1>
+
+<p>A <code><a href="cordova_media_media.md.html#MediaError">MediaError</a></code> object is returned to the <code><a href="cordova_media_media.md.html#mediaError">mediaError</a></code> callback function when an error occurs.</p>
+
+<h2>
+<a name="MediaError_properties">Properties</a>
+</h2>
+
+<ul>
+<li>
+<strong>code:</strong> One of the predefined error codes listed below.</li>
+<li>
+<strong>message:</strong> Error message describing the details of the error.</li>
+</ul>
+<h2>
+<a name="MediaError_constants">Constants</a>
+</h2>
+
+<ul>
+<li><code><a href="cordova_media_media.md.html#MediaError">MediaError</a>.MEDIA_ERR_ABORTED</code></li>
+<li><code><a href="cordova_media_media.md.html#MediaError">MediaError</a>.MEDIA_ERR_NETWORK</code></li>
+<li><code><a href="cordova_media_media.md.html#MediaError">MediaError</a>.MEDIA_ERR_DECODE</code></li>
+<li><code><a href="cordova_media_media.md.html#MediaError">MediaError</a>.MEDIA_ERR_NONE_SUPPORTED</code></li>
+</ul>
+<h2>
+<a name="MediaError_description">Description</a>
+</h2>
+
+<p>The <code><a href="cordova_media_media.md.html#MediaError">MediaError</a></code> object is returned to the user through the <code><a href="cordova_media_media.md.html#mediaError">mediaError</a></code> callback function when an error occurs.</p>
+
+<hr>
+<h1><a name="mediaError">mediaError</a></h1>
+
+<p>A user specified callback function that is invoked when there is an error in media functions.</p>
+
+<pre class="prettyprint"><code>function(error) {
+    // Handle the error
+}
+</code></pre>
+
+<h2>
+<a name="mediaError_parameters">Parameters</a>
+</h2>
+
+<ul>
+<li>
+<strong>error:</strong> The error returned by the device. (<code><a href="cordova_media_media.md.html#MediaError">MediaError</a></code>)</li>
+</ul>
+</div>
+        </div>
+
+        <!-- Functionality and Syntax Highlighting -->
+        <script type="text/javascript" src="index.js"></script><script type="text/javascript" src="prettify/prettify.js"></script>
+</body>
+</html>



Mime
View raw message