2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Add toggle video and screen sharing buttons.

This commit is contained in:
John Preston
2021-04-27 16:03:36 +04:00
parent e0bfaad3a2
commit b7fc3f67d7
11 changed files with 151 additions and 115 deletions

View File

@@ -405,15 +405,24 @@ bool GroupCall::isScreenSharing() const {
return (_videoDeviceId != _videoInputId);
}
void GroupCall::switchToCamera() {
if (!_videoCapture || !isScreenSharing()) {
void GroupCall::toggleVideo(bool active) {
if (!active) {
if (!isScreenSharing()) {
_videoOutgoing->setState(Webrtc::VideoState::Inactive);
}
return;
}
const auto changing = isScreenSharing();
_videoDeviceId = _videoInputId;
if (_videoOutgoing->state() != Webrtc::VideoState::Active) {
_videoOutgoing->setState(Webrtc::VideoState::Active);
}
_videoCapture->switchToDevice(_videoDeviceId.toStdString());
if (!_videoCapture) {
return;
}
if (changing) {
_videoCapture->switchToDevice(_videoDeviceId.toStdString());
}
}
void GroupCall::switchToScreenSharing(const QString &uniqueId) {