Showing the changes to interface/src/scripting/ScreenshareScriptingInterface.cpp (1 of 2 files). Show all
Unified · Split
| @@ -30,12 +30,14 @@ ScreenshareScriptingInterface::~ScreenshareScriptingInterface() { · 29 unmodified lines | |||
| 30 | static const EntityTypes::EntityType LOCAL_SCREENSHARE_WEB_ENTITY_TYPE = EntityTypes::Web; | 30 | static const EntityTypes::EntityType LOCAL_SCREENSHARE_WEB_ENTITY_TYPE = EntityTypes::Web; |
| 31 | static const uint8_t LOCAL_SCREENSHARE_WEB_ENTITY_FPS = 30; | 31 | static const uint8_t LOCAL_SCREENSHARE_WEB_ENTITY_FPS = 30; |
| 32 | static const glm::vec3 LOCAL_SCREENSHARE_WEB_ENTITY_LOCAL_POSITION(0.0f, 0.0f, 0.1f); | 32 | static const glm::vec3 LOCAL_SCREENSHARE_WEB_ENTITY_LOCAL_POSITION(0.0f, 0.0f, 0.1f); |
| 33 | static const QString LOCAL_SCREENSHARE_WEB_ENTITY_URL = "https://s3.amazonaws.com/hifi-content/Experiences/Releases/usefulUtilities/smartBoard/screenshareViewer/screenshareClient.html"; | 33 | static const QString LOCAL_SCREENSHARE_WEB_ENTITY_URL = "https://hifi-content.s3.amazonaws.com/Experiences/Releases/usefulUtilities/smartBoard/screenshareViewer/screenshareClient.html?1"; |
| 34 | void ScreenshareScriptingInterface::startScreenshare(const QUuid& screenshareZoneID, const QUuid& smartboardEntityID, const bool& isPresenter) { | 34 | void ScreenshareScriptingInterface::startScreenshare(const QUuid& screenshareZoneID, const QUuid& smartboardEntityID, const bool& isPresenter) { |
| 35 | if (QThread::currentThread() != thread()) { | 35 | if (QThread::currentThread() != thread()) { |
| 36 | // We must start a new QProcess from the main thread. | 36 | // We must start a new QProcess from the main thread. |
| 37 | QMetaObject::invokeMethod( | 37 | QMetaObject::invokeMethod( |
| 38 | this, "startScreenshare", | 38 | this, "startScreenshare", |
| 39 | Q_ARG(const QUuid&, screenshareZoneID), | ||
| 40 | Q_ARG(const QUuid&, smartboardEntityID), | ||
| 39 | Q_ARG(const bool&, isPresenter) | 41 | Q_ARG(const bool&, isPresenter) |
| 40 | ); | 42 | ); |
| 41 | return; | 43 | return; |
| @@ -111,10 +113,13 @@ void ScreenshareScriptingInterface::startScreenshare(const QUuid& screenshareZon · 69 unmodified lines | |||
| 111 | localScreenshareWebEntityProps.setPosition(smartboardProps.getPosition()); | 113 | localScreenshareWebEntityProps.setPosition(smartboardProps.getPosition()); |
| 112 | localScreenshareWebEntityProps.setDimensions(smartboardProps.getDimensions()); | 114 | localScreenshareWebEntityProps.setDimensions(smartboardProps.getDimensions()); |
| 113 | 115 | ||
| 114 | _screenshareViewerLocalWebEntityUUID = esi->addEntity(localScreenshareWebEntityProps, "local"); | 116 | QString hostType = "local"; |
| 117 | _screenshareViewerLocalWebEntityUUID = esi->addEntity(localScreenshareWebEntityProps, hostType); | ||
| 115 | 118 | ||
| 116 | QObject::connect(esi.data(), &EntityScriptingInterface::webEventReceived, this, [&](const QUuid& entityID, const QVariant& message) { | 119 | QObject::connect(esi.data(), &EntityScriptingInterface::webEventReceived, this, [&](const QUuid& entityID, const QVariant& message) { |
| 117 | if (entityID == _screenshareViewerLocalWebEntityUUID) { | 120 | if (entityID == _screenshareViewerLocalWebEntityUUID) { |
| 121 | qDebug() << "ZRF HERE! Inside `webEventReceived(). `entityID`:" << entityID << "`_screenshareViewerLocalWebEntityUUID`:" << _screenshareViewerLocalWebEntityUUID; | ||
| 122 | |||
| 118 | auto esi = DependencyManager::get<EntityScriptingInterface>(); | 123 | auto esi = DependencyManager::get<EntityScriptingInterface>(); |
| 119 | if (!esi) { | 124 | if (!esi) { |
| 120 | return; | 125 | return; |
| @@ -123,15 +128,26 @@ void ScreenshareScriptingInterface::startScreenshare(const QUuid& screenshareZon · 2 unmodified lines | |||
| 123 | QJsonDocument jsonMessage = QJsonDocument::fromVariant(message); | 128 | QJsonDocument jsonMessage = QJsonDocument::fromVariant(message); |
| 124 | QJsonObject jsonObject = jsonMessage.object(); | 129 | QJsonObject jsonObject = jsonMessage.object(); |
| 125 | 130 | ||
| 126 | if (jsonObject["type"] == "eventbridge_ready") { | 131 | qDebug() << "ZRF HERE! Inside `webEventReceived(). `message`:" << message << "`jsonMessage`:" << jsonMessage; |
| 132 | |||
| 133 | if (jsonObject["app"] != "screenshare") { | ||
| 134 | return; | ||
| 135 | } | ||
| 136 | |||
| 137 | qDebug() << "ZRF HERE! Inside `webEventReceived(). we're still here!"; | ||
| 138 | |||
| 139 | if (jsonObject["method"] == "eventBridgeReady") { | ||
| 127 | QJsonObject responseObject; | 140 | QJsonObject responseObject; |
| 128 | responseObject.insert("type", "receiveConnectionInfo"); | 141 | responseObject.insert("app", "screenshare"); |
| 142 | responseObject.insert("method", "receiveConnectionInfo"); | ||
| 129 | QJsonObject responseObjectData; | 143 | QJsonObject responseObjectData; |
| 130 | responseObjectData.insert("token", token); | 144 | responseObjectData.insert("token", token); |
| 131 | responseObjectData.insert("projectAPIKey", apiKey); | 145 | responseObjectData.insert("projectAPIKey", apiKey); |
| 132 | responseObjectData.insert("sessionID", sessionID); | 146 | responseObjectData.insert("sessionID", sessionID); |
| 133 | responseObject.insert("data", responseObjectData); | 147 | responseObject.insert("data", responseObjectData); |
| 134 | 148 | ||
| 149 | qDebug() << "ZRF HERE! Inside `webEventReceived(). `responseObject.toVariantMap()`:" << responseObject.toVariantMap(); | ||
| 150 | |||
| 135 | esi->emitScriptEvent(_screenshareViewerLocalWebEntityUUID, responseObject.toVariantMap()); | 151 | esi->emitScriptEvent(_screenshareViewerLocalWebEntityUUID, responseObject.toVariantMap()); |
| 136 | } | 152 | } |
| 137 | } | 153 | } |
| @@ -154,4 +170,5 @@ void ScreenshareScriptingInterface::stopScreenshare() { · 16 unmodified lines | |||
| 154 | esi->deleteEntity(_screenshareViewerLocalWebEntityUUID); | 170 | esi->deleteEntity(_screenshareViewerLocalWebEntityUUID); |
| 155 | } | 171 | } |
| 156 | } | 172 | } |
| 173 | _screenshareViewerLocalWebEntityUUID = "{00000000-0000-0000-0000-000000000000}"; | ||
| 157 | } | 174 | } |