1
0

Update videoSyncInterface.html

This commit is contained in:
Darlingnotin 2020-10-10 19:40:47 -04:00 committed by GitHub
parent 4708fdbdcf
commit c43834df7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -119,6 +119,9 @@
</div> </div>
<h2 id="checkMark"></h2> <h2 id="checkMark"></h2>
<p id="description"></p> <p id="description"></p>
<input type="checkbox" id="useGatewayCheckbox" onclick="useGatewayCheckbox()">
<label for="useGatewayCheckbox">Use Gateway Server</label><br>
<span id="gatewayServerInputField"></span>
</body> </body>
<script> <script>
var timeoutIs = false; var timeoutIs = false;
@ -144,6 +147,7 @@
timeoutIs = true; timeoutIs = true;
} }
} }
function newVideoURL() { function newVideoURL() {
videoURL = document.getElementById("videoURL").value; videoURL = document.getElementById("videoURL").value;
var readyEvent = { var readyEvent = {
@ -206,11 +210,14 @@
EventBridge.scriptEventReceived.connect(function (message) { EventBridge.scriptEventReceived.connect(function (message) {
var messageData = JSON.parse(message); var messageData = JSON.parse(message);
if (messageData.action == "RequestVideoLengthAndTimeStampResponse") { if (messageData.action == "RequestVideoLengthAndTimeStampResponse") {
if (messageData.myTimeStamp == myTimeStamp) {
document.getElementById("videoRange").max = messageData.length; document.getElementById("videoRange").max = messageData.length;
document.getElementById("videoRange").value = messageData.timeStamp; document.getElementById("videoRange").value = messageData.timeStamp;
videoLength = messageData.length; videoLength = messageData.length;
tabletId = messageData.tabletId; tabletId = messageData.tabletId;
if (messageData.serverConnected) {
var serverConnectedToUrl = document.createElement("p");
serverConnectedToUrl.innerHTML = "<h1 style='color: green;'>Connected To Gateway Server " + messageData.wsUrl + "</h1>";
document.body.appendChild(serverConnectedToUrl);
} }
} else if (messageData.action == "requestVideoPlayingStatusServerReply") { } else if (messageData.action == "requestVideoPlayingStatusServerReply") {
if (messageData.isLooping && !messageData.isLoopingStartAtBeginning) { if (messageData.isLooping && !messageData.isLoopingStartAtBeginning) {
@ -250,6 +257,26 @@
} }
}); });
function useGatewayCheckbox() {
var useGatewayCheckbox = document.getElementById("useGatewayCheckbox").checked;
if (useGatewayCheckbox) {
document.getElementById("gatewayServerInputField").innerHTML = "<input type='text' id='gatewayUrl' placeholder='Enter Server IP Address'><br><button class='myButton' onclick='connectToGateway()'>Connect</button>";
} else if (!useGatewayCheckbox) {
document.getElementById("gatewayServerInputField").innerHTML = "";
}
}
function connectToGateway() {
var gatewayUrl = document.getElementById("gatewayUrl").value;
var readyEvent = {
"action": "videoSyncGateway",
"useGatewayServer": true,
"gatewayIp": gatewayUrl
};
EventBridge.emitWebEvent(JSON.stringify(readyEvent));
document.getElementById("gatewayServerInputField").innerHTML = "";
}
</script> </script>
</html> </html>