PlanetKitCall
public class PlanetKitCall : NSObject
extension PlanetKitCall: PlanetKitDataSessionControllable
extension PlanetKitCall: PlanetKitAudioVolumeDelegate
extension PlanetKitCall : PlanetKitAudioMicCaptureDelegate
extension PlanetKitCall : PlanetKitAudioSpkPlayDelegate
extension PlanetKitCall : PlanetKitVideoOutputDelegate
extension PlanetKitCall: PlanetKitVideoLimiter
extension PlanetKitCall: PlanetKitSharedContentsControllable
extension PlanetKitCall: PlanetKitStatisticsControllable
extension PlanetKitCall: PlanetKitAudioRouteChangeDelegate
extension PlanetKitCall: PlanetKitCameraInterruptDelegate
extension PlanetKitCall: PlanetKitDebugMonitor
The PlanetKitCall
class represents a 1-to-1 call within the PlanetKit framework.
-
The user ID of the local user.
Declaration
Swift
@objc public let myUserId: PlanetKitUserId!
-
The user ID of the peer user.
Declaration
Swift
@objc public let peerUserId: PlanetKitUserId?
-
The direction of the call (incoming or outgoing).
Declaration
Swift
@objc public let direction: PlanetKitCallDirection
-
The API key used for authentication.
Declaration
Swift
@objc public let APIKey: String?
-
The access token used for authentication.
Declaration
Swift
@objc public let accessToken: String?
-
A flag indicating whether statistics are enabled for the call.
Declaration
Swift
@objc public let enableStatistics: Bool
-
The UUID of the call.
Declaration
Swift
@objc public let uuid: UUID
-
The delegate object that will receive call-related events.
Declaration
Swift
@objc public internal(set) weak var delegate: PlanetKitCallDelegate? { get }
-
The audio manager for the call.
Declaration
Swift
@objc public let audioManager: PlanetKitAudioManager
-
The send voice processor for the call.
Declaration
Swift
@objc public let sendVoiceProcessor: PlanetKitSendVoiceProcessor
-
The response on enable video for the call.
Declaration
Swift
@objc public let responseOnEnableVideo: PlanetKitResponseOnEnableVideo
-
The video capability for sending video in the call.
Declaration
Swift
@objc public let myVideoSendCapability: PlanetKitVideoCapability
-
The video capability for receiving video in the call.
Declaration
Swift
@objc public let myVideoReceiveCapability: PlanetKitVideoCapability
-
The type of call in the CallKit framework.
Declaration
Swift
@objc public internal(set) var callKitType: PlanetKitCallKitType { get }
-
The parameters for the CallKit framework.
Declaration
Swift
@objc public internal(set) var callKitParam: PlanetKitCallKitParam? { get }
-
The media status of the local user.
Declaration
Swift
@objc public internal(set) var myMediaStatus: PlanetKitMyMediaStatus! { get }
-
The state of the call.
Declaration
Swift
@objc public internal(set) var state: PlanetKitCallState { get set }
-
The media type of the call.
Declaration
Swift
@objc public internal(set) var mediaType: PlanetKitMediaType { get set }
-
The video stream for the user’s camera in the call.
Declaration
Swift
@objc public internal(set) var myVideoStream: PlanetKitVideoStream! { get }
-
The peer’s video stream in the call.
Declaration
Swift
@objc public internal(set) var peerVideoStream: PlanetKitVideoStream! { get }
-
The video stream for the user’s screen share in the call.
Declaration
Swift
@objc public internal(set) var myScreenShareStream: PlanetKitVideoStream! { get }
-
The screen controllable object for the call. This property allows you to control the screen used in the call.
Remark
It is recommended to change the custom camera usingPlanetKitMakeCallSettingBuilder.withCustomScreenKey(screen:)
orPlanetKitVerifyCallSettingBuilder.withCustomScreenKey(screen:)
rather than directly setting and changing this value.Declaration
Swift
@objc public var screen: PlanetKitScreenControllable? { get set }
-
Sets a modifier to receive audio data before speaker out. The modifier can modify audio data.
Declaration
Swift
@objc public weak var spkModifier: PlanetKitAudioSpkPlayDelegate? { get set }
-
Sets a receiver to receive audio data after speaker out. The receiver cannot modify audio data.
Declaration
Swift
@objc public weak var spkReceiver: PlanetKitAudioSpkPlayDelegate? { get set }
-
Sets a modifier to receive audio data before sending audio to the server. The modifier can modify audio data.
Declaration
Swift
@objc public weak var micModifier: PlanetKitAudioMicCaptureDelegate? { get set }
-
Sets a receiver to receive audio data after sending audio to the server. The receiver cannot modify audio data.
Declaration
Swift
@objc public weak var micReceiver: PlanetKitAudioMicCaptureDelegate? { get set }
-
Sets a receiver to receive the updated event of audio description for the peer.
Remark
The update interval can be set byPlanetKitMakeCallSettingBuilder.withAudioDescriptionUpdateIntervalKey(interval:)
andPlanetKitVerifyCallSettingBuilder.withAudioDescriptionUpdateIntervalKey(interval:)
. The default update interval is 0.5 seconds.Declaration
Swift
@objc public weak var peerAudioDescriptionReceiver: PlanetKitPeerAudioDescriptionDelegate? { get set }
-
Sets a receiver to receive the updated event of audio description for the local user’s audio.
Remark
The update interval can be set byPlanetKitMakeCallSettingBuilder.withAudioDescriptionUpdateIntervalKey(interval:)
andPlanetKitVerifyCallSettingBuilder.withAudioDescriptionUpdateIntervalKey(interval:)
. The default update interval is 0.5 seconds.Declaration
Swift
@objc public weak var myAudioDescriptionReceiver: PlanetKitMyAudioDescriptionDelegate? { get set }
-
Sets a modifier to receive the local user’s video data before requesting video transmission. The modifier can modify video data.
Declaration
Swift
@objc public weak var myVideoModifier: PlanetKitVideoModifierDelegate? { get set }
-
Makes a new outbound data session.
Declaration
Swift
public func makeOutboundDataSession(streamId: PlanetKitDataSessionStreamId, type: PlanetKitDataSessionType, delegate: PlanetKitOutboundDataSessionDelegate, completion: @escaping PlanetKitOutboundDataSession.Completion)
Parameters
streamId
The predefined ID for the app. The ID must be in the range [100, 999].
type
The type of the outbound data session.
delegate
The event callback for the outbound data session.
completion
If successful, the completion handler returns an outbound data session. Otherwise, the completion handler returns
nil
. -
Makes a new inbound data session.
Declaration
Swift
public func makeInboundDataSession(streamId: PlanetKitDataSessionStreamId, delegate: PlanetKitInboundDataSessionDelegate, completion: @escaping PlanetKitInboundDataSession.Completion)
Parameters
streamId
The predefined ID for the app. The ID must be in the range [100, 999].
delegate
The event callback for the inbound data session.
completion
If successful, the completion handler returns an inbound data session. Otherwise, the completion handler returns
nil
. -
Ignores receiving data for the given stream ID.
Remark
In a 1-to-1 call, calling this function notifies the sender that the receiver will ignore receiving data for the given stream ID. To ignore receiving data for the incoming stream ID, callunsupportInboundDataSession(streamId:)
inPlanetKitCallDelegate.dataSessionIncoming(_:streamId:type:)
.Declaration
Swift
public func unsupportInboundDataSession(streamId: PlanetKitDataSessionStreamId)
-
Gets the existing outbound data session with the stream ID.
Declaration
Swift
public func getOutboundDataSession(streamId: PlanetKitDataSessionStreamId) -> PlanetKitOutboundDataSession?
-
Gets the existing inbound data session with the stream ID.
Declaration
Swift
public func getInboundDataSession(streamId: PlanetKitDataSessionStreamId) -> PlanetKitInboundDataSession?
-
Called when the device volume has changed.
Declaration
Swift
public func didChangeVolume(_ type: PlanetKitAudioDeviceType, volume: Float)
-
Enables audio hook for my audio during a PlanetKit call.
Declaration
Swift
@objc public func enableHookMyAudio(delegate: PlanetKitCallHookedAudioDelegate, completion: @escaping (Bool) -> Void)
Parameters
delegate
The delegate object that will receive hooked audio data.
completion
A closure that will be called when the audio hook is enabled. The closure takes a single
Bool
parameter indicating whether the hook was successful or not. -
A Boolean value indicating whether the hooking of my audio is enabled.
true
means that the hooking is enabled andfalse
means that the hooking is disabled.Declaration
Swift
@objc public var isHookMyAudioEnabled: Bool { get }
-
Disables the hooking of my audio during a PlanetKit call.
Declaration
Swift
@objc public func disableHookMyAudio(completion: @escaping (Bool) -> Void)
Parameters
completion
A closure that will be called when the hooking is disabled.
-
Puts the hooked audio back to the call.
Declaration
Swift
@objc public func putHookedMyAudioBack(audio: PlanetKitHookedAudio) -> Bool
Parameters
audio
The hooked audio data.
Return Value
true
if the audio is successfully put back to the call, otherwisefalse
.
-
Enables a video call in the middle of an audio call.
- initialMyVideoState: The initial state of the local user’s video.
- completion: A closure that will be called when the video is enabled. The closure takes a Boolean value indicating whether the video call was enabled successfully or not.
Declaration
Swift
@objc public func enableVideo(initialMyVideoState: PlanetKitInitialMyVideoState = .resume, completion: @escaping (Bool) -> Void)
-
Disables a video call in the middle of a video call.
Declaration
Swift
@objc public func disableVideo(reason: PlanetKitMediaDisableReason, completion: @escaping (Bool) -> Void)
-
Sends raw data.
Remark
This is functionally equivalent toPlanetKitCall.didCapture(frameCnt:channels:sampleRate:sampleType:timestamp:outData:outDataLen:)
that handles the Modifier, the Receivers, and the Volume Receiver.Declaration
Swift
@objc public func sendMicData(frameCnt: UInt32, sampleRate: UInt32, sampleType: PlanetKitAudioSampleType, outData: UnsafeMutableRawPointer!, outDataLen: UInt32)
-
Receives raw data.
Remark
This is functionally equivalent toPlanetKitCall.willPlay(frameCnt:channels:sampleRate:sampleType:timestamp:playBuf:playBufSize:)
that handles the Modifier, the Receivers, and the Volume Receiver.Declaration
Swift
@objc public func recvSpkData(frameCnt: UInt32, sampleRate: UInt32, sampleType: PlanetKitAudioSampleType, playBuf: UnsafeMutableRawPointer!, playBufSize: UInt32) -> Int32
-
Starts the use of the user’s reference audio data for AEC to resolve echo.
Remark
To resolve echo using the user’s reference data, you should provide reference data usingPlanetKitCall.putUserAcousticEchoCancellerReference(frameCnt:...)
after calling this function.Declaration
Swift
@objc public func startUserAcousticEchoCancellerReference(_ completion: @escaping (Bool) -> Void)
-
Stops the use of the user’s reference audio data for AEC to resolve echo.
Remark
You should call this function to stop putting reference audio data for AEC.Declaration
Swift
@objc public func stopUserAcousticEchoCancellerReference(_ completion: @escaping (Bool) -> Void)
-
Puts reference audio data for AEC.
Declaration
Swift
@objc public func putUserAcousticEchoCancellerReference(frameCnt: UInt32, channels: UInt32, sampleRate: UInt32, sampleType: PlanetKitAudioSampleType, outData: UnsafeMutableRawPointer!, outDataLen: UInt32)
-
Called when audio is captured from the microphone.
Declaration
Swift
public func didCapture(frameCnt: UInt32, channels: UInt32, sampleRate: UInt32, sampleType: PlanetKitAudioSampleType, timestamp: AudioTimeStamp, outData: UnsafeMutableRawPointer!, outDataLen: UInt32)
Parameters
frameCnt
The number of audio frames captured.
channels
The number of audio channels.
sampleRate
The sample rate of the captured audio.
sampleType
The sample type of the captured audio.
timestamp
The timestamp of the captured audio.
outData
A pointer to the captured audio data.
outDataLen
The length of the captured audio data.
-
Called before audio playback starts.
Declaration
Swift
public func willPlay(frameCnt: UInt32, channels: UInt32, sampleRate: UInt32, sampleType: PlanetKitAudioSampleType, timestamp: AudioTimeStamp, playBuf: UnsafeMutableRawPointer!, playBufSize: UInt32) -> Int32
Parameters
frameCnt
The number of frames in the audio buffer.
channels
The number of audio channels.
sampleRate
The sample rate of the audio.
sampleType
The sample type of the audio.
timestamp
The timestamp of the audio.
playBuf
The buffer containing the audio data to be played.
playBufSize
The size of the audio buffer.
Return Value
An integer value indicating the result of the operation.
-
Implements the
PlanetKitVideoOutputDelegate
to send video data to the peer.Do not call this function unless you have to handle cam output instead of PlanetKit.
Declaration
Swift
public func videoOutput(_ videoBuffer: PlanetKitVideoBuffer)
-
Determines if screen share sending is available at the specified timestamp.
Declaration
Swift
public func isScreenShareSendAvailable(_ timestamp: CMTime) -> Bool
Parameters
timestamp
The timestamp of the screen share frame.
Return Value
true
if screen share sending is available,false
otherwise. -
Determines if video sending is available at the specified timestamp.
Declaration
Swift
public func isVideoSendAvailable(_ timestamp: CMTime) -> Bool
Parameters
timestamp
The timestamp of the video frame.
Return Value
true
if video sending is available,false
otherwise.
-
Starts the local user’s screen share.
Declaration
Swift
@objc public func startMyScreenShare(completion: @escaping (Bool) -> Void)
Parameters
completion
A closure that will be called when the screen share is started. The closure takes a Boolean value indicating whether the screen share was started successfully or not.
-
Starts the local user’s screen share.
-
Stops the local user’s screen share.
Declaration
Swift
@objc public func stopMyScreenShare(completion: @escaping (Bool) -> Void)
Parameters
completion
A closure that will be called when the screen share is stopped. The closure takes a Boolean value indicating whether the screen share was stopped successfully or not.
-
Stops the local user’s screen share with a reason code.
Remark
Thereason
value must be between 0 and 39.Declaration
Swift
@objc public func stopMyScreenShare(reason: Int32, completion: @escaping (Bool) -> Void)
Parameters
reason
The reason for stopping the screen share.
completion
A closure that will be called when the screen share is stopped. The closure takes a Boolean value indicating whether the screen share was stopped successfully or not.
-
Adds a peer screen share view delegate.
Declaration
Swift
@objc public func addPeerScreenShareView(delegate: PlanetKitVideoOutputDelegate)
Parameters
delegate
The delegate object conforming to the
PlanetKitVideoOutputDelegate
protocol. -
Removes a peer screen share view delegate.
Declaration
Swift
@objc public func removePeerScreenShareView(delegate: PlanetKitVideoOutputDelegate)
Parameters
delegate
The delegate object conforming to the
PlanetKitVideoOutputDelegate
protocol. -
Returns an array of
PlanetKitVideoOutputDelegate
objects representing the peer screen share views.Declaration
Swift
@objc public func getPeerScreenShareViews() -> [PlanetKitVideoOutputDelegate]
-
A Boolean value indicating whether the user’s screen is being shared.
Declaration
Swift
@objc public internal(set) var isMyScreenShared: Bool { get set }
-
A Boolean value indicating whether the peer’s screen is being shared.
Declaration
Swift
@objc public internal(set) var isPeerScreenShared: Bool { get set }
-
Stops the local user’s
ReplayKit
session.Close the session that receives data transmitted from
ReplayKit
via App Extension.Declaration
Swift
@objc public func stopMyBroadcast()
-
Sets the video share mode for the local user’s screen share.
Remark
The video share mode determines whether the local user’s video is shared during screen share. By default, the video share mode is disabled.Declaration
Swift
@objc public func setMyScreenShareVideoShareMode(enable: Bool) -> Bool
Parameters
enable
A Boolean value indicating whether the video share mode should be enabled.
Return Value
A Boolean value indicating whether the video share mode was set successfully or not.
-
A Boolean value indicating whether the video share mode is enabled for the local user’s screen share.
Declaration
Swift
@objc public var isMyScreenShareVideoShareModeEnabled: Bool { get }
-
Sets the shared contents during a call.
Declaration
Swift
public func setSharedContents(data: Data, completion: @escaping (Bool) -> Void)
Parameters
data
The data to be shared.
completion
A closure that will be called when the shared contents are set. The closure takes a Boolean value indicating whether the shared contents were set successfully or not.
-
Unsets the shared contents during a call.
Declaration
Swift
public func unsetSharedContents(completion: @escaping (Bool) -> Void)
Parameters
completion
A closure that will be called when the shared contents are unset. The closure takes a Boolean value indicating whether the shared contents were unset successfully or not.
-
Sets the exclusively shared contents during a call.
Declaration
Swift
public func setExclusivelySharedContents(data: Data, completion: @escaping (Bool) -> Void)
Parameters
data
The data to be shared.
completion
A closure that will be called when the exclusively shared contents are set. The closure takes a Boolean value indicating whether the exclusively shared contents were set successfully or not.
-
Unsets the exclusively shared contents during a call.
Declaration
Swift
public func unsetExclusivelySharedContents(completion: @escaping (Bool) -> Void)
Parameters
completion
A closure that will be called when the exclusively shared contents are unset. The closure takes a Boolean value indicating whether the exclusively shared contents were unset successfully or not.
-
Sets the room shared contents during a call.
Remark
This function will not work at 1-to-1 call.Declaration
Swift
public func setRoomSharedContents(data: Data, completion: @escaping (Bool) -> Void)
Parameters
data
The data to be shared.
completion
A closure that will be called when the room shared contents are set. The closure takes a Boolean value indicating whether the room shared contents were set successfully or not.
-
Unsets the room shared contents during a call.
Remark
This function will not work at 1-to-1 call.Declaration
Swift
public func unsetRoomSharedContents(completion: @escaping (Bool) -> Void)
Parameters
completion
A closure that will be called when the room shared contents are unset. The closure takes a Boolean value indicating whether the room shared contents were unset successfully or not.
-
Sends short data to the connected peer.
The maximum size of
type
is 100 bytes and the maximum size ofdata
is 800 bytes. The completion callback is called withfalse
when this session is not in [.connected] state or when the [data] or [type] exceeds the size limit.When the [shortData] is sent successfully from this device, the completion callback is called with
true
. If it fails, the completion callback is called withfalse
.Declaration
Swift
@objc public func sendShortData(type: String, data: Data, completion: @escaping (Bool) -> Void)
Parameters
type
User-defined data type to be sent along with [data]
data
Data to be sent
completion
Callback to be called when the peer received [data] successfully or failed
-
The statistics of the call.
Declaration
Swift
public var statistics: PlanetKitStatistics? { get }
-
Accepts the incoming call using the client’s media with own
useResponderPreparation
andstartMessage
.Remark
DO NOT set
recordOnCloud
totrue
before consulting with the LINE Planet team. If you want to use this feature, please contact us. (https://docs.lineplanet.me/ko/help/contact)Declaration
Swift
@objc public func acceptCall(startMessage: PlanetKitCallStartMessage?, useResponderPreparation: Bool, recordOnCloud: Bool = false, initialMyVideoState: PlanetKitInitialMyVideoState = .resume)
Parameters
startMessage
The start message for the call.
useResponderPreparation
A flag indicating whether to use the responder preparation.
recordOnCloud
A flag indicating whether to record the call on the cloud.
initialMyVideoState
The initial state of the local user’s video.
-
Finishes the call with a normal reason, which means success.
Declaration
Swift
@objc public func endCall()
-
Finishes the call with a normal code.
Declaration
Swift
@objc public func endCall(normalUserReleaseCode: String)
Parameters
normalUserReleaseCode
User code for successful call end. Maximum size of user code is 128 bytes including null termination.
-
Finishes the call with an error code.
Declaration
Swift
@objc public func endCall(errorUserReleaseCode: String)
Parameters
errorUserReleaseCode
User code for error call end. Maximum size of user code is 128 bytes including null termination.
-
Holds the call to interact with another call or OS operations.
Declaration
Swift
@objc public func hold(reason: String?, completion: @escaping (Bool) -> Void)
Parameters
reason
Maximum size of reason is 255 bytes with UTF-8 encoded string.
-
Unholds the call to resume.
Declaration
Swift
@objc public func unhold(completion: @escaping (Bool) -> Void)
-
Finishes preparation and starts the call.
Declaration
Swift
@objc public func finishPreparation()
-
Indicates whether the record on cloud feature is activated.
Declaration
Swift
@objc public var isRecordOnCloudActivated: Bool { get }
Return Value
A Boolean value indicating whether the record on cloud feature is activated.
-
A Boolean value indicating whether the audio of the local user is muted.
Declaration
Swift
@objc public var isMyAudioMuted: Bool { get }
-
A Boolean value indicating whether the audio of the remote user is muted.
Declaration
Swift
@objc public var isPeerAudioMuted: Bool { get }
-
A Boolean value indicating whether the audio of the remote user is silenced.
Declaration
Swift
@objc public var isPeerAudioSilenced: Bool { get }
-
The video status of the local user.
Declaration
Swift
@objc public var myVideoStatus: PlanetKitVideoStatus { get }
-
The video status of the remote user.
Declaration
Swift
@objc public var peerVideoStatus: PlanetKitVideoStatus { get }
-
Gets the current hold state for audio/video. It will return
true
afterhold(reason:completion:)
is called, andfalse
afterunhold(completion:)
is called.Declaration
Swift
@objc public var isOnHold: Bool { get }
-
Gets the call duration. If the duration is invalid, it returns -1.
Declaration
Swift
@objc public var duration: TimeInterval { get }
-
Requests to mute or unmute the remote user.
Declaration
Swift
@objc public func requestPeerMute(_ mute: Bool, completion: @escaping (Bool) -> Void)
Parameters
mute
A Boolean value indicating whether to mute or unmute the remote user.
completion
A closure that will be called when the request is completed. The closure takes a Boolean value indicating whether the request was successful or not.
-
Pauses the user’s video.
Declaration
Swift
@objc public func pauseMyVideo(completion: @escaping (Bool) -> Void)
Parameters
completion
A closure that is called when the operation is complete. The closure takes a Boolean value indicating whether the video was successfully paused.
-
Resumes the user’s video.
Remark
On macOS, if there is no available camera device, the function call will fail. It may be necessary to check in advance usingPlanetKitCameraManager.isCameraAvailable
.Declaration
Swift
@objc public func resumeMyVideo(completion: @escaping (Bool) -> Void)
Parameters
completion
A closure that is called when the operation is complete. The closure takes a Boolean value indicating whether the video was successfully resumed.
-
Mutes or unmutes the user’s audio.
Declaration
Swift
@objc public func muteMyAudio(_ mute: Bool, completion: @escaping (Bool) -> Void)
Parameters
mute
A Boolean value indicating whether to mute the audio.
completion
A closure that is called when the operation is complete. The closure takes a Boolean value indicating whether the audio was successfully muted or unmuted.
-
Makes all peers’ voices silent by removing speaker output.
Declaration
Swift
@objc public func silencePeerAudio(_ silent: Bool, completion: @escaping (Bool) -> Void)
-
Declaration
Swift
public func didAudioRouteChange(current: PlanetKitAudioRoute, previous: PlanetKitAudioRoute)
-
Called when the camera is interrupted.
Declaration
Swift
public func camDidInterruptBegin(_ reason: AVCaptureSession.InterruptionReason)
Parameters
reason
The reason for the interruption.
-
Called when the interruption ends and the camera is resumed.
Declaration
Swift
public func camDidInterruptEnd()
-
Initializes audio for the call when the audio session is activated by CallKit.
Declaration
Swift
@objc public func notifyCallKitAudioActivation()
-
This is debugging only function. (DO NOT USE IT)
Declaration
Swift
@objc public func reload(_ setting: [String : Any])
-
Gets the monitoring information string.
Declaration
Swift
public func getMonitorInfo() -> String