-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
140 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -229,3 +229,7 @@ body { | |
.insight p:not(:last-child) { | ||
margin-bottom: 5px; | ||
} | ||
|
||
.title.vid-title { | ||
margin-bottom: 2px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,44 @@ | ||
$(document).ready(function() { | ||
const syncedVids = document.querySelectorAll('video.synced'); | ||
const syncedGroups = ["synced-1", "synced-2"]; | ||
|
||
let vidsReady = 0; | ||
let vidsEnded = 0; | ||
let vidsReady = {}; | ||
let vidsEnded = {}; | ||
|
||
for (const vid of syncedVids) { | ||
vid.oncanplay = () => { | ||
vid.oncanplay = null; | ||
vidsReady += 1; | ||
console.log(`${vidsReady}/${syncedVids.length} videos ready`); | ||
if (vidsReady === syncedVids.length) { | ||
console.log("Starting all videos"); | ||
for (const v of syncedVids) { | ||
v.play(); | ||
} | ||
} | ||
} | ||
for (const group of syncedGroups) { | ||
vidsReady[group] = 0; | ||
vidsEnded[group] = 0; | ||
|
||
vid.onended = () => { | ||
vidsEnded += 1; | ||
console.log(`${vidsEnded}/${syncedVids.length} videos finished`); | ||
if (vidsEnded === syncedVids.length) { | ||
console.log("Restarting all videos"); | ||
setTimeout(() => { | ||
vidsEnded = 0; | ||
const syncedVids = document.querySelectorAll(`video.${group}`); | ||
|
||
for (const vid of syncedVids) { | ||
vid.oncanplay = () => { | ||
vid.oncanplay = null; | ||
vidsReady[group] += 1; | ||
console.log(`${vidsReady[group]}/${syncedVids.length} videos ready in group ${group}`); | ||
if (vidsReady[group] === syncedVids.length) { | ||
console.log(`Starting all videos in group ${group}`); | ||
for (const v of syncedVids) { | ||
v.currentTime = 0; | ||
v.play(); | ||
} | ||
}, 1000); | ||
} | ||
} | ||
|
||
vid.onended = () => { | ||
vidsEnded[group] += 1; | ||
console.log(`${vidsEnded[group]}/${syncedVids.length} videos finished in group ${group}`); | ||
if (vidsEnded[group] === syncedVids.length) { | ||
console.log(`Restarting all videos in group ${group}`); | ||
setTimeout(() => { | ||
vidsEnded[group] = 0; | ||
for (const v of syncedVids) { | ||
v.currentTime = 0; | ||
v.play(); | ||
} | ||
}, 1000); | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
}); |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.