mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-24 09:24:15 +02:00
Steps closer...
This commit is contained in:
parent
a41ae3daa9
commit
c8464786e7
2 changed files with 23 additions and 4 deletions
|
@ -49,4 +49,6 @@ Item {
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
load(root.url, root.scriptUrl);
|
load(root.url, root.scriptUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
signal sendToScript(var message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,12 +30,14 @@ ScreenshareScriptingInterface::~ScreenshareScriptingInterface() {
|
||||||
static const EntityTypes::EntityType LOCAL_SCREENSHARE_WEB_ENTITY_TYPE = EntityTypes::Web;
|
static const EntityTypes::EntityType LOCAL_SCREENSHARE_WEB_ENTITY_TYPE = EntityTypes::Web;
|
||||||
static const uint8_t LOCAL_SCREENSHARE_WEB_ENTITY_FPS = 30;
|
static const uint8_t LOCAL_SCREENSHARE_WEB_ENTITY_FPS = 30;
|
||||||
static const glm::vec3 LOCAL_SCREENSHARE_WEB_ENTITY_LOCAL_POSITION(0.0f, 0.0f, 0.1f);
|
static const glm::vec3 LOCAL_SCREENSHARE_WEB_ENTITY_LOCAL_POSITION(0.0f, 0.0f, 0.1f);
|
||||||
static const QString LOCAL_SCREENSHARE_WEB_ENTITY_URL = "https://s3.amazonaws.com/hifi-content/Experiences/Releases/usefulUtilities/smartBoard/screenshareViewer/screenshareClient.html";
|
static const QString LOCAL_SCREENSHARE_WEB_ENTITY_URL = "https://hifi-content.s3.amazonaws.com/Experiences/Releases/usefulUtilities/smartBoard/screenshareViewer/screenshareClient.html?1";
|
||||||
void ScreenshareScriptingInterface::startScreenshare(const QUuid& screenshareZoneID, const QUuid& smartboardEntityID, const bool& isPresenter) {
|
void ScreenshareScriptingInterface::startScreenshare(const QUuid& screenshareZoneID, const QUuid& smartboardEntityID, const bool& isPresenter) {
|
||||||
if (QThread::currentThread() != thread()) {
|
if (QThread::currentThread() != thread()) {
|
||||||
// We must start a new QProcess from the main thread.
|
// We must start a new QProcess from the main thread.
|
||||||
QMetaObject::invokeMethod(
|
QMetaObject::invokeMethod(
|
||||||
this, "startScreenshare",
|
this, "startScreenshare",
|
||||||
|
Q_ARG(const QUuid&, screenshareZoneID),
|
||||||
|
Q_ARG(const QUuid&, smartboardEntityID),
|
||||||
Q_ARG(const bool&, isPresenter)
|
Q_ARG(const bool&, isPresenter)
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
|
@ -111,10 +113,13 @@ void ScreenshareScriptingInterface::startScreenshare(const QUuid& screenshareZon
|
||||||
localScreenshareWebEntityProps.setPosition(smartboardProps.getPosition());
|
localScreenshareWebEntityProps.setPosition(smartboardProps.getPosition());
|
||||||
localScreenshareWebEntityProps.setDimensions(smartboardProps.getDimensions());
|
localScreenshareWebEntityProps.setDimensions(smartboardProps.getDimensions());
|
||||||
|
|
||||||
_screenshareViewerLocalWebEntityUUID = esi->addEntity(localScreenshareWebEntityProps, "local");
|
QString hostType = "local";
|
||||||
|
_screenshareViewerLocalWebEntityUUID = esi->addEntity(localScreenshareWebEntityProps, hostType);
|
||||||
|
|
||||||
QObject::connect(esi.data(), &EntityScriptingInterface::webEventReceived, this, [&](const QUuid& entityID, const QVariant& message) {
|
QObject::connect(esi.data(), &EntityScriptingInterface::webEventReceived, this, [&](const QUuid& entityID, const QVariant& message) {
|
||||||
if (entityID == _screenshareViewerLocalWebEntityUUID) {
|
if (entityID == _screenshareViewerLocalWebEntityUUID) {
|
||||||
|
qDebug() << "ZRF HERE! Inside `webEventReceived(). `entityID`:" << entityID << "`_screenshareViewerLocalWebEntityUUID`:" << _screenshareViewerLocalWebEntityUUID;
|
||||||
|
|
||||||
auto esi = DependencyManager::get<EntityScriptingInterface>();
|
auto esi = DependencyManager::get<EntityScriptingInterface>();
|
||||||
if (!esi) {
|
if (!esi) {
|
||||||
return;
|
return;
|
||||||
|
@ -123,15 +128,26 @@ void ScreenshareScriptingInterface::startScreenshare(const QUuid& screenshareZon
|
||||||
QJsonDocument jsonMessage = QJsonDocument::fromVariant(message);
|
QJsonDocument jsonMessage = QJsonDocument::fromVariant(message);
|
||||||
QJsonObject jsonObject = jsonMessage.object();
|
QJsonObject jsonObject = jsonMessage.object();
|
||||||
|
|
||||||
if (jsonObject["type"] == "eventbridge_ready") {
|
qDebug() << "ZRF HERE! Inside `webEventReceived(). `message`:" << message << "`jsonMessage`:" << jsonMessage;
|
||||||
|
|
||||||
|
if (jsonObject["app"] != "screenshare") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
qDebug() << "ZRF HERE! Inside `webEventReceived(). we're still here!";
|
||||||
|
|
||||||
|
if (jsonObject["method"] == "eventBridgeReady") {
|
||||||
QJsonObject responseObject;
|
QJsonObject responseObject;
|
||||||
responseObject.insert("type", "receiveConnectionInfo");
|
responseObject.insert("app", "screenshare");
|
||||||
|
responseObject.insert("method", "receiveConnectionInfo");
|
||||||
QJsonObject responseObjectData;
|
QJsonObject responseObjectData;
|
||||||
responseObjectData.insert("token", token);
|
responseObjectData.insert("token", token);
|
||||||
responseObjectData.insert("projectAPIKey", apiKey);
|
responseObjectData.insert("projectAPIKey", apiKey);
|
||||||
responseObjectData.insert("sessionID", sessionID);
|
responseObjectData.insert("sessionID", sessionID);
|
||||||
responseObject.insert("data", responseObjectData);
|
responseObject.insert("data", responseObjectData);
|
||||||
|
|
||||||
|
qDebug() << "ZRF HERE! Inside `webEventReceived(). `responseObject.toVariantMap()`:" << responseObject.toVariantMap();
|
||||||
|
|
||||||
esi->emitScriptEvent(_screenshareViewerLocalWebEntityUUID, responseObject.toVariantMap());
|
esi->emitScriptEvent(_screenshareViewerLocalWebEntityUUID, responseObject.toVariantMap());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,4 +170,5 @@ void ScreenshareScriptingInterface::stopScreenshare() {
|
||||||
esi->deleteEntity(_screenshareViewerLocalWebEntityUUID);
|
esi->deleteEntity(_screenshareViewerLocalWebEntityUUID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_screenshareViewerLocalWebEntityUUID = "{00000000-0000-0000-0000-000000000000}";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue