Skip to content

Commit f0a0bb8

Browse files
committed
CB-12034 (ios) Add mandatory iOS 10 privacy description
This closes #119
1 parent 6f28f94 commit f0a0bb8

File tree

2 files changed

+41
-29
lines changed

2 files changed

+41
-29
lines changed

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ function recordAudio() {
312312

313313
// Pause Recording after 5 seconds
314314
setTimeout(function() {
315-
my_media.pauseRecord();
315+
mediaRec.pauseRecord();
316316
}, 5000);
317317
}
318318
```
@@ -427,12 +427,12 @@ function recordAudio() {
427427

428428
// Pause Recording after 5 seconds
429429
setTimeout(function() {
430-
my_media.pauseRecord();
430+
mediaRec.pauseRecord();
431431
}, 5000);
432432

433433
// Resume Recording after 10 seconds
434434
setTimeout(function() {
435-
my_media.resumeRecord();
435+
mediaRec.resumeRecord();
436436
}, 10000);
437437
}
438438
```
@@ -563,6 +563,14 @@ function recordAudio() {
563563

564564
var myMedia = new Media("documents://beer.mp3")
565565

566+
- Since iOS 10 it's mandatory to add a `NSMicrophoneUsageDescription` entry in the info.plist.
567+
568+
`NSMicrophoneUsageDescription` describes the reason that the app accesses the user’s microphone. When the system prompts the user to allow access, this string is displayed as part of the dialog box. To add this entry you can pass the variable `MICROPHONE_USAGE_DESCRIPTION` on plugin install.
569+
570+
Example: `cordova plugin add cordova-plugin-media --variable MICROPHONE_USAGE_DESCRIPTION="your usage message"`
571+
572+
If you don't pass the variable, the plugin will add an empty string as value.
573+
566574
### Windows Quirks
567575

568576
- Windows devices can use MP3, M4A and WMA formats for recorded audio. However in most cases it is not possible to use MP3 for audio recording on _Windows Phone 8.1_ devices, because an MP3 encoder is [not shipped with Windows Phone](https://msdn.microsoft.com/en-us/library/windows/apps/windows.media.mediaproperties.mediaencodingprofile.createmp3.aspx).

plugin.xml

Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ id="cordova-plugin-media"
5959
<source-file src="src/android/AudioHandler.java" target-dir="src/org/apache/cordova/media" />
6060
<source-file src="src/android/AudioPlayer.java" target-dir="src/org/apache/cordova/media" />
6161
<source-file src="src/android/FileHelper.java" target-dir="src/org/apache/cordova/media" />
62-
</platform>
62+
</platform>
6363

6464
<!-- amazon-fireos -->
6565
<platform name="amazon-fireos">
@@ -79,31 +79,35 @@ id="cordova-plugin-media"
7979
<source-file src="src/android/AudioHandler.java" target-dir="src/org/apache/cordova/media" />
8080
<source-file src="src/android/AudioPlayer.java" target-dir="src/org/apache/cordova/media" />
8181
<source-file src="src/android/FileHelper.java" target-dir="src/org/apache/cordova/media" />
82-
</platform>
83-
84-
85-
<!-- ubuntu -->
86-
<platform name="ubuntu">
87-
<config-file target="config.xml" parent="/*">
88-
<feature name="Media">
89-
<param policy_group="microphone" policy_version="1" />
90-
<param policy_group="video" policy_version="1" />
91-
</feature>
92-
</config-file>
93-
<header-file src="src/ubuntu/media.h" />
94-
<source-file src="src/ubuntu/media.cpp" />
95-
</platform>
96-
97-
<!-- ios -->
98-
<platform name="ios">
99-
<config-file target="config.xml" parent="/*">
100-
<feature name="Media">
101-
<param name="ios-package" value="CDVSound" />
102-
</feature>
103-
</config-file>
104-
<header-file src="src/ios/CDVSound.h" />
105-
<source-file src="src/ios/CDVSound.m" />
106-
</platform>
82+
</platform>
83+
84+
85+
<!-- ubuntu -->
86+
<platform name="ubuntu">
87+
<config-file target="config.xml" parent="/*">
88+
<feature name="Media">
89+
<param policy_group="microphone" policy_version="1" />
90+
<param policy_group="video" policy_version="1" />
91+
</feature>
92+
</config-file>
93+
<header-file src="src/ubuntu/media.h" />
94+
<source-file src="src/ubuntu/media.cpp" />
95+
</platform>
96+
97+
<!-- ios -->
98+
<platform name="ios">
99+
<config-file target="config.xml" parent="/*">
100+
<feature name="Media">
101+
<param name="ios-package" value="CDVSound" />
102+
</feature>
103+
</config-file>
104+
<header-file src="src/ios/CDVSound.h" />
105+
<source-file src="src/ios/CDVSound.m" />
106+
<preference name="MICROPHONE_USAGE_DESCRIPTION" default=" " />
107+
<config-file target="*-Info.plist" parent="NSMicrophoneUsageDescription">
108+
<string>$MICROPHONE_USAGE_DESCRIPTION</string>
109+
</config-file>
110+
</platform>
107111

108112
<!-- blackberry10 -->
109113
<platform name="blackberry10">

0 commit comments

Comments
 (0)