summaryrefslogtreecommitdiff
path: root/plugins/org.apache.cordova.media
diff options
context:
space:
mode:
authorArjun Roychowdhury <pliablepixels@gmail.com>2015-10-29 11:13:49 -0400
committerArjun Roychowdhury <pliablepixels@gmail.com>2015-10-29 11:13:49 -0400
commitd14b7014abb0de4bbc57736af4651886c4372a9d (patch)
tree5db5618b3b54cafbd60bff503b5a33f617f63331 /plugins/org.apache.cordova.media
parent746bf3b4daceb92896509997d4e952fe0a842779 (diff)
#56 - forked a version of cordova-media and took out permissions I don't need
Diffstat (limited to 'plugins/org.apache.cordova.media')
-rw-r--r--plugins/org.apache.cordova.media/package.json26
-rw-r--r--plugins/org.apache.cordova.media/plugin.xml9
2 files changed, 1 insertions, 34 deletions
diff --git a/plugins/org.apache.cordova.media/package.json b/plugins/org.apache.cordova.media/package.json
deleted file mode 100644
index a94642a1..00000000
--- a/plugins/org.apache.cordova.media/package.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "version": "0.2.16",
- "name": "org.apache.cordova.media",
- "cordova_name": "Media",
- "description": "Cordova Media Plugin",
- "license": "Apache 2.0",
- "repo": "https://git-wip-us.apache.org/repos/asf/cordova-plugin-media.git",
- "issue": "https://issues.apache.org/jira/browse/CB/component/12320647",
- "keywords": [
- "cordova",
- "media"
- ],
- "platforms": [
- "android",
- "amazon-fireos",
- "ubuntu",
- "ios",
- "blackberry10",
- "wp7",
- "wp8",
- "windows8",
- "tizen"
- ],
- "engines": [],
- "englishdoc": "<!---\n Licensed to the Apache Software Foundation (ASF) under one\n or more contributor license agreements. See the NOTICE file\n distributed with this work for additional information\n regarding copyright ownership. The ASF licenses this file\n to you under the Apache License, Version 2.0 (the\n \"License\"); you may not use this file except in compliance\n with the License. You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing,\n software distributed under the License is distributed on an\n \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n KIND, either express or implied. See the License for the\n specific language governing permissions and limitations\n under the License.\n-->\n\n# org.apache.cordova.media\n\nThis plugin provides the ability to record and play back audio files on a device.\n\n__NOTE__: The current implementation does not adhere to a W3C\nspecification for media capture, and is provided for convenience only.\nA future implementation will adhere to the latest W3C specification\nand may deprecate the current APIs.\n\nThis plugin defines a global `Media` Constructor.\n\nAlthough in the global scope, it is not available until after the `deviceready` event.\n\n document.addEventListener(\"deviceready\", onDeviceReady, false);\n function onDeviceReady() {\n console.log(Media);\n }\n\n## Installation\n\n cordova plugin add org.apache.cordova.media\n\n## Supported Platforms\n\n- Android\n- BlackBerry 10\n- iOS\n- Windows Phone 7 and 8\n- Tizen\n- Windows 8\n\n## Windows Phone Quirks\n\n- Only one media file can be played back at a time.\n\n- There are strict restrictions on how your application interacts with other media. See the [Microsoft documentation for details][url].\n\n[url]: http://msdn.microsoft.com/en-us/library/windowsphone/develop/hh184838(v=vs.92).aspx\n\n## Media\n\n var media = new Media(src, mediaSuccess, [mediaError], [mediaStatus]);\n\n### Parameters\n\n- __src__: A URI containing the audio content. _(DOMString)_\n\n- __mediaSuccess__: (Optional) The callback that executes after a `Media` object has completed the current play, record, or stop action. _(Function)_\n\n- __mediaError__: (Optional) The callback that executes if an error occurs. _(Function)_\n\n- __mediaStatus__: (Optional) The callback that executes to indicate status changes. _(Function)_\n\n### Constants\n\nThe following constants are reported as the only parameter to the\n`mediaStatus` callback:\n\n- `Media.MEDIA_NONE` = 0;\n- `Media.MEDIA_STARTING` = 1;\n- `Media.MEDIA_RUNNING` = 2;\n- `Media.MEDIA_PAUSED` = 3;\n- `Media.MEDIA_STOPPED` = 4;\n\n### Methods\n\n- `media.getCurrentPosition`: Returns the current position within an audio file.\n\n- `media.getDuration`: Returns the duration of an audio file.\n\n- `media.play`: Start or resume playing an audio file.\n\n- `media.pause`: Pause playback of an audio file.\n\n- `media.release`: Releases the underlying operating system's audio resources.\n\n- `media.seekTo`: Moves the position within the audio file.\n\n- `media.setVolume`: Set the volume for audio playback.\n\n- `media.startRecord`: Start recording an audio file.\n\n- `media.stopRecord`: Stop recording an audio file.\n\n- `media.stop`: Stop playing an audio file.\n\n### Additional ReadOnly Parameters\n\n- __position__: The position within the audio playback, in seconds.\n - Not automatically updated during play; call `getCurrentPosition` to update.\n\n- __duration__: The duration of the media, in seconds.\n\n\n## media.getCurrentPosition\n\nReturns the current position within an audio file. Also updates the `Media` object's `position` parameter.\n\n media.getCurrentPosition(mediaSuccess, [mediaError]);\n\n### Parameters\n\n- __mediaSuccess__: The callback that is passed the current position in seconds.\n\n- __mediaError__: (Optional) The callback to execute if an error occurs.\n\n### Quick Example\n\n // Audio player\n //\n var my_media = new Media(src, onSuccess, onError);\n\n // Update media position every second\n var mediaTimer = setInterval(function () {\n // get media position\n my_media.getCurrentPosition(\n // success callback\n function (position) {\n if (position > -1) {\n console.log((position) + \" sec\");\n }\n },\n // error callback\n function (e) {\n console.log(\"Error getting pos=\" + e);\n }\n );\n }, 1000);\n\n\n## media.getDuration\n\nReturns the duration of an audio file in seconds. If the duration is unknown, it returns a value of -1.\n\n\n media.getDuration();\n\n### Quick Example\n\n // Audio player\n //\n var my_media = new Media(src, onSuccess, onError);\n\n // Get duration\n var counter = 0;\n var timerDur = setInterval(function() {\n counter = counter + 100;\n if (counter > 2000) {\n clearInterval(timerDur);\n }\n var dur = my_media.getDuration();\n if (dur > 0) {\n clearInterval(timerDur);\n document.getElementById('audio_duration').innerHTML = (dur) + \" sec\";\n }\n }, 100);\n\n\n## media.pause\n\nPauses playing an audio file.\n\n media.pause();\n\n\n### Quick Example\n\n // Play audio\n //\n function playAudio(url) {\n // Play the audio file at url\n var my_media = new Media(url,\n // success callback\n function () { console.log(\"playAudio():Audio Success\"); },\n // error callback\n function (err) { console.log(\"playAudio():Audio Error: \" + err); }\n );\n\n // Play audio\n my_media.play();\n\n // Pause after 10 seconds\n setTimeout(function () {\n media.pause();\n }, 10000);\n }\n\n\n## media.play\n\nStarts or resumes playing an audio file.\n\n media.play();\n\n\n### Quick Example\n\n // Play audio\n //\n function playAudio(url) {\n // Play the audio file at url\n var my_media = new Media(url,\n // success callback\n function () {\n console.log(\"playAudio():Audio Success\");\n },\n // error callback\n function (err) {\n console.log(\"playAudio():Audio Error: \" + err);\n }\n );\n // Play audio\n my_media.play();\n }\n\n\n### iOS Quirks\n\n- __numberOfLoops__: Pass this option to the `play` method to specify\n the number of times you want the media file to play, e.g.:\n\n var myMedia = new Media(\"http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3\")\n myMedia.play({ numberOfLoops: 2 })\n\n- __playAudioWhenScreenIsLocked__: Pass in this option to the `play`\n method to specify whether you want to allow playback when the screen\n is locked. If set to `true` (the default value), the state of the\n hardware mute button is ignored, e.g.:\n\n var myMedia = new Media(\"http://audio.ibeat.org/content/p1rj1s/p1rj1s_-_rockGuitar.mp3\")\n myMedia.play({ playAudioWhenScreenIsLocked : false })\n\n- __order of file search__: When only a file name or simple path is\n provided, iOS searches in the `www` directory for the file, then in\n the application's `documents/tmp` directory:\n\n var myMedia = new Media(\"audio/beer.mp3\")\n myMedia.play() // first looks for file in www/audio/beer.mp3 then in <application>/documents/tmp/audio/beer.mp3\n\n## media.release\n\nReleases the underlying operating system's audio resources.\nThis is particularly important for Android, since there are a finite amount of\nOpenCore instances for media playback. Applications should call the `release`\nfunction for any `Media` resource that is no longer needed.\n\n media.release();\n\n\n### Quick Example\n\n // Audio player\n //\n var my_media = new Media(src, onSuccess, onError);\n\n my_media.play();\n my_media.stop();\n my_media.release();\n\n\n## media.seekTo\n\nSets the current position within an audio file.\n\n media.seekTo(milliseconds);\n\n### Parameters\n\n- __milliseconds__: The position to set the playback position within the audio, in milliseconds.\n\n\n### Quick Example\n\n // Audio player\n //\n var my_media = new Media(src, onSuccess, onError);\n my_media.play();\n // SeekTo to 10 seconds after 5 seconds\n setTimeout(function() {\n my_media.seekTo(10000);\n }, 5000);\n\n\n### BlackBerry 10 Quirks\n\n- Not supported on BlackBerry OS 5 devices.\n\n## media.setVolume\n\nSet the volume for an audio file.\n\n media.setVolume(volume);\n\n### Parameters\n\n- __volume__: The volume to set for playback. The value must be within the range of 0.0 to 1.0.\n\n### Supported Platforms\n\n- Android\n- iOS\n\n### Quick Example\n\n // Play audio\n //\n function playAudio(url) {\n // Play the audio file at url\n var my_media = new Media(url,\n // success callback\n function() {\n console.log(\"playAudio():Audio Success\");\n },\n // error callback\n function(err) {\n console.log(\"playAudio():Audio Error: \"+err);\n });\n\n // Play audio\n my_media.play();\n\n // Mute volume after 2 seconds\n setTimeout(function() {\n my_media.setVolume('0.0');\n }, 2000);\n\n // Set volume to 1.0 after 5 seconds\n setTimeout(function() {\n my_media.setVolume('1.0');\n }, 5000);\n }\n\n\n## media.startRecord\n\nStarts recording an audio file.\n\n media.startRecord();\n\n### Supported Platforms\n\n- Android\n- iOS\n- Windows Phone 7 and 8\n- Windows 8\n\n### Quick Example\n\n // Record audio\n //\n function recordAudio() {\n var src = \"myrecording.mp3\";\n var mediaRec = new Media(src,\n // success callback\n function() {\n console.log(\"recordAudio():Audio Success\");\n },\n\n // error callback\n function(err) {\n console.log(\"recordAudio():Audio Error: \"+ err.code);\n });\n\n // Record audio\n mediaRec.startRecord();\n }\n\n\n### Android Quirks\n\n- Android devices record audio in Adaptive Multi-Rate format. The specified file should end with a _.amr_ extension.\n- The hardware volume controls are wired up to the media volume while any Media objects are alive. Once the last created Media object has `release()` called on it, the volume controls revert to their default behaviour. The controls are also reset on page navigation, as this releases all Media objects.\n\n### iOS Quirks\n\n- iOS only records to files of type _.wav_ and returns an error if the file name extension is not correct.\n\n- If a full path is not provided, the recording is placed in the application's `documents/tmp` directory. This can be accessed via the `File` API using `LocalFileSystem.TEMPORARY`. Any subdirectory specified at record time must already exist.\n\n- Files can be recorded and played back using the documents URI:\n\n var myMedia = new Media(\"documents://beer.mp3\")\n\n### Windows 8 Quirks\n\n- If a full path is not provided, the recording is placed in the AppData/temp directory. This can be accessed via the `File` API using `LocalFileSystem.TEMPORARY` or 'ms-appdata:///temp/<filename>' URI.\n\n- Any subdirectory specified at record time must already exist.\n\n### Tizen Quirks\n\n- Not supported on Tizen devices.\n\n## media.stop\n\nStops playing an audio file.\n\n media.stop();\n\n### Quick Example\n\n // Play audio\n //\n function playAudio(url) {\n // Play the audio file at url\n var my_media = new Media(url,\n // success callback\n function() {\n console.log(\"playAudio():Audio Success\");\n },\n // error callback\n function(err) {\n console.log(\"playAudio():Audio Error: \"+err);\n }\n );\n\n // Play audio\n my_media.play();\n\n // Pause after 10 seconds\n setTimeout(function() {\n my_media.stop();\n }, 10000);\n }\n\n\n## media.stopRecord\n\nStops recording an audio file.\n\n media.stopRecord();\n\n### Supported Platforms\n\n- Android\n- iOS\n- Windows Phone 7 and 8\n- Windows 8\n\n### Quick Example\n\n // Record audio\n //\n function recordAudio() {\n var src = \"myrecording.mp3\";\n var mediaRec = new Media(src,\n // success callback\n function() {\n console.log(\"recordAudio():Audio Success\");\n },\n\n // error callback\n function(err) {\n console.log(\"recordAudio():Audio Error: \"+ err.code);\n }\n );\n\n // Record audio\n mediaRec.startRecord();\n\n // Stop recording after 10 seconds\n setTimeout(function() {\n mediaRec.stopRecord();\n }, 10000);\n }\n\n\n### Tizen Quirks\n\n- Not supported on Tizen devices.\n\n## MediaError\n\nA `MediaError` object is returned to the `mediaError` callback\nfunction when an error occurs.\n\n### Properties\n\n- __code__: One of the predefined error codes listed below.\n\n- __message__: An error message describing the details of the error.\n\n### Constants\n\n- `MediaError.MEDIA_ERR_ABORTED` = 1\n- `MediaError.MEDIA_ERR_NETWORK` = 2\n- `MediaError.MEDIA_ERR_DECODE` = 3\n- `MediaError.MEDIA_ERR_NONE_SUPPORTED` = 4\n\n"
-} \ No newline at end of file
diff --git a/plugins/org.apache.cordova.media/plugin.xml b/plugins/org.apache.cordova.media/plugin.xml
index 676665de..dd2d08d7 100644
--- a/plugins/org.apache.cordova.media/plugin.xml
+++ b/plugins/org.apache.cordova.media/plugin.xml
@@ -49,10 +49,6 @@ id="org.apache.cordova.media"
</config-file>
<config-file target="AndroidManifest.xml" parent="/*">
- <uses-permission android:name="android.permission.RECORD_AUDIO" />
- <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
- <uses-permission android:name="android.permission.READ_PHONE_STATE" />
</config-file>
<source-file src="src/android/AudioHandler.java" target-dir="src/org/apache/cordova/media" />
@@ -69,10 +65,7 @@ id="org.apache.cordova.media"
</config-file>
<config-file target="AndroidManifest.xml" parent="/*">
- <uses-permission android:name="android.permission.RECORD_AUDIO" />
- <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
- <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
- <uses-permission android:name="android.permission.READ_PHONE_STATE" />
+
</config-file>
<source-file src="src/android/AudioHandler.java" target-dir="src/org/apache/cordova/media" />