forked from mirrors/linphone-iphone
Update video window of conference participants upon stream availabililty
This commit is contained in:
parent
e9a960ec30
commit
d0d3f2e403
1 changed files with 10 additions and 3 deletions
|
|
@ -28,6 +28,8 @@ class ConferenceParticipantDeviceData {
|
|||
let videoEnabled = MutableLiveData<Bool>()
|
||||
let activeSpeaker = MutableLiveData<Bool>()
|
||||
let isInConference = MutableLiveData<Bool>()
|
||||
private var videoView: UIView? = nil
|
||||
|
||||
var core : Core { get { Core.get() } }
|
||||
|
||||
private var participantDeviceDelegate : ParticipantDeviceDelegate?
|
||||
|
|
@ -42,6 +44,7 @@ class ConferenceParticipantDeviceData {
|
|||
}, onConferenceJoined: { (participantDevice) in
|
||||
Log.i("[Conference Participant Device] Participant \(participantDevice) has joined the conference")
|
||||
self.isInConference.value = true
|
||||
self.setVideoView(view: self.videoView)
|
||||
}, onConferenceLeft: { (participantDevice) in
|
||||
Log.i("[Conference Participant Device] Participant \(participantDevice) has left the conference")
|
||||
self.isInConference.value = false
|
||||
|
|
@ -55,6 +58,9 @@ class ConferenceParticipantDeviceData {
|
|||
if (streamType == StreamType.Video) {
|
||||
Log.i("[Conference Participant Device] Participant [\(participantDevice.address?.asStringUriOnly())] video availability changed to \(available)")
|
||||
self.videoEnabled.value = available
|
||||
if (available) {
|
||||
self.setVideoView(view: self.videoView)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -90,14 +96,15 @@ class ConferenceParticipantDeviceData {
|
|||
return isMe && Core.get().showSwitchCameraButton()
|
||||
}
|
||||
|
||||
func setVideoView(view:UIView) {
|
||||
func setVideoView(view:UIView?) {
|
||||
self.videoView = view
|
||||
Log.i("[Conference Participant Device] Setting textureView \(view) for participant \(participantDevice)")
|
||||
view.contentMode = .scaleAspectFill
|
||||
view?.contentMode = .scaleAspectFill
|
||||
if (isMe) {
|
||||
core.usePreviewWindow(yesno: false)
|
||||
core.nativePreviewWindow = view
|
||||
} else {
|
||||
participantDevice.nativeVideoWindowId = UnsafeMutableRawPointer(Unmanaged.passUnretained(view).toOpaque())
|
||||
participantDevice.nativeVideoWindowId = view != nil ? UnsafeMutableRawPointer(Unmanaged.passUnretained(view!).toOpaque()) : nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue