You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-4
Original file line number
Diff line number
Diff line change
@@ -24,14 +24,15 @@ For iOS, run `pod install` in the `ios` directory.
24
24
25
25
## Usage
26
26
27
-
1. Setup an Audio Stream using the singleton `AudioManager`'s `shared` static property and calling its `setupAudioStream(sampleRate: number, channelCount: number): void`
27
+
1. Setup an Audio Stream using the singleton `AudioManager`'s `shared` static property and calling its `setupAudioStream`.
28
+
`setupAudioStream` takes in an optional options argument where you can pass in the `sampleRate` and `channelCount` of your audio files, or do not specify them and it will default to `44100` and `2` respectively.
28
29
29
30
[How do I know what `sampleRate` and `channelCount` I need to pass?](#sample-rates-and-channel-counts)
-`setupAudioStream(sampleRate: number = 44100, channelCount: number = 2): void`: sets up the Audio Stream to allow it later be opened.
100
-
Note: You shouldn't setup multiple streams simultaneously because you only need one stream. Trying to setup another one will simply fails because there is already one setup.
100
+
- `setupAudioStream(options?: {
101
+
sampleRate?: number;
102
+
channelCount?: number;
103
+
ios?: {
104
+
audioSessionCategory?: IosAudioSessionCategory;
105
+
};
106
+
android?: {
107
+
usage?: AndroidAudioStreamUsage;
108
+
};
109
+
}): void`: sets up the Audio Stream to allow it later be opened.
110
+
Notes:
111
+
1. You shouldn't setup multiple streams simultaneously because you only need one stream. Trying to setup another one will simply fails because there is already one setup.
112
+
2. You can change the ios audio session category using the `audioSessionCategory` option in the `ios` object. Check [apple docs](https://developer.apple.com/documentation/avfaudio/avaudiosession/category-swift.struct#Getting-Standard-Categories) for more info on the different audio session categories.
113
+
3. You can change the android usage using the `usage` option in the `android` object. Check [here](https://github.com/google/oboe/blob/11afdfcd3e1c46dc2ea4b86c83519ebc2d44a1d4/include/oboe/Definitions.h#L316-L377) for the list of options.
101
114
-`openAudioStream(): void`: Opens the audio stream to allow audio to be played
102
115
Note: You should have called `setupAudioStream` before calling this method. You can't open a stream that hasn't been setup
103
116
-`pauseAudioStream(): void`: Pauses the audio stream (An example of when to use this is when user puts app to background)
0 commit comments