Compare commits
10 Commits
8ec53c551b
...
41189d7f43
Author | SHA1 | Date | |
---|---|---|---|
|
41189d7f43 | ||
|
a94cf0a2b8 | ||
|
23b697b81c | ||
|
d467a54c6c | ||
|
db5730c8a8 | ||
|
b719f32cf3 | ||
|
8dc7e00978 | ||
|
0ddc1afa1b | ||
|
689adc927f | ||
|
7b4f6e9659 |
@ -41,7 +41,15 @@
|
|||||||
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;
|
||||||
@ -160,6 +168,11 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
top: 1px;
|
top: 1px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
background-color: #333333;
|
||||||
|
color:white;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
|
@ -42,12 +42,10 @@
|
|||||||
|
|
||||||
<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" controls autoplay>
|
<video id="video" poster="assets/clickToWatch.png" 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;
|
||||||
@ -82,7 +80,6 @@
|
|||||||
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 () {
|
||||||
@ -114,7 +111,8 @@
|
|||||||
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);
|
||||||
@ -126,7 +124,6 @@
|
|||||||
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;
|
||||||
@ -167,6 +164,8 @@
|
|||||||
} 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,3 +1,10 @@
|
|||||||
|
// 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");
|
||||||
@ -88,10 +95,19 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
_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);
|
||||||
@ -275,6 +291,7 @@
|
|||||||
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;
|
||||||
@ -370,6 +387,7 @@
|
|||||||
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,3 +1,10 @@
|
|||||||
|
// 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");
|
||||||
@ -149,6 +156,12 @@
|
|||||||
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