File tree 2 files changed +17
-2
lines changed
packages/react-native-audio-api
common/cpp/audioapi/core/sources
2 files changed +17
-2
lines changed Original file line number Diff line number Diff line change @@ -144,7 +144,17 @@ void AudioScheduledSourceNode::updatePlaybackInfo(
144
144
void AudioScheduledSourceNode::disable () {
145
145
AudioNode::disable ();
146
146
147
- std::unordered_map<std::string, EventValue> body = {{" value" , getStopTime ()}};
147
+ std::string state = " stopped" ;
148
+
149
+ // if it has not been stopped, it is ended
150
+ if (stopTime_ < 0 ) {
151
+ state = " ended" ;
152
+ }
153
+
154
+ std::unordered_map<std::string, EventValue> body = {
155
+ {" value" , getStopTime ()},
156
+ {" state" , state}
157
+ };
148
158
149
159
context_->audioEventHandlerRegistry_ ->invokeHandlerWithEventBody (
150
160
" ended" , onEndedCallbackId_, body);
Original file line number Diff line number Diff line change @@ -6,6 +6,11 @@ export interface EventTypeWithValue {
6
6
value : number ;
7
7
}
8
8
9
+ export interface EventTypeWithValueAndState {
10
+ value : number ;
11
+ state : 'stopped' | 'ended' ;
12
+ }
13
+
9
14
interface OnInterruptionEventType {
10
15
type : 'ended' | 'began' ;
11
16
shouldResume : boolean ;
@@ -40,7 +45,7 @@ export interface OnAudioReadyEventType {
40
45
}
41
46
42
47
interface AudioAPIEvents {
43
- ended : EventTypeWithValue ;
48
+ ended : EventTypeWithValueAndState ;
44
49
audioReady : OnAudioReadyEventType ;
45
50
audioError : EventEmptyType ; // to change
46
51
systemStateChanged : EventEmptyType ; // to change
You can’t perform that action at this time.
0 commit comments