2022-09-01 15:52:12 +00:00
|
|
|
//
|
|
|
|
// LKRoom.swift
|
|
|
|
// LiveKitObjC
|
|
|
|
//
|
|
|
|
// Created by Antonio Scandurra on 01/09/22.
|
|
|
|
//
|
|
|
|
|
|
|
|
import Foundation
|
|
|
|
import LiveKit
|
|
|
|
|
2022-09-02 16:35:16 +00:00
|
|
|
public class LKRoom: RoomDelegate {
|
2022-09-01 15:52:12 +00:00
|
|
|
lazy var room = Room(delegate: self)
|
|
|
|
|
2022-09-02 16:35:16 +00:00
|
|
|
init() {
|
|
|
|
print("INIT!\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
deinit {
|
|
|
|
print("DEINIT!\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
public func connect(
|
2022-09-01 15:52:12 +00:00
|
|
|
url: String,
|
|
|
|
token: String,
|
|
|
|
callback: @convention(block) @escaping () -> Void
|
|
|
|
) {
|
|
|
|
self.room.connect(url, token).then { room in
|
|
|
|
callback()
|
|
|
|
}
|
|
|
|
}
|
2022-09-02 16:35:16 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@_cdecl("LKRoomCreate")
|
|
|
|
public func LKRoomCreate() -> UnsafeMutableRawPointer {
|
|
|
|
Unmanaged.passRetained(LKRoom()).toOpaque()
|
|
|
|
}
|
|
|
|
|
|
|
|
@_cdecl("LKRoomDestroy")
|
|
|
|
public func LKRoomDestroy(ptr: UnsafeRawPointer) {
|
|
|
|
let _ = Unmanaged<LKRoom>.fromOpaque(ptr).takeRetainedValue();
|
2022-09-01 15:52:12 +00:00
|
|
|
}
|
2022-09-02 16:35:16 +00:00
|
|
|
|
|
|
|
|