Compare commits
No commits in common. "41189d7f4397d78e01deb5ae97e815e5547801a4" and "8ec53c551b851584ebf65f33ddd01c2faecf0398" have entirely different histories.
41189d7f43
...
8ec53c551b
@ -41,15 +41,7 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
input[type=text] {
|
input[type=text],
|
||||||
width: 100%;
|
|
||||||
padding: 12px 20px;
|
|
||||||
margin: 8px 0;
|
|
||||||
display: inline-block;
|
|
||||||
border: 1px solid #dddddd;
|
|
||||||
border-radius: 4px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
|
|
||||||
select {
|
select {
|
||||||
width: 450px;
|
width: 450px;
|
||||||
@ -168,11 +160,6 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
top: 1px;
|
top: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
|
||||||
background-color: #333333;
|
|
||||||
color:white;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
@ -42,10 +42,12 @@
|
|||||||
|
|
||||||
<body bgcolor="#333333">
|
<body bgcolor="#333333">
|
||||||
<div id="video-container" onclick="requestSync()">
|
<div id="video-container" onclick="requestSync()">
|
||||||
<video id="video" poster="assets/clickToWatch.png" autoplay>
|
<video id="video" poster="assets/clickToWatch.png" controls autoplay>
|
||||||
<source id="mp4_src" src=" " type="video/webm">
|
<source id="mp4_src" src=" " type="video/webm">
|
||||||
</video>
|
</video>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<button id="joinInButton" onclick="requestSync()">Join In</button>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var firstTime = true;
|
var firstTime = true;
|
||||||
@ -80,6 +82,7 @@
|
|||||||
document.getElementById('video').src = messageData.videoUrl;
|
document.getElementById('video').src = messageData.videoUrl;
|
||||||
document.getElementById('video').currentTime = messageData.timeStamp;
|
document.getElementById('video').currentTime = messageData.timeStamp;
|
||||||
firstTime = false;
|
firstTime = false;
|
||||||
|
document.getElementById("joinInButton").hidden = true;
|
||||||
if (!messageData.videoPlaying) {
|
if (!messageData.videoPlaying) {
|
||||||
var vid = document.getElementById("video");
|
var vid = document.getElementById("video");
|
||||||
vid.onloadeddata = function () {
|
vid.onloadeddata = function () {
|
||||||
@ -111,8 +114,7 @@
|
|||||||
videoUrl: messageData.videoUrl,
|
videoUrl: messageData.videoUrl,
|
||||||
length: v.duration,
|
length: v.duration,
|
||||||
timeStamp: v.currentTime,
|
timeStamp: v.currentTime,
|
||||||
myTimeStamp: myTimeStamp,
|
myTimeStamp: myTimeStamp
|
||||||
aspectRatio: v.videoWidth / v.videoHeight
|
|
||||||
};
|
};
|
||||||
EventBridge.emitWebEvent(JSON.stringify(readyEvent));
|
EventBridge.emitWebEvent(JSON.stringify(readyEvent));
|
||||||
clearInterval(videoLoadedSendMessageInterval);
|
clearInterval(videoLoadedSendMessageInterval);
|
||||||
@ -124,6 +126,7 @@
|
|||||||
document.getElementById('video').src = "http://";
|
document.getElementById('video').src = "http://";
|
||||||
firstTime = true;
|
firstTime = true;
|
||||||
HasBeenClicked = false;
|
HasBeenClicked = false;
|
||||||
|
document.getElementById("joinInButton").hidden = false;
|
||||||
} else if (messageData.buttonAction == "volumeButtonMinus") {
|
} else if (messageData.buttonAction == "volumeButtonMinus") {
|
||||||
var video = document.getElementById('video');
|
var video = document.getElementById('video');
|
||||||
var volume = video.volume;
|
var volume = video.volume;
|
||||||
@ -164,8 +167,6 @@
|
|||||||
} else if (messageData.action == "videoEnd") {
|
} else if (messageData.action == "videoEnd") {
|
||||||
document.getElementById("video").src = "";
|
document.getElementById("video").src = "";
|
||||||
document.getElementById('video').poster = "assets/clickToWatch.png"
|
document.getElementById('video').poster = "assets/clickToWatch.png"
|
||||||
} else if (messageData.action == "firstClick") {
|
|
||||||
requestSync();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
18
videoSync.js
18
videoSync.js
@ -1,10 +1,3 @@
|
|||||||
// Copyright (c) 2020 Danielle Arlington.
|
|
||||||
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, version 3.
|
|
||||||
// https://www.gnu.org/licenses/gpl-3.0.en.html
|
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||||
var videoSyncInterface = Script.resolvePath("assets/videoSyncInterface.html");
|
var videoSyncInterface = Script.resolvePath("assets/videoSyncInterface.html");
|
||||||
@ -95,19 +88,10 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
_entityID = entityID;
|
_entityID = entityID;
|
||||||
Script.addEventHandler(_entityID, "mousePressOnEntity", onFirstClick);
|
|
||||||
Entities.webEventReceived.connect(onWebEvent);
|
Entities.webEventReceived.connect(onWebEvent);
|
||||||
addButtons();
|
addButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onFirstClick() {
|
|
||||||
Entities.emitScriptEvent(_entityID, JSON.stringify({
|
|
||||||
action: "firstClick"
|
|
||||||
}));
|
|
||||||
console.log("onFirstClick");
|
|
||||||
Script.removeEventHandler(_entityID, "mousePressOnEntity", onFirstClick);
|
|
||||||
}
|
|
||||||
|
|
||||||
function onWebEvent(uuid, event) {
|
function onWebEvent(uuid, event) {
|
||||||
if (uuid == _entityID || volumeSliderUuid == uuid) {
|
if (uuid == _entityID || volumeSliderUuid == uuid) {
|
||||||
var messageData = JSON.parse(event);
|
var messageData = JSON.parse(event);
|
||||||
@ -291,7 +275,6 @@
|
|||||||
actOnButtonPressed("pause");
|
actOnButtonPressed("pause");
|
||||||
break;
|
break;
|
||||||
case leaveButtonUuid:
|
case leaveButtonUuid:
|
||||||
Script.addEventHandler(_entityID, "mousePressOnEntity", onFirstClick);
|
|
||||||
console.log("LeaveButtonUuid Yes");
|
console.log("LeaveButtonUuid Yes");
|
||||||
actOnButtonPressed("leave");
|
actOnButtonPressed("leave");
|
||||||
buttonsAreActive = false;
|
buttonsAreActive = false;
|
||||||
@ -387,7 +370,6 @@
|
|||||||
Script.removeEventHandler(leaveButtonUuid, "mousePressOnEntity", evaluateWhichButtonPressed);
|
Script.removeEventHandler(leaveButtonUuid, "mousePressOnEntity", evaluateWhichButtonPressed);
|
||||||
Script.removeEventHandler(pauseButtonUuid, "mousePressOnEntity", evaluateWhichButtonPressed);
|
Script.removeEventHandler(pauseButtonUuid, "mousePressOnEntity", evaluateWhichButtonPressed);
|
||||||
Script.removeEventHandler(playButtonUuid, "mousePressOnEntity", evaluateWhichButtonPressed);
|
Script.removeEventHandler(playButtonUuid, "mousePressOnEntity", evaluateWhichButtonPressed);
|
||||||
Script.addEventHandler(_entityID, "mousePressOnEntity", onFirstClick);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Messages.messageReceived.connect(onMessageReceived);
|
Messages.messageReceived.connect(onMessageReceived);
|
||||||
|
@ -1,10 +1,3 @@
|
|||||||
// Copyright (c) 2020 Danielle Arlington.
|
|
||||||
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, version 3.
|
|
||||||
// https://www.gnu.org/licenses/gpl-3.0.en.html
|
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
var videoSyncServerScriptUrl = Script.resolvePath("videoSyncServerScript.js");
|
var videoSyncServerScriptUrl = Script.resolvePath("videoSyncServerScript.js");
|
||||||
var sourceUrl = Script.resolvePath("videoSync.html");
|
var sourceUrl = Script.resolvePath("videoSync.html");
|
||||||
@ -156,12 +149,6 @@
|
|||||||
if (useGatewayServer && gatewayServerConnected) {
|
if (useGatewayServer && gatewayServerConnected) {
|
||||||
ws.send(JSON.stringify(wsNow));
|
ws.send(JSON.stringify(wsNow));
|
||||||
}
|
}
|
||||||
console.log(JSON.stringify(messageData));
|
|
||||||
var entity = Entities.getEntityProperties(videoPlayerChannel);
|
|
||||||
entity.dimensions.y = (entity.dimensions.x / messageData.aspectRatio) + .1
|
|
||||||
Entities.editEntity(videoPlayerChannel, {
|
|
||||||
dimensions: entity.dimensions
|
|
||||||
});
|
|
||||||
} else if (messageData.action == "play") {
|
} else if (messageData.action == "play") {
|
||||||
timeStamp = messageData.timeStamp;
|
timeStamp = messageData.timeStamp;
|
||||||
if (intervalIsRunning) {
|
if (intervalIsRunning) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user