PlanetKitCall

public class PlanetKitCall : NSObject
extension PlanetKitCall: PlanetKitDataSessionControllable
extension PlanetKitCall: PlanetKitAudioVolumeDelegate
extension PlanetKitCall: PlanetKitAudioDeviceChangeDelegate
extension PlanetKitCall: PlanetKitCameraDeviceChangeDelegate
extension PlanetKitCall : PlanetKitAudioMicCaptureDelegate
extension PlanetKitCall : PlanetKitAudioSpkPlayDelegate
extension PlanetKitCall : PlanetKitVideoOutputDelegate
extension PlanetKitCall: PlanetKitVideoLimiter
extension PlanetKitCall: PlanetKitSharedContentsControllable
extension PlanetKitCall: PlanetKitStatisticsControllable
extension PlanetKitCall: PlanetKitDebugMonitor

The PlanetKitCall class represents a 1-to-1 call within the PlanetKit framework.

Data Session

PlanetKitAudioVolumeDelegate

PlanetKitAudioDeviceChangeDelegate

PlanetKitCameraDeviceChangeDelegate

Audio/Video Change

  • 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)

Provider for Raw Data

AEC Reference Data

  • 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 using PlanetKitCall.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)

PlanetKitAudioMicCaptureDelegate

  • 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.

PlanetKitAudioSpkPlayDelegate

  • 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.

PlanetKitVideoOutputDelegate

PlanetKitVideoLimiter

  • 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.

Screen Share

  • Starts the local user’s screen share.

  • Starts the local user’s screen share.

    Declaration

    Swift

    @objc
    public func startMyScreenShare(device: PlanetKitScreenCaptureDevice, completion: @escaping (Bool) -> Void)

    Parameters

    device

    The screen capture device to be used for screen share.

    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.

  • 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

    The reason 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.

Screen Share - Video Share Mode

  • 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 }

Shared Contents

  • 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.

Short Data

  • Sends short data to the connected peer.

    The maximum size of type is 100 bytes and the maximum size of data is 800 bytes. The completion callback is called with false 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 with false.

    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

Statistics

Call Management

  • Accepts the incoming call using the client’s media with own useResponderPreparation and startMessage.

    Remark

    DO NOT set recordOnCloud to true 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)

Responder Preparation

  • Finishes preparation and starts the call.

    Declaration

    Swift

    @objc
    public func finishPreparation()

Record On Cloud

  • 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.

Audio/Video State

  • 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 after hold(reason:completion:) is called, and false after unhold(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 }

Peer Audio/Media Control

  • 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 using PlanetKitCameraManager.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)

Customize setting

  • This is debugging only function. (DO NOT USE IT)

    Declaration

    Swift

    @objc
    public func reload(_ setting: [String : Any])

Monitoring

  • Gets the monitoring information string.

    Declaration

    Swift

    public func getMonitorInfo() -> String