IVSMixer
Objective-C
@interface IVSMixer : NSObject
Swift
class IVSMixer : NSObject
The mixer determines the final on-screen and in-ear state for visual elements and audio.
An element is represented by an IVSMixerSlotConfiguration
that has a number of associated parameters to place
an image stream spatially and set the gain of an audio stream from a device.
Each slot can be bound to a single image device (such as a camera) and a single audio device (such as a microphone).
-
Unavailable
Do not create instances of this class directly
Declaration
Objective-C
IVS_INIT_UNAVAILABLE
-
Unavailable
Do not create instances of this class directly
Declaration
Objective-C
IVS_INIT_UNAVAILABLE
-
Returns the currently added slots.
Note
for slots that are performing an animated transition, this will return the state of the slot before the transition.Declaration
Objective-C
- (nonnull NSArray<IVSMixerSlotConfiguration *> *)slots;
Swift
func slots() -> [IVSMixerSlotConfiguration]
-
Transition a slot to a new state.
Multiple concurrent transitions are not supported on the same slot. If you initiate a second transition before the first is finished, the transition will start over from the original slot state and transition to the new state as if the first transition had never been made.
If there are no devices to to the slot being animated, the duration parameter will be ignored and the slot will be updated immediately.
Declaration
Objective-C
- (BOOL)transitionSlotWithName:(nonnull NSString *)slotName toState:(nonnull IVSMixerSlotConfiguration *)nextState duration:(NSTimeInterval)duration onComplete:(nullable void (^)(void))onComplete;
Swift
func transitionSlot(withName slotName: String, toState nextState: IVSMixerSlotConfiguration, duration: TimeInterval, onComplete: (() -> Void)? = nil) -> Bool
Parameters
slotName
The target slot’s name
nextState
The new state for the slot
duration
The amount of time to animate the transition for
onComplete
An optional callback that will be called when the animation has completed
Return Value
true if a matching slot was found and updated, false otherwise
-
Add a new slot to the mixer configuration
Declaration
Objective-C
- (BOOL)addSlot:(nonnull IVSMixerSlotConfiguration *)slot;
Swift
func addSlot(_ slot: IVSMixerSlotConfiguration) -> Bool
Parameters
slot
The slot configuration to be added
Return Value
Success
-
Remove a slot from the mixer configuration
Declaration
Objective-C
- (BOOL)removeSlotWithName:(nonnull NSString *)slotName;
Swift
func removeSlot(withName slotName: String) -> Bool
Parameters
slotName
The slot to be removed
Return Value
Success
-
Bind a device’s output to the first mixer slot that isn’t already bound for this device’s stream type, and matches the device type.
Declaration
Objective-C
- (nullable NSString *)bindDeviceToFirstCompatibleSlot: (nonnull id<IVSDevice>)device;
Swift
func bindDevice(toFirstCompatibleSlot device: any IVSDevice) -> String?
Parameters
device
The device to bind to the mixer
Return Value
The name of the slot the device was bound to.
nil
if no compatible slot was found. -
Bind a device’s output to a mixer slot (specified in the mixer configuration). A common source of failure for this API is if a slot does not exist matching the provided slotName. Use
slots
to verify the slot exists.Declaration
Objective-C
- (BOOL)bindDevice:(nonnull id<IVSDevice>)device toSlotWithName:(nonnull NSString *)slotName;
Swift
func bindDevice(_ device: any IVSDevice, toSlotWithName slotName: String) -> Bool
Parameters
device
The device to bind to the mixer
slotName
The target slot’s name
Return Value
true if the bind was successful.
-
Get a slot’s current bindings, if any are bound.
Declaration
Objective-C
- (nullable NSArray<NSString *> *)devicesBoundToSlotWithName: (nonnull NSString *)slotName;
Swift
func devicesBoundToSlot(withName slotName: String) -> [String]?
Parameters
slotName
The name of the slot to query
Return Value
A list of device URNs bound to the slot. This will be empty if the slot exists but no devices are bound, but
nil
if no matching slot exists.