mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-04-30 16:06:24 +00:00
Use AVFoundation to request media permissions on start if there are not accepted.
This commit is contained in:
parent
5182bc6921
commit
0e8d3e06b6
6 changed files with 17 additions and 1 deletions
|
|
@ -218,6 +218,7 @@ if (APPLE)
|
|||
src/app/single-application/SingleApplication.cpp
|
||||
src/components/core/event-count-notifier/EventCountNotifierMacOs.m
|
||||
src/components/other/desktop-tools/DesktopToolsMacOs.cpp
|
||||
src/components/other/desktop-tools/DesktopToolsMacOs.mm
|
||||
src/components/other/desktop-tools/screen-saver/ScreenSaverMacOs.m
|
||||
src/components/other/desktop-tools/state-process/StateProcessMacOs.mm
|
||||
)
|
||||
|
|
@ -435,7 +436,7 @@ foreach (package ${QT5_PACKAGES_OPTIONAL})
|
|||
endforeach ()
|
||||
|
||||
if (APPLE)
|
||||
list(APPEND LIBRARIES "-framework Cocoa -framework IOKit")
|
||||
list(APPEND LIBRARIES "-framework Cocoa -framework IOKit -framework AVFoundation")
|
||||
# -framework linphone") #This doesn't work yet
|
||||
endif ()
|
||||
|
||||
|
|
|
|||
|
|
@ -209,6 +209,7 @@ App::App (int &argc, char *argv[]) : SingleApplication(argc, argv, true, Mode::U
|
|||
|
||||
qInfo() << QStringLiteral("Starting " APPLICATION_NAME " (bin: " EXECUTABLE_NAME ")");
|
||||
qInfo() << QStringLiteral("Use locale: %1").arg(mLocale);
|
||||
DesktopTools::initialize();
|
||||
}
|
||||
|
||||
App::~App () {
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ public:
|
|||
bool getScreenSaverStatus () const;
|
||||
void setScreenSaverStatus (bool status);
|
||||
|
||||
static void initialization(){}
|
||||
static void applicationStateChanged(Qt::ApplicationState){};
|
||||
|
||||
signals:
|
||||
|
|
|
|||
|
|
@ -36,8 +36,10 @@ public:
|
|||
bool getScreenSaverStatus () const;
|
||||
void setScreenSaverStatus (bool status);
|
||||
|
||||
static void initialize(); // Do first initialization
|
||||
static void applicationStateChanged(Qt::ApplicationState currentState);
|
||||
|
||||
|
||||
signals:
|
||||
void screenSaverStatusChanged (bool status);
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
#include "DesktopToolsMacOs.hpp"
|
||||
#import <AVFoundation/AVFoundation.h>
|
||||
|
||||
void DesktopTools::initialize(){
|
||||
// Request permissions
|
||||
if([AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeVideo] != AVAuthorizationStatusAuthorized)
|
||||
[AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo completionHandler:^(BOOL) {}];
|
||||
if([AVCaptureDevice authorizationStatusForMediaType:AVMediaTypeAudio] != AVAuthorizationStatusAuthorized)
|
||||
[AVCaptureDevice requestAccessForMediaType:AVMediaTypeAudio completionHandler:^(BOOL) {}];
|
||||
}
|
||||
|
|
@ -37,6 +37,7 @@ public:
|
|||
bool getScreenSaverStatus () const;
|
||||
void setScreenSaverStatus (bool status);
|
||||
|
||||
static void initialization(){}
|
||||
static void applicationStateChanged(Qt::ApplicationState){};
|
||||
|
||||
signals:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue