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;
|
||||
}
|
||||
|
||||
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 {
|
||||
width: 450px;
|
||||
@ -160,6 +168,11 @@
|
||||
position: relative;
|
||||
top: 1px;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: #333333;
|
||||
color:white;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
|
@ -42,12 +42,10 @@
|
||||
|
||||
<body bgcolor="#333333">
|
||||
<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">
|
||||
</video>
|
||||
</div>
|
||||
|
||||
<button id="joinInButton" onclick="requestSync()">Join In</button>
|
||||
|
||||
<script>
|
||||
var firstTime = true;
|
||||
@ -82,7 +80,6 @@
|
||||
document.getElementById('video').src = messageData.videoUrl;
|
||||
document.getElementById('video').currentTime = messageData.timeStamp;
|
||||
firstTime = false;
|
||||
document.getElementById("joinInButton").hidden = true;
|
||||
if (!messageData.videoPlaying) {
|
||||
var vid = document.getElementById("video");
|
||||
vid.onloadeddata = function () {
|
||||
@ -114,7 +111,8 @@
|
||||
videoUrl: messageData.videoUrl,
|
||||
length: v.duration,
|
||||
timeStamp: v.currentTime,
|
||||
myTimeStamp: myTimeStamp
|
||||
myTimeStamp: myTimeStamp,
|
||||
aspectRatio: v.videoWidth / v.videoHeight
|
||||
};
|
||||
EventBridge.emitWebEvent(JSON.stringify(readyEvent));
|
||||
clearInterval(videoLoadedSendMessageInterval);
|
||||
@ -126,7 +124,6 @@
|
||||
document.getElementById('video').src = "http://";
|
||||
firstTime = true;
|
||||
HasBeenClicked = false;
|
||||
document.getElementById("joinInButton").hidden = false;
|
||||
} else if (messageData.buttonAction == "volumeButtonMinus") {
|
||||
var video = document.getElementById('video');
|
||||
var volume = video.volume;
|
||||
@ -167,6 +164,8 @@
|
||||
} else if (messageData.action == "videoEnd") {
|
||||
document.getElementById("video").src = "";
|
||||
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 () {
|
||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||
var videoSyncInterface = Script.resolvePath("assets/videoSyncInterface.html");
|
||||
@ -88,10 +95,19 @@
|
||||
});
|
||||
}
|
||||
_entityID = entityID;
|
||||
Script.addEventHandler(_entityID, "mousePressOnEntity", onFirstClick);
|
||||
Entities.webEventReceived.connect(onWebEvent);
|
||||
addButtons();
|
||||
}
|
||||
|
||||
function onFirstClick() {
|
||||
Entities.emitScriptEvent(_entityID, JSON.stringify({
|
||||
action: "firstClick"
|
||||
}));
|
||||
console.log("onFirstClick");
|
||||
Script.removeEventHandler(_entityID, "mousePressOnEntity", onFirstClick);
|
||||
}
|
||||
|
||||
function onWebEvent(uuid, event) {
|
||||
if (uuid == _entityID || volumeSliderUuid == uuid) {
|
||||
var messageData = JSON.parse(event);
|
||||
@ -275,6 +291,7 @@
|
||||
actOnButtonPressed("pause");
|
||||
break;
|
||||
case leaveButtonUuid:
|
||||
Script.addEventHandler(_entityID, "mousePressOnEntity", onFirstClick);
|
||||
console.log("LeaveButtonUuid Yes");
|
||||
actOnButtonPressed("leave");
|
||||
buttonsAreActive = false;
|
||||
@ -370,6 +387,7 @@
|
||||
Script.removeEventHandler(leaveButtonUuid, "mousePressOnEntity", evaluateWhichButtonPressed);
|
||||
Script.removeEventHandler(pauseButtonUuid, "mousePressOnEntity", evaluateWhichButtonPressed);
|
||||
Script.removeEventHandler(playButtonUuid, "mousePressOnEntity", evaluateWhichButtonPressed);
|
||||
Script.addEventHandler(_entityID, "mousePressOnEntity", onFirstClick);
|
||||
}
|
||||
|
||||
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 () {
|
||||
var videoSyncServerScriptUrl = Script.resolvePath("videoSyncServerScript.js");
|
||||
var sourceUrl = Script.resolvePath("videoSync.html");
|
||||
@ -149,6 +156,12 @@
|
||||
if (useGatewayServer && gatewayServerConnected) {
|
||||
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") {
|
||||
timeStamp = messageData.timeStamp;
|
||||
if (intervalIsRunning) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user