modifying screenshare API for viewer

This commit is contained in:
milad 2019-11-06 14:35:20 -08:00
parent a7427bcb18
commit 894b4127b4
3 changed files with 33 additions and 26 deletions

View file

@ -25,21 +25,22 @@ ScreenshareScriptingInterface::~ScreenshareScriptingInterface() {
stopScreenshare();
}
void ScreenshareScriptingInterface::startScreenshare(const QString& roomName) {
void ScreenshareScriptingInterface::startScreenshare(const bool& isPresenter) {
if (QThread::currentThread() != thread()) {
// We must start a new QProcess from the main thread.
QMetaObject::invokeMethod(
this, "startScreenshare",
Q_ARG(const QString&, roomName)
Q_ARG(const bool&, isPresenter)
);
return;
}
if (_screenshareProcess && _screenshareProcess->state() != QProcess::NotRunning) {
if (isPresenter && _screenshareProcess && _screenshareProcess->state() != QProcess::NotRunning) {
qDebug() << "Screenshare process already running. Aborting...";
return;
}
if (isPresenter) {
_screenshareProcess.reset(new QProcess(this));
QFileInfo screenshareExecutable(SCREENSHARE_EXE_PATH);
@ -47,6 +48,7 @@ void ScreenshareScriptingInterface::startScreenshare(const QString& roomName) {
qDebug() << "Screenshare executable doesn't exist at" << SCREENSHARE_EXE_PATH;
return;
}
}
QUuid currentDomainID = DependencyManager::get<AddressManager>()->getDomainID();
@ -59,6 +61,7 @@ void ScreenshareScriptingInterface::startScreenshare(const QString& roomName) {
QString apiKey = "";
QString sessionID = "";
if (isPresenter) {
QStringList arguments;
arguments << "--token=" + token;
arguments << "--apiKey=" + apiKey;
@ -76,6 +79,9 @@ void ScreenshareScriptingInterface::startScreenshare(const QString& roomName) {
});
_screenshareProcess->start(SCREENSHARE_EXE_PATH, arguments);
} else {
}
};
void ScreenshareScriptingInterface::stopScreenshare() {

View file

@ -14,11 +14,12 @@ public:
ScreenshareScriptingInterface();
~ScreenshareScriptingInterface();
Q_INVOKABLE void startScreenshare(const QString& roomName);
Q_INVOKABLE void startScreenshare(const bool& isPresenter);
Q_INVOKABLE void stopScreenshare();
signals:
void screenshareStopped();
void startScreenshareViewer();
private:
#if DEV_BUILD

View file

@ -37,7 +37,7 @@
Are you sure you'd like to share <span id="content_name">Content Name</span>?
</p>
<p>
Others will be able to everything contained within this view.
Others will be able to see everything contained within this view.
</p>
</div>
<div id="button_selection">