Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions ios/RTCSystemSetting.m
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,18 @@ +(BOOL)requiresMainQueueSetup{
}

RCT_EXPORT_METHOD(setVolume:(float)val config:(NSDictionary *)config){
[self stopObserving];

dispatch_sync(dispatch_get_main_queue(), ^{
id showUI = [config objectForKey:@"showUI"];
[self showVolumeUI:(showUI != nil && [showUI boolValue])];
volumeSlider.value = val;

__weak RCTSystemSetting *weakSelf = self;
[[NSNotificationCenter defaultCenter] addObserverForName:@"AVSystemController_SystemVolumeDidChangeNotification" object:nil queue:nil usingBlock:^(NSNotification * _Nonnull note) {
__strong RCTSystemSetting *strongSelf = weakSelf;
[strongSelf startObserving];
}];
});
}

Expand Down