CamoController
public class CamoController
The Camo controller is the starting point for interacting with Camo Studio. From here, you can control the Camo connection service.
You can only have one active instance in your application at a given time.
At the moment, all API methods for CamoProducerKit are provided by CamoController
, to provide a simple public-facing implementation.
-
Undocumented
See moreDeclaration
Swift
public struct PairedDevice
-
The delegate for this Camo controller. You are required to implement and set it before making use of CamoController.
Declaration
Swift
public weak var delegate: CamoControllerDelegate?
-
Number of audio samples required for one audio packet. Might be different for macOS and Windows
Declaration
Swift
public var audioSamplesRequired: Int { get }
-
The Camo service’s state, such as if its running or not, and if it is running, more information on the active connection.
Declaration
Swift
public private(set) var state: CamoControllerState { get }
-
Audio delay in ms
Declaration
Swift
public var audioDelay: UInt32 { get set }
-
Video delay in ms
Declaration
Swift
public var videoDelay: UInt32 { get set }
-
Microphone name that will be displayed in Camo Studio
Declaration
Swift
public var microphoneName: String { get set }
-
Initialise a Camo controller. You should only have one instance at any given time.
Declaration
Swift
public init()
-
Start the Camo service to facilitate connections with Camo Studio.
Declaration
Swift
public func start()
-
Stop the Camo service, disconnecting any existing connections to Camo Studio.
Note
You must wait for the service to fully stop before starting it again. You can use the completion handler to determine when the service has stopped.Declaration
Swift
public func stop(completion: (() -> Void)? = nil)
-
Pair with Camo Studio for wireless connection. After pairing will be done connection between the app and Camo Studio will be established automatically.
Declaration
Swift
public func pairStudioWithQRCodeData(_ pairingData: String, _ completionHandler: @escaping (Bool) -> Void)
Parameters
pairingData
data from QR code in Camo Studio.
completionHandler
Completion handler that tells if pairing was successful.
-
Cancel pairing.
Declaration
Swift
public func cancelPairing()
-
Get list of paired Camo Studio devices.
Declaration
Swift
public func pairedDevices() -> [PairedDevice]
Return Value
array of paired devices.
-
Remove pairing for a device/
Declaration
Swift
public func removePairedDevice(withID id: String)
Parameters
id
device ID.
-
Send a video frame to Camo Studio. Currently, you should aim to send video at a goal of 30 FPS. Your frame duration should match this.
You can view an example of sending video in the provided demo application. This method will not send video if there is no connection, but you should also be checking to avoid any unnecessary processing in your app.
Declaration
Swift
public func enqueueVideo(sampleBuffer: CMSampleBuffer)
Parameters
sampleBuffer
The sample buffer to send. It must be using the pixel format
kCVPixelFormatType_32BGRA
. -
Send an audio packet to Camo Studio.
You can view an example of sending audio in the provided demo application. This method will not send audio if there is no connection, but you should also be checking to avoid any unnecessary processing in your app.
Audio requirements:
- Sample rate: 48 kHz
- Audio codec: LPCM
- Number of channels: 2
- Bit depth: 32
- Samples per audio packet: 256
LPCM sample size is 8 bytes, so expected data length is 8 * 256 = 2048 bytes
Declaration
Swift
public func enqueueAudio(pcmData data: Data)
Parameters
data
The encoded audio data to send.