RTCAudioDeviceModule.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Copyright 2022 LiveKit
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <CoreMedia/CoreMedia.h>
  17. #import <Foundation/Foundation.h>
  18. #import <WebRTC/RTCMacros.h>
  19. #import <WebRTC/RTCIODevice.h>
  20. NS_ASSUME_NONNULL_BEGIN
  21. typedef void (^RTCOnAudioDevicesDidUpdate)();
  22. RTC_OBJC_EXPORT
  23. @interface RTC_OBJC_TYPE (RTCAudioDeviceModule) : NSObject
  24. @property(nonatomic, readonly) NSArray<RTC_OBJC_TYPE(RTCIODevice) *> *outputDevices;
  25. @property(nonatomic, readonly) NSArray<RTC_OBJC_TYPE(RTCIODevice) *> *inputDevices;
  26. @property(nonatomic, readonly) BOOL playing;
  27. @property(nonatomic, readonly) BOOL recording;
  28. @property(nonatomic, assign) RTC_OBJC_TYPE(RTCIODevice) *outputDevice;
  29. @property(nonatomic, assign) RTC_OBJC_TYPE(RTCIODevice) *inputDevice;
  30. // Executes low-level API's in sequence to switch the device
  31. // Use outputDevice / inputDevice property unless you need to know if setting the device is
  32. // successful.
  33. - (BOOL)trySetOutputDevice:(nullable RTCIODevice *)device;
  34. - (BOOL)trySetInputDevice:(nullable RTCIODevice *)device;
  35. - (BOOL)setDevicesUpdatedHandler: (nullable RTCOnAudioDevicesDidUpdate) handler;
  36. - (BOOL)startPlayout;
  37. - (BOOL)stopPlayout;
  38. - (BOOL)initPlayout;
  39. - (BOOL)startRecording;
  40. - (BOOL)stopRecording;
  41. - (BOOL)initRecording;
  42. @end
  43. NS_ASSUME_NONNULL_END