mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-08-19 14:15:54 +02:00
calls: file/screen sharing in audio only calls
GitLab: #499 Change-Id: I76754b4b32cde4cf8445c6058649aab912d7a0b4
This commit is contained in:
parent
641730c425
commit
021ab43dfe
5 changed files with 96 additions and 45 deletions
|
@ -91,12 +91,19 @@ AvAdapter::shareEntireScreen(int screenNumber)
|
||||||
return;
|
return;
|
||||||
QRect rect = screen->geometry();
|
QRect rect = screen->geometry();
|
||||||
|
|
||||||
lrcInstance_->avModel().setDisplay(getScreenNumber(),
|
auto resource = lrcInstance_->avModel().getDisplay(getScreenNumber(),
|
||||||
rect.x(),
|
rect.x(),
|
||||||
rect.y(),
|
rect.y(),
|
||||||
rect.width() * screen->devicePixelRatio(),
|
rect.width() * screen->devicePixelRatio(),
|
||||||
rect.height() * screen->devicePixelRatio(),
|
rect.height() * screen->devicePixelRatio());
|
||||||
lrcInstance_->getCurrentCallId());
|
auto callId = lrcInstance_->getCurrentCallId();
|
||||||
|
lrcInstance_->getCurrentCallModel()->requestMediaChange(callId,
|
||||||
|
"video_0",
|
||||||
|
resource,
|
||||||
|
lrc::api::NewCallModel::MediaRequestType::SCREENSHARING,
|
||||||
|
false);
|
||||||
|
set_currentRenderingDeviceType(
|
||||||
|
lrcInstance_->avModel().getCurrentRenderedDevice(callId).type);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -104,12 +111,19 @@ AvAdapter::shareAllScreens()
|
||||||
{
|
{
|
||||||
const auto arrangementRect = getAllScreensBoundingRect();
|
const auto arrangementRect = getAllScreensBoundingRect();
|
||||||
|
|
||||||
lrcInstance_->avModel().setDisplay(getScreenNumber(),
|
auto resource = lrcInstance_->avModel().getDisplay(getScreenNumber(),
|
||||||
arrangementRect.x(),
|
arrangementRect.x(),
|
||||||
arrangementRect.y(),
|
arrangementRect.y(),
|
||||||
arrangementRect.width(),
|
arrangementRect.width(),
|
||||||
arrangementRect.height(),
|
arrangementRect.height());
|
||||||
lrcInstance_->getCurrentCallId());
|
auto callId = lrcInstance_->getCurrentCallId();
|
||||||
|
lrcInstance_->getCurrentCallModel()->requestMediaChange(callId,
|
||||||
|
"video_0",
|
||||||
|
resource,
|
||||||
|
lrc::api::NewCallModel::MediaRequestType::SCREENSHARING,
|
||||||
|
false);
|
||||||
|
set_currentRenderingDeviceType(
|
||||||
|
lrcInstance_->avModel().getCurrentRenderedDevice(callId).type);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -169,7 +183,17 @@ AvAdapter::captureAllScreens()
|
||||||
void
|
void
|
||||||
AvAdapter::shareFile(const QString& filePath)
|
AvAdapter::shareFile(const QString& filePath)
|
||||||
{
|
{
|
||||||
lrcInstance_->avModel().setInputFile(filePath, lrcInstance_->getCurrentCallId());
|
auto callId = lrcInstance_->getCurrentCallId();
|
||||||
|
if (!callId.isEmpty()) {
|
||||||
|
lrcInstance_->getCurrentCallModel()
|
||||||
|
->requestMediaChange(callId,
|
||||||
|
"video_0",
|
||||||
|
filePath,
|
||||||
|
lrc::api::NewCallModel::MediaRequestType::FILESHARING,
|
||||||
|
false);
|
||||||
|
set_currentRenderingDeviceType(
|
||||||
|
lrcInstance_->avModel().getCurrentRenderedDevice(callId).type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -182,21 +206,34 @@ AvAdapter::shareScreenArea(unsigned x, unsigned y, unsigned width, unsigned heig
|
||||||
QTimer::singleShot(100, [=]() mutable {
|
QTimer::singleShot(100, [=]() mutable {
|
||||||
x = y = width = height = 0;
|
x = y = width = height = 0;
|
||||||
xrectsel(&x, &y, &width, &height);
|
xrectsel(&x, &y, &width, &height);
|
||||||
|
auto resource = lrcInstance_->avModel().getDisplay(getScreenNumber(),
|
||||||
lrcInstance_->avModel().setDisplay(getScreenNumber(),
|
x,
|
||||||
x,
|
y,
|
||||||
y,
|
width < 128 ? 128 : width,
|
||||||
width < 128 ? 128 : width,
|
height < 128 ? 128 : height);
|
||||||
height < 128 ? 128 : height,
|
auto callId = lrcInstance_->getCurrentCallId();
|
||||||
lrcInstance_->getCurrentCallId());
|
lrcInstance_->getCurrentCallModel()->requestMediaChange(callId,
|
||||||
|
"video_0",
|
||||||
|
resource,
|
||||||
|
lrc::api::NewCallModel::MediaRequestType::SCREENSHARING,
|
||||||
|
false);
|
||||||
|
set_currentRenderingDeviceType(
|
||||||
|
lrcInstance_->avModel().getCurrentRenderedDevice(callId).type);
|
||||||
});
|
});
|
||||||
#else
|
#else
|
||||||
lrcInstance_->avModel().setDisplay(getScreenNumber(),
|
auto resource = lrcInstance_->avModel().getDisplay(getScreenNumber(),
|
||||||
x,
|
x,
|
||||||
y,
|
y,
|
||||||
width < 128 ? 128 : width,
|
width < 128 ? 128 : width,
|
||||||
height < 128 ? 128 : height,
|
height < 128 ? 128 : height);
|
||||||
lrcInstance_->getCurrentCallId());
|
auto callId = lrcInstance_->getCurrentCallId();
|
||||||
|
lrcInstance_->getCurrentCallModel()->requestMediaChange(callId,
|
||||||
|
"video_0",
|
||||||
|
resource,
|
||||||
|
lrc::api::NewCallModel::MediaRequestType::SCREENSHARING,
|
||||||
|
false);
|
||||||
|
set_currentRenderingDeviceType(
|
||||||
|
lrcInstance_->avModel().getCurrentRenderedDevice(callId).type);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,9 +241,18 @@ void
|
||||||
AvAdapter::stopSharing()
|
AvAdapter::stopSharing()
|
||||||
{
|
{
|
||||||
auto callId = lrcInstance_->getCurrentCallId();
|
auto callId = lrcInstance_->getCurrentCallId();
|
||||||
if (!callId.isEmpty())
|
if (!callId.isEmpty()) {
|
||||||
|
lrcInstance_->getCurrentCallModel()
|
||||||
|
->requestMediaChange(callId,
|
||||||
|
"video_0",
|
||||||
|
lrcInstance_->avModel().getCurrentVideoCaptureDevice(),
|
||||||
|
lrc::api::NewCallModel::MediaRequestType::CAMERA,
|
||||||
|
false);
|
||||||
lrcInstance_->avModel().switchInputTo(lrcInstance_->avModel().getCurrentVideoCaptureDevice(),
|
lrcInstance_->avModel().switchInputTo(lrcInstance_->avModel().getCurrentVideoCaptureDevice(),
|
||||||
callId);
|
callId);
|
||||||
|
set_currentRenderingDeviceType(
|
||||||
|
lrcInstance_->avModel().getCurrentRenderedDevice(callId).type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -650,7 +650,7 @@ CallAdapter::updateCallOverlay(const lrc::api::conversation::Info& convInfo)
|
||||||
bool isPaused = call->status == lrc::api::call::Status::PAUSED;
|
bool isPaused = call->status == lrc::api::call::Status::PAUSED;
|
||||||
bool isAudioOnly = call->isAudioOnly && !isPaused;
|
bool isAudioOnly = call->isAudioOnly && !isPaused;
|
||||||
bool isAudioMuted = call->audioMuted && (call->status != lrc::api::call::Status::PAUSED);
|
bool isAudioMuted = call->audioMuted && (call->status != lrc::api::call::Status::PAUSED);
|
||||||
bool isVideoMuted = call->videoMuted && !isPaused && !call->isAudioOnly;
|
bool isVideoMuted = call->videoMuted && !isPaused;
|
||||||
bool isRecording = isRecordingThisCall();
|
bool isRecording = isRecordingThisCall();
|
||||||
bool isConferenceCall = !convInfo.confId.isEmpty()
|
bool isConferenceCall = !convInfo.confId.isEmpty()
|
||||||
|| (convInfo.confId.isEmpty() && call->participantsInfos.size() != 0);
|
|| (convInfo.confId.isEmpty() && call->participantsInfos.size() != 0);
|
||||||
|
@ -959,7 +959,7 @@ CallAdapter::holdThisCallToggle()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CallAdapter::muteThisCallToggle()
|
CallAdapter::muteThisCallToggle(bool mute)
|
||||||
{
|
{
|
||||||
const auto callId = lrcInstance_->getCallIdForConversationUid(convUid_, accountId_);
|
const auto callId = lrcInstance_->getCallIdForConversationUid(convUid_, accountId_);
|
||||||
if (callId.isEmpty() || !lrcInstance_->getCurrentCallModel()->hasCall(callId)) {
|
if (callId.isEmpty() || !lrcInstance_->getCurrentCallModel()->hasCall(callId)) {
|
||||||
|
@ -967,7 +967,11 @@ CallAdapter::muteThisCallToggle()
|
||||||
}
|
}
|
||||||
auto* callModel = lrcInstance_->getCurrentCallModel();
|
auto* callModel = lrcInstance_->getCurrentCallModel();
|
||||||
if (callModel->hasCall(callId)) {
|
if (callModel->hasCall(callId)) {
|
||||||
callModel->requestMediaChange(callId, "audio_0");
|
callModel->requestMediaChange(callId,
|
||||||
|
"audio_0",
|
||||||
|
lrcInstance_->avModel().getCurrentVideoCaptureDevice(),
|
||||||
|
lrc::api::NewCallModel::MediaRequestType::CAMERA,
|
||||||
|
mute);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -985,7 +989,7 @@ CallAdapter::recordThisCallToggle()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
CallAdapter::videoPauseThisCallToggle()
|
CallAdapter::videoPauseThisCallToggle(bool mute)
|
||||||
{
|
{
|
||||||
const auto callId = lrcInstance_->getCallIdForConversationUid(convUid_, accountId_);
|
const auto callId = lrcInstance_->getCallIdForConversationUid(convUid_, accountId_);
|
||||||
if (callId.isEmpty() || !lrcInstance_->getCurrentCallModel()->hasCall(callId)) {
|
if (callId.isEmpty() || !lrcInstance_->getCurrentCallModel()->hasCall(callId)) {
|
||||||
|
@ -993,7 +997,11 @@ CallAdapter::videoPauseThisCallToggle()
|
||||||
}
|
}
|
||||||
auto* callModel = lrcInstance_->getCurrentCallModel();
|
auto* callModel = lrcInstance_->getCurrentCallModel();
|
||||||
if (callModel->hasCall(callId)) {
|
if (callModel->hasCall(callId)) {
|
||||||
callModel->requestMediaChange(callId, "video_0");
|
callModel->requestMediaChange(callId,
|
||||||
|
"video_0",
|
||||||
|
lrcInstance_->avModel().getCurrentVideoCaptureDevice(),
|
||||||
|
lrc::api::NewCallModel::MediaRequestType::CAMERA,
|
||||||
|
mute);
|
||||||
// media label should come from qml
|
// media label should come from qml
|
||||||
// also thi function can me emrged with "muteThisCallToggle"
|
// also thi function can me emrged with "muteThisCallToggle"
|
||||||
}
|
}
|
||||||
|
|
|
@ -69,9 +69,9 @@ public:
|
||||||
Q_INVOKABLE bool isModerator(const QString& uri = {}) const;
|
Q_INVOKABLE bool isModerator(const QString& uri = {}) const;
|
||||||
Q_INVOKABLE bool isCurrentModerator() const;
|
Q_INVOKABLE bool isCurrentModerator() const;
|
||||||
Q_INVOKABLE void holdThisCallToggle();
|
Q_INVOKABLE void holdThisCallToggle();
|
||||||
Q_INVOKABLE void muteThisCallToggle();
|
Q_INVOKABLE void muteThisCallToggle(bool mute);
|
||||||
Q_INVOKABLE void recordThisCallToggle();
|
Q_INVOKABLE void recordThisCallToggle();
|
||||||
Q_INVOKABLE void videoPauseThisCallToggle();
|
Q_INVOKABLE void videoPauseThisCallToggle(bool mute);
|
||||||
Q_INVOKABLE bool isRecordingThisCall();
|
Q_INVOKABLE bool isRecordingThisCall();
|
||||||
Q_INVOKABLE QVariantList getConferencesInfos();
|
Q_INVOKABLE QVariantList getConferencesInfos();
|
||||||
Q_INVOKABLE void muteParticipant(const QString& uri, const bool state);
|
Q_INVOKABLE void muteParticipant(const QString& uri, const bool state);
|
||||||
|
|
|
@ -156,7 +156,7 @@ Control {
|
||||||
property list<Action> primaryActions: [
|
property list<Action> primaryActions: [
|
||||||
Action {
|
Action {
|
||||||
id: muteAudioAction
|
id: muteAudioAction
|
||||||
onTriggered: CallAdapter.muteThisCallToggle()
|
onTriggered: CallAdapter.muteThisCallToggle(!isAudioMuted)
|
||||||
checkable: true
|
checkable: true
|
||||||
icon.source: checked ?
|
icon.source: checked ?
|
||||||
JamiResources.mic_off_24dp_svg :
|
JamiResources.mic_off_24dp_svg :
|
||||||
|
@ -175,7 +175,7 @@ Control {
|
||||||
},
|
},
|
||||||
Action {
|
Action {
|
||||||
id: muteVideoAction
|
id: muteVideoAction
|
||||||
onTriggered: CallAdapter.videoPauseThisCallToggle()
|
onTriggered: CallAdapter.videoPauseThisCallToggle(!isVideoMuted)
|
||||||
checkable: true
|
checkable: true
|
||||||
icon.source: checked ?
|
icon.source: checked ?
|
||||||
JamiResources.videocam_off_24dp_svg :
|
JamiResources.videocam_off_24dp_svg :
|
||||||
|
@ -237,17 +237,17 @@ Control {
|
||||||
Action {
|
Action {
|
||||||
id: shareAction
|
id: shareAction
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
if (AvAdapter.currentRenderingDeviceType === Video.DeviceType.DISPLAY)
|
if (AvAdapter.currentRenderingDeviceType === Video.DeviceType.DISPLAY || AvAdapter.currentRenderingDeviceType === Video.DeviceType.FILE)
|
||||||
root.stopSharingClicked()
|
root.stopSharingClicked()
|
||||||
else
|
else
|
||||||
root.shareScreenClicked()
|
root.shareScreenClicked()
|
||||||
}
|
}
|
||||||
icon.source: AvAdapter.currentRenderingDeviceType === Video.DeviceType.DISPLAY ?
|
icon.source: AvAdapter.currentRenderingDeviceType === Video.DeviceType.DISPLAY || AvAdapter.currentRenderingDeviceType === Video.DeviceType.FILE ?
|
||||||
JamiResources.share_stop_black_24dp_svg :
|
JamiResources.share_stop_black_24dp_svg :
|
||||||
JamiResources.share_screen_black_24dp_svg
|
JamiResources.share_screen_black_24dp_svg
|
||||||
icon.color: AvAdapter.currentRenderingDeviceType === Video.DeviceType.DISPLAY ?
|
icon.color: AvAdapter.currentRenderingDeviceType === Video.DeviceType.DISPLAY || AvAdapter.currentRenderingDeviceType === Video.DeviceType.FILE ?
|
||||||
"red" : "white"
|
"red" : "white"
|
||||||
text: AvAdapter.currentRenderingDeviceType === Video.DeviceType.DISPLAY ?
|
text: AvAdapter.currentRenderingDeviceType === Video.DeviceType.DISPLAY || AvAdapter.currentRenderingDeviceType === Video.DeviceType.FILE ?
|
||||||
JamiStrings.stopSharing :
|
JamiStrings.stopSharing :
|
||||||
JamiStrings.shareScreen
|
JamiStrings.shareScreen
|
||||||
property real size: 34
|
property real size: 34
|
||||||
|
@ -308,7 +308,7 @@ Control {
|
||||||
CallOverlayModel.addSecondaryControl(callTransferAction)
|
CallOverlayModel.addSecondaryControl(callTransferAction)
|
||||||
}
|
}
|
||||||
CallOverlayModel.addSecondaryControl(chatAction)
|
CallOverlayModel.addSecondaryControl(chatAction)
|
||||||
if (!isAudioOnly && !isSIP)
|
if (!isSIP)
|
||||||
CallOverlayModel.addSecondaryControl(shareAction)
|
CallOverlayModel.addSecondaryControl(shareAction)
|
||||||
CallOverlayModel.addSecondaryControl(recordAction)
|
CallOverlayModel.addSecondaryControl(recordAction)
|
||||||
CallOverlayModel.addSecondaryControl(pluginsAction)
|
CallOverlayModel.addSecondaryControl(pluginsAction)
|
||||||
|
|
|
@ -101,8 +101,7 @@ ContextMenuAutoLoader {
|
||||||
GeneralMenuItem {
|
GeneralMenuItem {
|
||||||
id: stopSharing
|
id: stopSharing
|
||||||
|
|
||||||
canTrigger: !isAudioOnly
|
canTrigger: AvAdapter.currentRenderingDeviceType === Video.DeviceType.DISPLAY
|
||||||
&& AvAdapter.currentRenderingDeviceType === Video.DeviceType.DISPLAY
|
|
||||||
&& !isSIP
|
&& !isSIP
|
||||||
itemName: JamiStrings.stopSharing
|
itemName: JamiStrings.stopSharing
|
||||||
iconSource: JamiResources.share_stop_black_24dp_svg
|
iconSource: JamiResources.share_stop_black_24dp_svg
|
||||||
|
@ -114,8 +113,7 @@ ContextMenuAutoLoader {
|
||||||
GeneralMenuItem {
|
GeneralMenuItem {
|
||||||
id: shareScreen
|
id: shareScreen
|
||||||
|
|
||||||
canTrigger: !isAudioOnly
|
canTrigger: AvAdapter.currentRenderingDeviceType !== Video.DeviceType.DISPLAY
|
||||||
&& AvAdapter.currentRenderingDeviceType !== Video.DeviceType.DISPLAY
|
|
||||||
&& !isSIP
|
&& !isSIP
|
||||||
itemName: JamiStrings.shareScreen
|
itemName: JamiStrings.shareScreen
|
||||||
iconSource: JamiResources.share_screen_black_24dp_svg
|
iconSource: JamiResources.share_screen_black_24dp_svg
|
||||||
|
@ -131,8 +129,7 @@ ContextMenuAutoLoader {
|
||||||
GeneralMenuItem {
|
GeneralMenuItem {
|
||||||
id: shareScreenArea
|
id: shareScreenArea
|
||||||
|
|
||||||
canTrigger: !isAudioOnly
|
canTrigger: AvAdapter.currentRenderingDeviceType !== Video.DeviceType.DISPLAY
|
||||||
&& AvAdapter.currentRenderingDeviceType !== Video.DeviceType.DISPLAY
|
|
||||||
&& !isSIP
|
&& !isSIP
|
||||||
itemName: JamiStrings.shareScreenArea
|
itemName: JamiStrings.shareScreenArea
|
||||||
iconSource: JamiResources.share_screen_black_24dp_svg
|
iconSource: JamiResources.share_screen_black_24dp_svg
|
||||||
|
@ -148,7 +145,7 @@ ContextMenuAutoLoader {
|
||||||
GeneralMenuItem {
|
GeneralMenuItem {
|
||||||
id: shareFile
|
id: shareFile
|
||||||
|
|
||||||
canTrigger: !isAudioOnly && !isSIP
|
canTrigger: !isSIP
|
||||||
itemName: JamiStrings.shareFile
|
itemName: JamiStrings.shareFile
|
||||||
iconSource: JamiResources.insert_photo_24dp_svg
|
iconSource: JamiResources.insert_photo_24dp_svg
|
||||||
onClicked: {
|
onClicked: {
|
||||||
|
|
Loading…
Add table
Reference in a new issue