Add control to toggle screen-sharing
This commit is contained in:
parent
219793afcc
commit
773f569385
9 changed files with 131 additions and 12 deletions
|
@ -95,6 +95,13 @@ public func LKRoomPublishVideoTrack(room: UnsafeRawPointer, track: UnsafeRawPoin
|
|||
}
|
||||
}
|
||||
|
||||
@_cdecl("LKRoomUnpublishTrack")
|
||||
public func LKRoomUnpublishTrack(room: UnsafeRawPointer, publication: UnsafeRawPointer) {
|
||||
let room = Unmanaged<Room>.fromOpaque(room).takeUnretainedValue()
|
||||
let publication = Unmanaged<LocalTrackPublication>.fromOpaque(publication).takeUnretainedValue()
|
||||
room.localParticipant?.unpublish(publication: publication)
|
||||
}
|
||||
|
||||
@_cdecl("LKRoomVideoTracksForRemoteParticipant")
|
||||
public func LKRoomVideoTracksForRemoteParticipant(room: UnsafeRawPointer, participantId: CFString) -> CFArray? {
|
||||
let room = Unmanaged<Room>.fromOpaque(room).takeUnretainedValue()
|
||||
|
|
|
@ -48,6 +48,7 @@ extern "C" {
|
|||
callback: extern "C" fn(*mut c_void, *mut c_void, CFStringRef),
|
||||
callback_data: *mut c_void,
|
||||
);
|
||||
fn LKRoomUnpublishTrack(room: *const c_void, publication: *const c_void);
|
||||
fn LKRoomVideoTracksForRemoteParticipant(
|
||||
room: *const c_void,
|
||||
participant_id: CFStringRef,
|
||||
|
@ -134,6 +135,12 @@ impl Room {
|
|||
async { rx.await.unwrap().context("error publishing video track") }
|
||||
}
|
||||
|
||||
pub fn unpublish_track(&self, publication: LocalTrackPublication) {
|
||||
unsafe {
|
||||
LKRoomUnpublishTrack(self.native_room, publication.0);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn remote_video_tracks(&self, participant_id: &str) -> Vec<Arc<RemoteVideoTrack>> {
|
||||
unsafe {
|
||||
let tracks = LKRoomVideoTracksForRemoteParticipant(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue