-
-
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
Jared Kotoff
authored
Nov 23, 2021
1 parent
dbc7754
commit 13cd9f2
Showing
9 changed files
with
237 additions
and
109 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
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
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 |
---|---|---|
@@ -1,10 +1,14 @@ | ||
module github.com/UpDownLeftDie/obs-random-videos/v2 | ||
|
||
go 1.16 | ||
go 1.17 | ||
|
||
require github.com/sparkdemcisin81/promptui v1.0.0 | ||
|
||
require ( | ||
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e // indirect | ||
github.com/juju/ansiterm v0.0.0-20210929141451-8b71cc96ebdc // indirect | ||
github.com/lunixbochs/vtclean v1.0.0 // indirect | ||
github.com/mattn/go-colorable v0.1.8 // indirect | ||
github.com/sparkdemcisin81/promptui v1.0.0 | ||
golang.org/x/sys v0.0.0-20210514084401-e8d321eab015 // indirect | ||
github.com/mattn/go-colorable v0.1.11 // indirect | ||
github.com/mattn/go-isatty v0.0.14 // indirect | ||
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359 // indirect | ||
) |
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 |
---|---|---|
@@ -1,17 +1,44 @@ | ||
const player = document.getElementById("videoPlayer1"); | ||
const player2 = document.getElementById("videoPlayer2"); | ||
player.addEventListener("ended", () => playNext(player2, player), {passive: true}); | ||
player2.addEventListener("ended", () => playNext(player, player2), {passive: true}); | ||
// @ts-check | ||
const player = /** @type {HTMLMediaElement} */ ( | ||
document.getElementById('videoPlayer1') | ||
); | ||
|
||
/* Initial logic */ | ||
const player2 = /** @type {HTMLMediaElement} */ ( | ||
document.getElementById('videoPlayer2') | ||
); | ||
player.addEventListener( | ||
'ended', | ||
() => { | ||
if (!loopFirstVideo) { | ||
progressPlaylistState(); | ||
} | ||
playNext(player2, player); | ||
}, | ||
{ | ||
passive: true, | ||
}, | ||
); | ||
player2.addEventListener( | ||
'ended', | ||
() => { | ||
if (!loopFirstVideo) { | ||
progressPlaylistState(); | ||
} | ||
playNext(player, player2); | ||
}, | ||
{ | ||
passive: true, | ||
}, | ||
); | ||
|
||
const mp4Source = player.getElementsByClassName("mp4Source")[0]; | ||
let video = `${mediaFolder}${mediaFiles[0]}`; | ||
// check if we played this video last run | ||
if (mediaFiles.length > 1 && localStorage.getItem("lastPlayed") === video) { | ||
video = `${mediaFolder}${mediaFiles[1]}`; | ||
} | ||
mp4Source.setAttribute("src", video); | ||
/***** Initial load *****/ | ||
|
||
const mp4Source = player.getElementsByClassName('mp4Source')[0]; | ||
let video = getNextPlaylistItem(); | ||
// have to move the state forward after getting the first video | ||
progressPlaylistState(); | ||
|
||
mp4Source.setAttribute('src', video); | ||
player.load(); | ||
|
||
playNext(player, player2); | ||
playNext(player, player2); |
Oops, something went wrong.