react-native-audio-session
Advanced tools
Comparing version 0.0.5 to 0.0.6
{ | ||
"name": "react-native-audio-session", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "React Native module for handling the AVAudioSession instance on iOS.", | ||
"main": "index.js", | ||
"main": "index", | ||
"scripts": { | ||
@@ -7,0 +7,0 @@ "test": "echo \"Error: no test specified\" && exit 1" |
@@ -18,3 +18,3 @@ # react-native-audio-session | ||
```javascript | ||
import AudioSession, {AudioCategories, AudioOptions, AudioModes} from 'react-native-audio-session' | ||
import AudioSession from 'react-native-audio-session' | ||
@@ -27,3 +27,3 @@ // Set AVAudioSession active | ||
// Set AVAudioSession category | ||
AudioSession.setCategory(AudioCategories.Playback) | ||
AudioSession.setCategory('Playback') | ||
.then(() => { console.log('Success!') }) | ||
@@ -33,3 +33,3 @@ .catch(error => { console.log('Error!') }) | ||
// Set AVAudioSession category and options | ||
AudioSession.setCategory(AudioCategories.Playback, AudioOptions.MixWithOthers) | ||
AudioSession.setCategory('Playback', 'MixWithOthers') | ||
.then(() => { console.log('Success!') }) | ||
@@ -39,3 +39,3 @@ .catch(error => { console.log('Error!') }) | ||
// Set AVAudioSession mode | ||
AudioSession.setMode(AudioModes.VoiceChat) | ||
AudioSession.setMode('VoiceChat') | ||
.then(() => { console.log('Success!') }) | ||
@@ -45,3 +45,3 @@ .catch(error => { console.log('Error!') }) | ||
// Set AVAudioSession category, mode and options | ||
AudioSession.setCategoryAndMode(AudioCategories.Playback, AudioModes.VoiceChat, AudioOptions.MixWithOthers) | ||
AudioSession.setCategoryAndMode('Playback', 'VoiceChat', 'MixWithOthers') | ||
.then(() => { console.log('Success!') }) | ||
@@ -56,3 +56,3 @@ .catch(error => { console.log('Error!') }) | ||
// Get current AVAudioSession options | ||
AudioSession.currentOptions().then(options => { | ||
AudioSession.currentCategoryOptions().then(options => { | ||
console.log(options) | ||
@@ -74,15 +74,15 @@ }) | ||
|---|---|---|---| | ||
|setActive|`Bool`|`Promise`|Set the current AVAudioSession as active [(Reference)](https://developer.apple.com/documentation/avfoundation/avaudiosession/1616627-setactive?language=objc).| | ||
|setCategory|`AudioCategories`, `AudioOptions` (nullable)|`Promise`|Set the current AVAudioSession category [(Reference)](https://developer.apple.com/documentation/avfoundation/avaudiosession/1616442-setcategory?language=objc).| | ||
|setMode|`AudioModes`|`Promise`|Set the current AVAudioSession mode [(Reference)](https://developer.apple.com/documentation/avfoundation/avaudiosession/1616614-setmode?language=objc).| | ||
|setCategoryAndMode|`AudioCategories`, `AudioModes`, `AudioOptions` (nullable)|`Promise`|Set the current AVAudioSession category and mode [(Reference)](https://developer.apple.com/documentation/avfoundation/avaudiosession/1771734-setcategory?language=objc).| | ||
|currentCategory|-|`Promise`|Get the current AVAudioSession category [(Reference)](https://developer.apple.com/documentation/avfoundation/avaudiosession/1616615-category?language=objc).| | ||
|currentOptions|-|`Promise`|Get the current AVAudioSession options [(Reference)](https://developer.apple.com/documentation/avfoundation/avaudiosession/1616503-categoryoptions?language=objc).| | ||
|currentMode|-|`Promise`|Get the current AVAudioSession mode [(Reference)](https://developer.apple.com/documentation/avfoundation/avaudiosession/1616508-mode?language=objc).| | ||
|setActive|`Bool`|`Promise<void>`|Set the current AVAudioSession as active [(Reference)](https://developer.apple.com/documentation/avfoundation/avaudiosession/1616627-setactive?language=objc).| | ||
|setCategory|`AudioCategory`, `AudioCategoryOptions` (nullable)|`Promise<void>`|Set the current AVAudioSession category [(Reference)](https://developer.apple.com/documentation/avfoundation/avaudiosession/1616442-setcategory?language=objc).| | ||
|setMode|`AudioMode`|`Promise<void>`|Set the current AVAudioSession mode [(Reference)](https://developer.apple.com/documentation/avfoundation/avaudiosession/1616614-setmode?language=objc).| | ||
|setCategoryAndMode|`AudioCategory`, `AudioMode`, `AudioCategoryOptions` (nullable)|`Promise<void>`|Set the current AVAudioSession category and mode [(Reference)](https://developer.apple.com/documentation/avfoundation/avaudiosession/1771734-setcategory?language=objc).| | ||
|currentCategory|-|`Promise<AudioCategory>`|Get the current AVAudioSession category [(Reference)](https://developer.apple.com/documentation/avfoundation/avaudiosession/1616615-category?language=objc).| | ||
|currentOptions|-|`Promise<AudioCategoryOptions>`|Get the current AVAudioSession options [(Reference)](https://developer.apple.com/documentation/avfoundation/avaudiosession/1616503-categoryoptions?language=objc).| | ||
|currentMode|-|`Promise<AudioMode>`|Get the current AVAudioSession mode [(Reference)](https://developer.apple.com/documentation/avfoundation/avaudiosession/1616508-mode?language=objc).| | ||
### Objects | ||
#### AudioCategories | ||
The `AudioCategories` param to all methods. Corresponds to `AVAudioSessionCategory` in iOS. Read more: [Audio Session Categories (developer.apple.com)](https://developer.apple.com/documentation/avfoundation/avaudiosession/audio_session_categories?language=objc) | ||
### Params | ||
#### AudioCategory | ||
The `AudioCategory` param to all methods. Corresponds to `AVAudioSessionCategory` in iOS. Read more: [Audio Session Category (developer.apple.com)](https://developer.apple.com/documentation/avfoundation/avaudiosessioncategory?language=objc) | ||
| Key | Value | | ||
| Param | AVAudioSessionCategory | | ||
|---|---| | ||
@@ -96,6 +96,6 @@ |`Ambient`|`AVAudioSessionCategoryAmbient`| | ||
#### AudioOptions | ||
The `AudioOptions` param to all methods. Corresponds to `AVAudioSessionCategoryOptions` in iOS. Read more: [AVAudioSessionCategoryOptions (developer.apple.com)](https://developer.apple.com/documentation/avfoundation/avaudiosessioncategoryoptions?language=objc) | ||
#### AudioCategoryOptions | ||
The `AudioCategoryOptions` param to all methods. Corresponds to `AVAudioSessionCategoryOptions` in iOS. Read more: [AVAudioSessionCategoryOptions (developer.apple.com)](https://developer.apple.com/documentation/avfoundation/avaudiosessioncategoryoptions?language=objc) | ||
| Key | Value | | ||
| Param | AVAudioSessionCategoryOptions | | ||
|---|---| | ||
@@ -110,6 +110,6 @@ |`MixWithOthers`|`AVAudioSessionCategoryOptionMixWithOthers`| | ||
#### AudioModes | ||
The `AudioModes` param to all methods. Corresponds to `AVAudioSessionModes` in iOS. Read more: [Audio Session Modes (developer.apple.com)](https://developer.apple.com/documentation/avfoundation/avaudiosession/audio_session_modes?language=objc) | ||
#### AudioMode | ||
The `AudioMode` param to all methods. Corresponds to `AVAudioSessionMode` in iOS. Read more: [Audio Session Mode (developer.apple.com)](https://developer.apple.com/documentation/avfoundation/avaudiosessionmode?language=objc) | ||
| Key | Value | | ||
| Param | AVAudioSessionMode | | ||
|---|---| | ||
@@ -116,0 +116,0 @@ |`Default`|`AVAudioSessionModeDefault`| |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
27519
11
99
1