Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
Implement setVolume method on IoS side
Browse files Browse the repository at this point in the history
  • Loading branch information
kbetl-dlb committed Sep 7, 2023
1 parent 581908b commit 175e745
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 8 deletions.
14 changes: 7 additions & 7 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,9 @@ PODS:
- React-jsinspector (0.71.3)
- React-logger (0.71.3):
- glog
- react-native-comms-sdk (3.10.0):
- react-native-comms-sdk (3.10.1):
- React-Core
- VoxeetSDK (~> 3.10.1)
- VoxeetSDK (~> 3.11.0)
- react-native-document-picker (7.1.3):
- React-Core
- react-native-safe-area-context (3.4.1):
Expand Down Expand Up @@ -457,8 +457,8 @@ PODS:
- React-RCTText
- ReactCommon/turbomodule/core
- Yoga
- SocketRocket (0.6.0)
- VoxeetSDK (3.10.1)
- SocketRocket (0.6.1)
- VoxeetSDK (3.11.0)
- Yoga (1.14.0)
- YogaKit (1.18.1):
- Yoga (~> 1.14)
Expand Down Expand Up @@ -676,7 +676,7 @@ SPEC CHECKSUMS:
React-jsiexecutor: 515b703d23ffadeac7687bc2d12fb08b90f0aaa1
React-jsinspector: 9f7c9137605e72ca0343db4cea88006cb94856dd
React-logger: 957e5dc96d9dbffc6e0f15e0ee4d2b42829ff207
react-native-comms-sdk: ce52cf67ff732bc3166459f26462c5bed4ffed2e
react-native-comms-sdk: c26debe23427f633d02d573d2dde97ecc281743d
react-native-document-picker: ec07866a30707f23660c0f3ae591d669d3e89096
react-native-safe-area-context: 9e40fb181dac02619414ba1294d6c2a807056ab9
React-perflogger: af8a3d31546077f42d729b949925cc4549f14def
Expand All @@ -696,8 +696,8 @@ SPEC CHECKSUMS:
RNGestureHandler: a479ebd5ed4221a810967000735517df0d2db211
RNPermissions: 314155ed6ce65237e7bd9fb6239219cce83228d3
RNReanimated: cc5e3aa479cb9170bcccf8204291a6950a3be128
SocketRocket: fccef3f9c5cedea1353a9ef6ada904fde10d6608
VoxeetSDK: bc2f2566624c2ad13dfb0fa4498020e7c15e85fa
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
VoxeetSDK: 04a92e5ff875404191f93de89557cf8250b81f7e
Yoga: 5ed1699acbba8863755998a4245daa200ff3817b
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a

Expand Down
5 changes: 5 additions & 0 deletions ios/Services/AudioService/RNRemoteAudioServiceModuleBridge.m
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@ @interface RCT_EXTERN_REMAP_MODULE(CommsAPIRemoteAudioModule, RNRemoteAudioServi
resolver:(RCTPromiseResolveBlock _Nonnull)resolve
rejecter:(RCTPromiseRejectBlock _Nonnull)reject);

RCT_EXTERN_METHOD(setVolume:(NSDictionary * _Nonnull)participant
volume:(Float * _Nonnull)volume
resolver:(RCTPromiseResolveBlock _Nonnull)resolve
rejecter:(RCTPromiseRejectBlock _Nonnull)reject);

@end
21 changes: 21 additions & 0 deletions ios/Services/AudioService/RemoteAudioServiceModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,25 @@ public class RemoteAudioServiceModule: NSObject {
error.send(with: reject)
}
}

/// Sets the volume of a selected participant in non-Dolby Voice conferences to a preferred value between 0 and 1.
/// - Parameters:
/// - participant: The selected remote participant who should be locally muted.
/// - volume: The preferred volume level between 0 (no audio) and 1 (full volume).
/// - resolve: returns on success
/// - reject: returns error on failure
@objc(setVolume:volume:resolver:rejecter:)
public func setVolume(
participant: [String: Any],
volume: Float,
resolve: @escaping RCTPromiseResolveBlock,
reject: @escaping RCTPromiseRejectBlock
) {
guard let participantObject = VoxeetSDK.shared.conference.current?.findParticipant(with: participant.identifier) else {
ModuleError.noParticipant(participant.description).send(with: reject)
return
}
let result = VoxeetSDK.shared.audio.remote.setVolume(participant: participantObject, volume: volume)
resolve(result)
}
}
2 changes: 1 addition & 1 deletion react-native-comms-sdk.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ Pod::Spec.new do |s|
s.source_files = "ios/**/*.{h,m,mm,swift}"

s.dependency "React-Core"
s.dependency "VoxeetSDK", '~> 3.10.1'
s.dependency "VoxeetSDK", '~> 3.11.0'
end

0 comments on commit 175e745

Please sign in to comment.