PlanetKitSubgroupManager
public class PlanetKitSubgroupManager : NSObject
The manager class for PlanetKit subgroups.
-
The main room of the subgroups in a conference.
Remark
The main room is the default subgroup that all peers are subscribed to when they join the conference. The subgroup name of the main room is nil.Declaration
Swift
@objc public internal(set) var mainRoom: PlanetKitSubgroup { get }
-
List of all the subgroups in the conference.
Declaration
Swift
@objc public var subgroups: [PlanetKitSubgroup] { get }
-
Subscribes to a new subgroup or an existing subgroup using a name.
Remark
If the target subgroup exists and the givenpeerUpdateType
,videoUpdate
, oruseDataSession
is mismatched, it will fail withPlanetKitSubgroupSubscribeFailReason.wrongAttribute
. If this function runs successfully, the subgroup instance will be returned. If it fails, it will return nil.Declaration
Swift
@objc public func subscribe(subgroupName: String, peerUpdateType: PlanetKitSubgroupPeerUpdateType, videoUpdate: Bool, useDataSession: Bool, completion: @escaping (PlanetKitSubgroup?, PlanetKitSubgroupSubscribeFailReason) -> Void)
Parameters
subgroupName
Subgroup’s name, where
nil
means the main room. Its maximum length is 15 with UTF-8 characters.peerUpdateType
Attribute that affects the callback event to refresh the peer list,
PlanetKitConferenceDelegate.peersDidUpdatePublicSubgroup(_:updated:)
.videoUpdate
Attribute that affects the callback event to refresh the video,
PlanetKitConferenceDelegate.peersVideoDidUpdate(_:updated:)
.useDataSession
Attribute that determines whether to enable data sessions.
completion
The callback of the completion event.
-
Unsubscribes from an already subscribed subgroup.
Remark
You should change the current audio or video route usingchangeMyAudioDestination(subgroupName:completion:)
orchangeMyVideoDestination(subgroupName:completion:)
before unsubscribing. Otherwise, you will get failedPlanetKitSubgroupUnsubscribeFailReason.hasActiveAudio
orPlanetKitSubgroupUnsubscribeFailReason.hasActiveVideo
.Declaration
Swift
@objc public func unsubscribe(subgroupName: String, completion: @escaping (PlanetKitSubgroup?, PlanetKitSubgroupUnsubscribeFailReason) -> Void)
Parameters
subgroupName
Name of the subgroup to unsubscribe from. Maximum length is 15 with UTF-8 characters.
completion
The callback of the completion event.
-
Gets the known subgroup including the main room.
Declaration
Swift
@objc public func getSubgroup(subgroupName: String?) -> PlanetKitSubgroup?
-
Changes the local user’s destination subgroup of the video to a specific subgroup.
Declaration
Swift
@objc public func changeMyVideoDestination(subgroupName: String, completion: @escaping (Bool) -> Void)
Parameters
subgroupName
The name of the subgroup.
completion
A closure that is called when the operation is completed. The closure takes a Boolean parameter indicating whether the operation was successful or not.
-
Changes the local user’s destination subgroup of the video to the main room.
Declaration
Swift
@objc public func changeMyVideoDestinationToMainRoom(completion: @escaping (Bool) -> Void)
Parameters
completion
A closure that is called when the operation is completed. The closure takes a Boolean parameter indicating whether the operation was successful or not.
-
Changes the local user’s destination subgroup of the audio to a specific subgroup.
Declaration
Swift
@objc public func changeMyAudioDestination(subgroupName: String, completion: @escaping (Bool) -> Void)
Parameters
subgroupName
The name of the subgroup.
completion
A closure that is called when the operation is completed. The closure takes a Boolean parameter indicating whether the operation was successful or not.
-
Changes the local user’s destination subgroup of the audio to the main room.
Declaration
Swift
@objc public func changeMyAudioDestinationToMainRoom(completion: @escaping (Bool) -> Void)
Parameters
completion
A closure that is called when the operation is completed. The closure takes a Boolean parameter indicating whether the operation was successful or not.
-
Sets the tag for the local user’s audio in the main room.
Declaration
Swift
@objc public func setTagMyAudioOfMainRoom(taggedSubgroupName: String, completion: @escaping (Bool) -> Void)
Parameters
taggedSubgroupName
The name of the subgroup to tag the audio with.
completion
A closure that is called when the operation is completed. The closure takes a Boolean parameter indicating whether the operation was successful or not.
-
Clears the tag for the local user’s audio in the main room.
Declaration
Swift
@objc public func clearTagMyAudioOfMainRoom(completion: @escaping (Bool) -> Void)
Parameters
completion
A closure that is called when the operation is completed. The closure takes a Boolean parameter indicating whether the operation was successful or not.
-
Sets the peer volume level.
Declaration
Swift
@objc public func setPeerVolumeLevelSetting(_ volumeLevel: Int8, peerId: PlanetKitUserId, subgroupName: String?, allSubgroupsPeerSubscribed: Bool, completion: @escaping (Bool) -> Void)
Parameters
volumeLevel
The audio volume range in percentage from 0 to 110. The 0 value is muted, 100 is original, and 110 will amplify original volume to +9dB.
peerId
Target peer’s ID.
subgroupName
Subgroup’s name, where
nil
means the main room.allSubgroupsPeerSubscribed
If this is
true
, the peer volume will be changed in all subgroups that the target peer is subscribed to.completion
The callback of completion event.
-
Silences or unsilences the target subgroup’s audio.
Declaration
Swift
@objc public func silencePeersAudio(subgroupName: String?, silenced: Bool, completion: @escaping (Bool) -> Void)
Parameters
subgroupName
Target subgroup name. Use
nil
for the main room.silenced
Set
true
to silence orfalse
to unsilence.completion
The callback of completion event.
-
Enables auto volume control with focus subgroup names.
Remark
You should provide all subgroup names at once to enable auto volume control. If you exclude subgroup names, it will be disabled automatically.
Declaration
Swift
@objc public func setPeersAudioAutoVolumeControl(focusSubgroupNames: [String], focusMainRoom: Bool, completion: @escaping (Bool) -> Void)
Parameters
focusSubgroupNames
Array of subgroup names to enable auto volume control.
focusMainRoom
Set
true
when you want to enable auto volume control on the main room.completion
The callback of completion event.
-
Disables all auto volume control.
Declaration
Swift
@objc public func clearPeersAudioAutoVolumeControl(completion: @escaping (Bool) -> Void)