mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2024-10-28 08:49:35 +01:00
localvideo: remove onvisiblechange
By removing the onVisibleChange from the LocalVideo, and leaving that logic to the widget parents, we cleanup the noisy sink (un)registrations. Change-Id: I569e0529087be1e697178085cb59c1c18c52f2c6
This commit is contained in:
parent
50282f3259
commit
cbbe048303
5 changed files with 59 additions and 22 deletions
|
@ -35,12 +35,6 @@ VideoView {
|
|||
rendererId = VideoDevices.startDevice(id, force)
|
||||
}
|
||||
}
|
||||
|
||||
onVisibleChanged: {
|
||||
rendererId = rendererId ? rendererId : VideoDevices.getDefaultDevice()
|
||||
const id = visible ? rendererId : ""
|
||||
startWithId(id)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -40,10 +40,40 @@ Rectangle {
|
|||
color: "black"
|
||||
|
||||
LocalVideo {
|
||||
id: previewRenderer
|
||||
anchors.centerIn: parent
|
||||
anchors.fill: parent
|
||||
visible: !root.isAudioOnly && CurrentAccount.videoEnabled_Video && VideoDevices.listSize !== 0
|
||||
visible: !root.isAudioOnly &&
|
||||
CurrentAccount.videoEnabled_Video &&
|
||||
VideoDevices.listSize !== 0 &&
|
||||
((callStatus >= Call.Status.INCOMING_RINGING
|
||||
&& callStatus <= Call.Status.SEARCHING)
|
||||
|| callStatus === Call.Status.CONNECTED)
|
||||
opacity: 0.5
|
||||
|
||||
// HACK: this is a workaround to the preview video starting
|
||||
// and stopping a few times. The root cause should be investigated ASAP.
|
||||
Timer {
|
||||
id: controlPreview
|
||||
property bool startVideo
|
||||
interval: 1000;
|
||||
running: false;
|
||||
repeat: false
|
||||
onTriggered: {
|
||||
var rendId = visible && start ? VideoDevices.getDefaultDevice() : ""
|
||||
previewRenderer.startWithId(rendId)
|
||||
}
|
||||
}
|
||||
onVisibleChanged: {
|
||||
if (visible) {
|
||||
controlPreview.startVideo = true
|
||||
controlPreview.interval = 1000
|
||||
} else {
|
||||
controlPreview.startVideo = false
|
||||
controlPreview.interval = 0
|
||||
}
|
||||
controlPreview.start()
|
||||
}
|
||||
}
|
||||
|
||||
ListModel {
|
||||
|
|
|
@ -196,14 +196,35 @@ Rectangle {
|
|||
LocalVideo {
|
||||
id: previewRenderer
|
||||
|
||||
visible: false
|
||||
rendererId: ""
|
||||
|
||||
height: width * invAspectRatio
|
||||
width: Math.max(callPageMainRect.width / 5, JamiTheme.minimumPreviewWidth)
|
||||
x: callPageMainRect.width - previewRenderer.width - previewMargin
|
||||
y: previewMarginYTop
|
||||
|
||||
// HACK: this is a workaround to the preview video starting
|
||||
// and stopping a few times. The root cause should be investigated ASAP.
|
||||
Timer {
|
||||
id: controlPreview
|
||||
property bool startVideo
|
||||
interval: 1000
|
||||
running: false
|
||||
repeat: false
|
||||
onTriggered: {
|
||||
var rendId = visible && start ? root.callPreviewId : ""
|
||||
previewRenderer.startWithId(rendId)
|
||||
}
|
||||
}
|
||||
onVisibleChanged: {
|
||||
if (visible) {
|
||||
controlPreview.startVideo = true
|
||||
controlPreview.interval = 1000
|
||||
} else {
|
||||
controlPreview.startVideo = false
|
||||
controlPreview.interval = 0
|
||||
}
|
||||
controlPreview.start()
|
||||
}
|
||||
|
||||
states: [
|
||||
State {
|
||||
name: "geoChanging"
|
||||
|
@ -286,13 +307,6 @@ Rectangle {
|
|||
|
||||
function onUpdateOverlay(isPaused, isAudioOnly, isAudioMuted,
|
||||
isSIP, isGrid, previewId) {
|
||||
if (previewId != "") {
|
||||
if (root.callPreviewId != previewId)
|
||||
VideoDevices.stopDevice(root.callPreviewId, true)
|
||||
VideoDevices.startDevice(previewId)
|
||||
} else {
|
||||
VideoDevices.stopDevice(root.callPreviewId, true)
|
||||
}
|
||||
root.callPreviewId = previewId
|
||||
callOverlay.showOnHoldImage(isPaused)
|
||||
root.isAudioOnly = isAudioOnly
|
||||
|
|
|
@ -66,7 +66,7 @@ Popup {
|
|||
|
||||
function closeRecorder() {
|
||||
if (isVideo) {
|
||||
VideoDevices.stopDevice(previewWidget.deviceId)
|
||||
localVideo.startWithId("")
|
||||
}
|
||||
if (!root.isPhoto)
|
||||
stopRecording()
|
||||
|
|
|
@ -40,8 +40,7 @@ ColumnLayout {
|
|||
if (!visible) {
|
||||
return
|
||||
}
|
||||
const deviceId = VideoDevices.getDefaultDevice()
|
||||
previewWidget.startWithId(deviceId, force)
|
||||
previewWidget.startWithId(VideoDevices.getDefaultDevice(), force)
|
||||
}
|
||||
|
||||
onVisibleChanged: {
|
||||
|
@ -50,7 +49,7 @@ ColumnLayout {
|
|||
if (previewWidget.visible)
|
||||
startPreviewing(true)
|
||||
} else {
|
||||
VideoDevices.stopDevice(previewWidget.deviceId)
|
||||
previewWidget.startWithId("")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -138,7 +137,7 @@ ColumnLayout {
|
|||
|
||||
onActivated: {
|
||||
// TODO: start and stop preview logic in here should be in LRC
|
||||
VideoDevices.stopDevice(previewWidget.deviceId)
|
||||
previewWidget.startWithId("")
|
||||
VideoDevices.setDefaultDevice(
|
||||
filteredDevicesModel.mapToSource(modelIndex))
|
||||
startPreviewing()
|
||||
|
|
Loading…
Reference in a new issue