react-native-audio-api 0.12.0-nightly-75589dc-20260121 → 0.12.0-nightly-6a44b58-20260123
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/src/main/java/com/swmansion/audioapi/AudioAPIModule.kt +16 -2
- package/android/src/main/java/com/swmansion/audioapi/system/AudioFocusListener.kt +7 -3
- package/android/src/main/java/com/swmansion/audioapi/system/MediaSessionManager.kt +6 -6
- package/common/cpp/audioapi/HostObjects/analysis/AnalyserNodeHostObject.cpp +4 -2
- package/common/cpp/audioapi/HostObjects/analysis/AnalyserNodeHostObject.h +1 -2
- package/common/cpp/audioapi/HostObjects/effects/BiquadFilterNodeHostObject.cpp +4 -2
- package/common/cpp/audioapi/HostObjects/effects/BiquadFilterNodeHostObject.h +1 -0
- package/common/cpp/audioapi/HostObjects/effects/WaveShaperNodeHostObject.cpp +4 -3
- package/common/cpp/audioapi/HostObjects/effects/WaveShaperNodeHostObject.h +2 -0
- package/common/cpp/audioapi/HostObjects/sources/AudioBufferQueueSourceNodeHostObject.cpp +18 -0
- package/common/cpp/audioapi/HostObjects/sources/AudioBufferQueueSourceNodeHostObject.h +4 -0
- package/common/cpp/audioapi/HostObjects/sources/OscillatorNodeHostObject.cpp +4 -2
- package/common/cpp/audioapi/HostObjects/sources/OscillatorNodeHostObject.h +1 -0
- package/common/cpp/audioapi/HostObjects/utils/JsEnumParser.cpp +127 -0
- package/common/cpp/audioapi/HostObjects/utils/JsEnumParser.h +17 -0
- package/common/cpp/audioapi/core/analysis/AnalyserNode.cpp +8 -8
- package/common/cpp/audioapi/core/analysis/AnalyserNode.h +2 -26
- package/common/cpp/audioapi/core/effects/BiquadFilterNode.cpp +4 -4
- package/common/cpp/audioapi/core/effects/BiquadFilterNode.h +3 -50
- package/common/cpp/audioapi/core/effects/WaveShaperNode.cpp +5 -5
- package/common/cpp/audioapi/core/effects/WaveShaperNode.h +2 -25
- package/common/cpp/audioapi/core/sources/AudioBufferQueueSourceNode.cpp +29 -14
- package/common/cpp/audioapi/core/sources/AudioBufferQueueSourceNode.h +7 -0
- package/common/cpp/audioapi/core/sources/AudioBufferSourceNode.cpp +1 -1
- package/common/cpp/audioapi/core/sources/AudioBufferSourceNode.h +1 -1
- package/common/cpp/audioapi/core/sources/OscillatorNode.cpp +4 -4
- package/common/cpp/audioapi/core/sources/OscillatorNode.h +2 -37
- package/common/cpp/audioapi/events/AudioEventHandlerRegistry.h +8 -2
- package/common/cpp/test/src/core/effects/WaveShaperNodeTest.cpp +2 -1
- package/development/react/package.json +6 -0
- package/ios/audioapi/ios/AudioAPIModule.h +2 -2
- package/ios/audioapi/ios/AudioAPIModule.mm +3 -3
- package/ios/audioapi/ios/system/AudioEngine.mm +3 -1
- package/ios/audioapi/ios/system/AudioSessionManager.h +1 -0
- package/ios/audioapi/ios/system/{NotificationManager.h → SystemNotificationManager.h} +1 -1
- package/ios/audioapi/ios/system/{NotificationManager.mm → SystemNotificationManager.mm} +9 -4
- package/lib/commonjs/core/AudioBufferQueueSourceNode.js +15 -0
- package/lib/commonjs/core/AudioBufferQueueSourceNode.js.map +1 -1
- package/lib/commonjs/core/AudioBufferSourceNode.js +0 -6
- package/lib/commonjs/core/AudioBufferSourceNode.js.map +1 -1
- package/lib/commonjs/core/AudioScheduledSourceNode.js.map +1 -1
- package/lib/commonjs/core/BaseAudioContext.js +2 -2
- package/lib/commonjs/core/BaseAudioContext.js.map +1 -1
- package/lib/commonjs/core/OscillatorNode.js +0 -6
- package/lib/commonjs/core/OscillatorNode.js.map +1 -1
- package/lib/commonjs/development/react/Audio/Audio.js +26 -0
- package/lib/commonjs/development/react/Audio/Audio.js.map +1 -0
- package/lib/commonjs/development/react/Audio/Audio.web.js +12 -0
- package/lib/commonjs/development/react/Audio/Audio.web.js.map +1 -0
- package/lib/commonjs/development/react/Audio/index.js +14 -0
- package/lib/commonjs/development/react/Audio/index.js.map +1 -0
- package/lib/commonjs/development/react/Audio/types.js +2 -0
- package/lib/commonjs/development/react/Audio/types.js.map +1 -0
- package/lib/commonjs/development/react/Audio/utils.js +67 -0
- package/lib/commonjs/development/react/Audio/utils.js.map +1 -0
- package/lib/commonjs/development/react/index.js +28 -0
- package/lib/commonjs/development/react/index.js.map +1 -0
- package/lib/commonjs/specs/NativeAudioAPIModule.js.map +1 -1
- package/lib/commonjs/specs/NativeAudioAPIModule.web.js.map +1 -1
- package/lib/commonjs/system/AudioManager.js +7 -2
- package/lib/commonjs/system/AudioManager.js.map +1 -1
- package/lib/commonjs/web-core/AudioScheduledSourceNode.js +4 -2
- package/lib/commonjs/web-core/AudioScheduledSourceNode.js.map +1 -1
- package/lib/module/core/AudioBufferQueueSourceNode.js +15 -0
- package/lib/module/core/AudioBufferQueueSourceNode.js.map +1 -1
- package/lib/module/core/AudioBufferSourceNode.js +0 -6
- package/lib/module/core/AudioBufferSourceNode.js.map +1 -1
- package/lib/module/core/AudioScheduledSourceNode.js.map +1 -1
- package/lib/module/core/BaseAudioContext.js +2 -2
- package/lib/module/core/BaseAudioContext.js.map +1 -1
- package/lib/module/core/OscillatorNode.js +0 -6
- package/lib/module/core/OscillatorNode.js.map +1 -1
- package/lib/module/development/react/Audio/Audio.js +22 -0
- package/lib/module/development/react/Audio/Audio.js.map +1 -0
- package/lib/module/development/react/Audio/Audio.web.js +8 -0
- package/lib/module/development/react/Audio/Audio.web.js.map +1 -0
- package/lib/module/development/react/Audio/index.js +4 -0
- package/lib/module/development/react/Audio/index.js.map +1 -0
- package/lib/module/development/react/Audio/types.js +2 -0
- package/lib/module/development/react/Audio/types.js.map +1 -0
- package/lib/module/development/react/Audio/utils.js +62 -0
- package/lib/module/development/react/Audio/utils.js.map +1 -0
- package/lib/module/development/react/index.js +5 -0
- package/lib/module/development/react/index.js.map +1 -0
- package/lib/module/specs/NativeAudioAPIModule.js.map +1 -1
- package/lib/module/specs/NativeAudioAPIModule.web.js.map +1 -1
- package/lib/module/system/AudioManager.js +7 -2
- package/lib/module/system/AudioManager.js.map +1 -1
- package/lib/module/web-core/AudioScheduledSourceNode.js +4 -2
- package/lib/module/web-core/AudioScheduledSourceNode.js.map +1 -1
- package/lib/typescript/core/AudioBufferQueueSourceNode.d.ts +5 -0
- package/lib/typescript/core/AudioBufferQueueSourceNode.d.ts.map +1 -1
- package/lib/typescript/core/AudioBufferSourceNode.d.ts +0 -2
- package/lib/typescript/core/AudioBufferSourceNode.d.ts.map +1 -1
- package/lib/typescript/core/AudioScheduledSourceNode.d.ts +3 -3
- package/lib/typescript/core/AudioScheduledSourceNode.d.ts.map +1 -1
- package/lib/typescript/core/BaseAudioContext.d.ts +4 -4
- package/lib/typescript/core/BaseAudioContext.d.ts.map +1 -1
- package/lib/typescript/core/OscillatorNode.d.ts +0 -3
- package/lib/typescript/core/OscillatorNode.d.ts.map +1 -1
- package/lib/typescript/development/react/Audio/Audio.d.ts +5 -0
- package/lib/typescript/development/react/Audio/Audio.d.ts.map +1 -0
- package/lib/typescript/development/react/Audio/Audio.web.d.ts +5 -0
- package/lib/typescript/development/react/Audio/Audio.web.d.ts.map +1 -0
- package/lib/typescript/development/react/Audio/index.d.ts +3 -0
- package/lib/typescript/development/react/Audio/index.d.ts.map +1 -0
- package/lib/typescript/development/react/Audio/types.d.ts +47 -0
- package/lib/typescript/development/react/Audio/types.d.ts.map +1 -0
- package/lib/typescript/development/react/Audio/utils.d.ts +4 -0
- package/lib/typescript/development/react/Audio/utils.d.ts.map +1 -0
- package/lib/typescript/development/react/index.d.ts +3 -0
- package/lib/typescript/development/react/index.d.ts.map +1 -0
- package/lib/typescript/events/types.d.ts +6 -4
- package/lib/typescript/events/types.d.ts.map +1 -1
- package/lib/typescript/interfaces.d.ts +1 -0
- package/lib/typescript/interfaces.d.ts.map +1 -1
- package/lib/typescript/specs/NativeAudioAPIModule.d.ts +2 -1
- package/lib/typescript/specs/NativeAudioAPIModule.d.ts.map +1 -1
- package/lib/typescript/specs/NativeAudioAPIModule.web.d.ts +2 -2
- package/lib/typescript/specs/NativeAudioAPIModule.web.d.ts.map +1 -1
- package/lib/typescript/system/AudioManager.d.ts +2 -2
- package/lib/typescript/system/AudioManager.d.ts.map +1 -1
- package/lib/typescript/system/types.d.ts +2 -1
- package/lib/typescript/system/types.d.ts.map +1 -1
- package/lib/typescript/web-core/AudioScheduledSourceNode.d.ts +2 -0
- package/lib/typescript/web-core/AudioScheduledSourceNode.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/core/AudioBufferQueueSourceNode.ts +31 -0
- package/src/core/AudioBufferSourceNode.ts +0 -10
- package/src/core/AudioScheduledSourceNode.ts +4 -4
- package/src/core/BaseAudioContext.ts +6 -6
- package/src/core/OscillatorNode.ts +0 -11
- package/src/development/react/Audio/Audio.tsx +24 -0
- package/src/development/react/Audio/Audio.web.tsx +9 -0
- package/src/development/react/Audio/index.ts +3 -0
- package/src/development/react/Audio/types.ts +64 -0
- package/src/development/react/Audio/utils.ts +86 -0
- package/src/development/react/index.ts +2 -0
- package/src/events/types.ts +6 -4
- package/src/interfaces.ts +3 -0
- package/src/specs/NativeAudioAPIModule.ts +6 -1
- package/src/specs/NativeAudioAPIModule.web.ts +6 -2
- package/src/system/AudioManager.ts +8 -2
- package/src/system/types.ts +7 -1
- package/src/web-core/AudioScheduledSourceNode.tsx +6 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
export interface AudioURISource {
|
|
2
|
+
uri?: string | undefined;
|
|
3
|
+
// bundle?: string | undefined;
|
|
4
|
+
method?: string | undefined;
|
|
5
|
+
headers?: { [key: string]: string } | undefined;
|
|
6
|
+
// cache?: 'default' | 'reload' | 'force-cache' | 'only-if-cached' | undefined;
|
|
7
|
+
body?: string | undefined;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type AudioRequireSource = number;
|
|
11
|
+
|
|
12
|
+
export interface TimeRanges {
|
|
13
|
+
length: number;
|
|
14
|
+
start(index: number): number;
|
|
15
|
+
end(index: number): number;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type AudioSource =
|
|
19
|
+
| AudioURISource
|
|
20
|
+
| AudioRequireSource
|
|
21
|
+
| ReadonlyArray<AudioURISource>;
|
|
22
|
+
|
|
23
|
+
export type PreloadType = 'auto' | 'metadata' | 'none';
|
|
24
|
+
|
|
25
|
+
interface AudioControlProps {
|
|
26
|
+
autoPlay: boolean;
|
|
27
|
+
controls: boolean; // TBD: should we support control display at all?
|
|
28
|
+
loop: boolean;
|
|
29
|
+
muted: boolean;
|
|
30
|
+
preload: PreloadType;
|
|
31
|
+
source: AudioSource;
|
|
32
|
+
playbackRate: number;
|
|
33
|
+
preservesPitch: boolean;
|
|
34
|
+
volume: number;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
interface AudioReadonlyProps {
|
|
38
|
+
// TODO: decide if we want to expose them this way
|
|
39
|
+
// duration: number;
|
|
40
|
+
// currentTime: number;
|
|
41
|
+
// ended: boolean;
|
|
42
|
+
// paused: boolean;
|
|
43
|
+
// buffered: TimeRanges;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
type TMPEmptyEventHandler = () => void;
|
|
47
|
+
|
|
48
|
+
interface AudioEventProps {
|
|
49
|
+
onLoadStart?: TMPEmptyEventHandler;
|
|
50
|
+
onLoad?: TMPEmptyEventHandler;
|
|
51
|
+
onError?: TMPEmptyEventHandler;
|
|
52
|
+
onProgress?: TMPEmptyEventHandler;
|
|
53
|
+
onSeeked?: TMPEmptyEventHandler;
|
|
54
|
+
onEnded?: TMPEmptyEventHandler;
|
|
55
|
+
onPlay?: TMPEmptyEventHandler;
|
|
56
|
+
onPause?: TMPEmptyEventHandler;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface AudioPropsBase
|
|
60
|
+
extends AudioControlProps,
|
|
61
|
+
AudioReadonlyProps,
|
|
62
|
+
AudioEventProps {}
|
|
63
|
+
|
|
64
|
+
export type AudioProps = Partial<AudioPropsBase> & { source: AudioSource };
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { useMemo } from 'react';
|
|
2
|
+
import { AudioProps, AudioPropsBase } from './types';
|
|
3
|
+
|
|
4
|
+
export function withPropsDefaults(props: AudioProps): AudioPropsBase {
|
|
5
|
+
return {
|
|
6
|
+
...props,
|
|
7
|
+
autoPlay: props.autoPlay ?? false,
|
|
8
|
+
controls: props.controls ?? false,
|
|
9
|
+
loop: props.loop ?? false,
|
|
10
|
+
muted: props.muted ?? false,
|
|
11
|
+
preload: props.preload ?? 'auto',
|
|
12
|
+
source: props.source ?? [],
|
|
13
|
+
playbackRate: props.playbackRate ?? 1.0,
|
|
14
|
+
preservesPitch: props.preservesPitch ?? true,
|
|
15
|
+
volume: props.volume ?? 1.0,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function useStableAudioProps(props: AudioProps): AudioPropsBase {
|
|
20
|
+
const {
|
|
21
|
+
// Control Props
|
|
22
|
+
autoPlay,
|
|
23
|
+
controls,
|
|
24
|
+
loop,
|
|
25
|
+
muted,
|
|
26
|
+
preload,
|
|
27
|
+
source,
|
|
28
|
+
playbackRate,
|
|
29
|
+
preservesPitch,
|
|
30
|
+
volume,
|
|
31
|
+
|
|
32
|
+
// Event Props
|
|
33
|
+
onLoadStart,
|
|
34
|
+
onLoad,
|
|
35
|
+
onError,
|
|
36
|
+
onProgress,
|
|
37
|
+
onSeeked,
|
|
38
|
+
onEnded,
|
|
39
|
+
onPlay,
|
|
40
|
+
onPause,
|
|
41
|
+
} = withPropsDefaults(props);
|
|
42
|
+
|
|
43
|
+
return useMemo(
|
|
44
|
+
() => ({
|
|
45
|
+
// Control Props
|
|
46
|
+
autoPlay,
|
|
47
|
+
controls,
|
|
48
|
+
loop,
|
|
49
|
+
muted,
|
|
50
|
+
preload,
|
|
51
|
+
source,
|
|
52
|
+
playbackRate,
|
|
53
|
+
preservesPitch,
|
|
54
|
+
volume,
|
|
55
|
+
|
|
56
|
+
// Event Props
|
|
57
|
+
onLoadStart,
|
|
58
|
+
onLoad,
|
|
59
|
+
onError,
|
|
60
|
+
onProgress,
|
|
61
|
+
onSeeked,
|
|
62
|
+
onEnded,
|
|
63
|
+
onPlay,
|
|
64
|
+
onPause,
|
|
65
|
+
}),
|
|
66
|
+
[
|
|
67
|
+
autoPlay,
|
|
68
|
+
controls,
|
|
69
|
+
loop,
|
|
70
|
+
muted,
|
|
71
|
+
preload,
|
|
72
|
+
source,
|
|
73
|
+
playbackRate,
|
|
74
|
+
preservesPitch,
|
|
75
|
+
volume,
|
|
76
|
+
onLoadStart,
|
|
77
|
+
onLoad,
|
|
78
|
+
onError,
|
|
79
|
+
onProgress,
|
|
80
|
+
onSeeked,
|
|
81
|
+
onEnded,
|
|
82
|
+
onPlay,
|
|
83
|
+
onPause,
|
|
84
|
+
]
|
|
85
|
+
);
|
|
86
|
+
}
|
package/src/events/types.ts
CHANGED
|
@@ -46,12 +46,13 @@ interface RemoteCommandEvents {
|
|
|
46
46
|
type SystemEvents = RemoteCommandEvents & {
|
|
47
47
|
volumeChange: EventTypeWithValue;
|
|
48
48
|
interruption: OnInterruptionEventType;
|
|
49
|
+
duck: EventEmptyType;
|
|
49
50
|
routeChange: OnRouteChangeEventType;
|
|
50
51
|
};
|
|
51
52
|
|
|
52
|
-
export interface
|
|
53
|
-
bufferId: string
|
|
54
|
-
|
|
53
|
+
export interface OnBufferEndEventType {
|
|
54
|
+
bufferId: string;
|
|
55
|
+
isLastBufferInQueue: boolean;
|
|
55
56
|
}
|
|
56
57
|
|
|
57
58
|
/**
|
|
@@ -79,10 +80,11 @@ export interface OnAudioReadyEventType {
|
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
interface AudioAPIEvents {
|
|
82
|
-
ended:
|
|
83
|
+
ended: EventEmptyType;
|
|
83
84
|
loopEnded: EventEmptyType;
|
|
84
85
|
audioReady: OnAudioReadyEventType;
|
|
85
86
|
positionChanged: EventTypeWithValue;
|
|
87
|
+
bufferEnded: OnBufferEndEventType;
|
|
86
88
|
audioError: EventEmptyType; // to change
|
|
87
89
|
systemStateChanged: EventEmptyType; // to change
|
|
88
90
|
recorderError: OnRecorderErrorEventType;
|
package/src/interfaces.ts
CHANGED
|
@@ -229,6 +229,9 @@ export interface IAudioBufferQueueSourceNode
|
|
|
229
229
|
enqueueBuffer: (audioBuffer: IAudioBuffer) => string;
|
|
230
230
|
start: (when?: number, offset?: number) => void;
|
|
231
231
|
pause: () => void;
|
|
232
|
+
|
|
233
|
+
// passing subscriptionId(uint_64 in cpp, string in js) to the cpp
|
|
234
|
+
onBufferEnded: string;
|
|
232
235
|
}
|
|
233
236
|
|
|
234
237
|
export interface IConvolverNode extends IAudioNode {
|
|
@@ -6,6 +6,11 @@ import { AudioDevicesInfo, PermissionStatus } from '../system/types';
|
|
|
6
6
|
type OptionsMap = { [key: string]: string | boolean | number | undefined };
|
|
7
7
|
type NotificationOpResponse = { success: boolean; error?: string };
|
|
8
8
|
type NotificationType = 'playback' | 'recording' | 'simple';
|
|
9
|
+
type AudioFocusType =
|
|
10
|
+
| 'gain'
|
|
11
|
+
| 'gainTransient'
|
|
12
|
+
| 'gainTransientExclusive'
|
|
13
|
+
| 'gainTransientMayDuck';
|
|
9
14
|
|
|
10
15
|
interface Spec extends TurboModule {
|
|
11
16
|
install(): boolean;
|
|
@@ -22,7 +27,7 @@ interface Spec extends TurboModule {
|
|
|
22
27
|
disableSessionManagement(): void;
|
|
23
28
|
|
|
24
29
|
// Remote commands, system events and interruptions
|
|
25
|
-
observeAudioInterruptions(enabled: boolean): void;
|
|
30
|
+
observeAudioInterruptions(focusType: AudioFocusType, enabled: boolean): void;
|
|
26
31
|
activelyReclaimSession(enabled: boolean): void;
|
|
27
32
|
observeVolumeChanges(enabled: boolean): void;
|
|
28
33
|
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { TurboModule } from 'react-native';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
AudioDevicesInfo,
|
|
4
|
+
AudioFocusType,
|
|
5
|
+
PermissionStatus,
|
|
6
|
+
} from '../system/types';
|
|
3
7
|
|
|
4
8
|
// copy of spec from NativeAudioAPIModule.ts
|
|
5
9
|
type OptionsMap = {
|
|
@@ -23,7 +27,7 @@ interface Spec extends TurboModule {
|
|
|
23
27
|
disableSessionManagement(): void;
|
|
24
28
|
|
|
25
29
|
// Remote commands, system events and interruptions
|
|
26
|
-
observeAudioInterruptions(enabled: boolean): void;
|
|
30
|
+
observeAudioInterruptions(focusType: AudioFocusType, enabled: boolean): void;
|
|
27
31
|
activelyReclaimSession(enabled: boolean): void;
|
|
28
32
|
observeVolumeChanges(enabled: boolean): void;
|
|
29
33
|
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
IAudioManager,
|
|
8
8
|
PermissionStatus,
|
|
9
9
|
SessionOptions,
|
|
10
|
+
AudioFocusType,
|
|
10
11
|
} from './types';
|
|
11
12
|
|
|
12
13
|
class AudioManager implements IAudioManager {
|
|
@@ -43,8 +44,13 @@ class AudioManager implements IAudioManager {
|
|
|
43
44
|
NativeAudioAPIModule.disableSessionManagement();
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
observeAudioInterruptions(
|
|
47
|
-
|
|
47
|
+
observeAudioInterruptions(param: AudioFocusType | boolean | null) {
|
|
48
|
+
if (typeof param === 'string') {
|
|
49
|
+
NativeAudioAPIModule.observeAudioInterruptions(param, true);
|
|
50
|
+
} else {
|
|
51
|
+
// audiofocusgain as default value if not provided
|
|
52
|
+
NativeAudioAPIModule.observeAudioInterruptions('gain', param === true);
|
|
53
|
+
}
|
|
48
54
|
}
|
|
49
55
|
|
|
50
56
|
/**
|
package/src/system/types.ts
CHANGED
|
@@ -30,6 +30,12 @@ export type IOSOption =
|
|
|
30
30
|
| 'overrideMutedMicrophoneInterruption'
|
|
31
31
|
| 'interruptSpokenAudioAndMixWithOthers';
|
|
32
32
|
|
|
33
|
+
export type AudioFocusType =
|
|
34
|
+
| 'gain'
|
|
35
|
+
| 'gainTransient'
|
|
36
|
+
| 'gainTransientExclusive'
|
|
37
|
+
| 'gainTransientMayDuck';
|
|
38
|
+
|
|
33
39
|
export interface SessionOptions {
|
|
34
40
|
iosMode?: IOSMode;
|
|
35
41
|
iosOptions?: IOSOption[];
|
|
@@ -60,7 +66,7 @@ export interface IAudioManager {
|
|
|
60
66
|
disableSessionManagement(): void;
|
|
61
67
|
observeAudioInterruptions(enabled: boolean): void;
|
|
62
68
|
activelyReclaimSession(enabled: boolean): void;
|
|
63
|
-
|
|
69
|
+
observeAudioInterruptions(param: AudioFocusType | boolean | null): void;
|
|
64
70
|
addSystemEventListener<Name extends SystemEventName>(
|
|
65
71
|
name: Name,
|
|
66
72
|
callback: SystemEventCallback<Name>
|
|
@@ -4,6 +4,7 @@ import { RangeError, InvalidStateError } from '../errors';
|
|
|
4
4
|
|
|
5
5
|
export default class AudioScheduledSourceNode extends AudioNode {
|
|
6
6
|
protected hasBeenStarted: boolean = false;
|
|
7
|
+
private onEndedCallback?: (event: EventEmptyType) => void;
|
|
7
8
|
|
|
8
9
|
public start(when: number = 0): void {
|
|
9
10
|
if (when < 0) {
|
|
@@ -36,8 +37,12 @@ export default class AudioScheduledSourceNode extends AudioNode {
|
|
|
36
37
|
(this.node as globalThis.AudioScheduledSourceNode).stop(when);
|
|
37
38
|
}
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
public get onEnded(): ((event: EventEmptyType) => void) | undefined {
|
|
41
|
+
return this.onEndedCallback;
|
|
42
|
+
}
|
|
43
|
+
|
|
40
44
|
public set onEnded(callback: (event: EventEmptyType) => void | null) {
|
|
41
45
|
(this.node as globalThis.AudioScheduledSourceNode).onended = callback;
|
|
46
|
+
this.onEndedCallback = callback;
|
|
42
47
|
}
|
|
43
48
|
}
|