-
Notifications
You must be signed in to change notification settings - Fork 35
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
1 parent
5026e9f
commit f7075ef
Showing
17 changed files
with
1,771 additions
and
30 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
DATABASE_URL=postgresql://<POSTGRES_USER>:<POSTGRES_PASSWORD>@localhost:5432/<DB_NAME> | ||
TOKENTERMINAL_API_KEY=<TOKENTERMINAL_API_KEY> | ||
LIVEPEER_COM_API_KEY= |
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,2 +1,3 @@ | ||
node_modules | ||
.next | ||
.next | ||
*.css |
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 |
---|---|---|
@@ -0,0 +1,159 @@ | ||
/* eslint-disable */ | ||
import Box from "../Box"; | ||
import ScreenEffect from "../../lib/screenEffect"; | ||
import { useEffect } from "react"; | ||
|
||
const OldTV = () => { | ||
useEffect(() => { | ||
const screen = new ScreenEffect("#screen", {}); | ||
const dat = require("dat.gui"); | ||
const gui = new dat.GUI(); | ||
|
||
const config = { | ||
effects: { | ||
roll: { | ||
enabled: false, | ||
options: { | ||
speed: 1000, | ||
}, | ||
}, | ||
image: { | ||
enabled: true, | ||
options: { | ||
src: "https://images.unsplash.com/photo-1505977404378-3a0e28ec6488?ixlib=rb-1.2.1&q=85&fm=jpg&crop=entropy&cs=srgb&ixid=eyJhcHBfaWQiOjE0NTg5fQ", | ||
blur: 1.2, | ||
}, | ||
}, | ||
vignette: { enabled: true }, | ||
scanlines: { enabled: true }, | ||
vcr: { | ||
enabled: true, | ||
options: { | ||
opacity: 1, | ||
miny: 220, | ||
miny2: 220, | ||
num: 70, | ||
fps: 60, | ||
}, | ||
}, | ||
wobbley: { enabled: true }, | ||
snow: { | ||
enabled: true, | ||
options: { | ||
opacity: 0.2, | ||
}, | ||
}, | ||
}, | ||
}; | ||
|
||
const f1 = gui.addFolder("Effects"); | ||
const f2 = gui.addFolder("Snow"); | ||
const f3 = gui.addFolder("VCR"); | ||
const f4 = gui.addFolder("Roll"); | ||
const f5 = gui.addFolder("Image"); | ||
|
||
for (const effect in config.effects) { | ||
const type = config.effects[effect]; | ||
f1.add(type, "enabled") | ||
.name(effect) | ||
.onChange((bool) => { | ||
if (bool) { | ||
screen.add(effect, config.effects[effect].options); | ||
} else { | ||
screen.remove(effect); | ||
} | ||
}); | ||
|
||
if (type.options) { | ||
const folder = effect === "vcr" || effect === "video" ? f3 : f2; | ||
for (const p in type.options) { | ||
if (p === "speed") { | ||
f4.add(type.options, p) | ||
.min(100) | ||
.step(1) | ||
.max(10000) | ||
.onChange((val) => { | ||
screen.effects[ | ||
effect | ||
].node.style.animationDuration = `${val}ms`; | ||
}); | ||
} | ||
|
||
if (p === "opacity") { | ||
folder | ||
.add(type.options, p) | ||
.name(`${effect} opacity`) | ||
.min(0) | ||
.step(0.1) | ||
.max(1) | ||
.onChange((val) => { | ||
screen.effects[effect].node.style.opacity = val; | ||
}); | ||
} | ||
|
||
if (p === "miny") { | ||
folder | ||
.add(type.options, p) | ||
.name(`tracking`) | ||
.min(0) | ||
.step(0.1) | ||
.max(400) | ||
.onChange((val) => { | ||
screen.effects[effect].config.miny = val; | ||
screen.effects[effect].config.miny2 = 400 - val; | ||
}); | ||
} | ||
|
||
if (p === "num") { | ||
folder | ||
.add(type.options, p) | ||
.name(`tape age`) | ||
.min(1) | ||
.step(0.1) | ||
.max(100) | ||
.onChange((val) => { | ||
screen.effects[effect].config.num = val; | ||
}); | ||
} | ||
|
||
if (p === "blur") { | ||
f5.add(type.options, p) | ||
.name(`blur`) | ||
.min(1) | ||
.step(0.1) | ||
.max(5) | ||
.onChange((val) => { | ||
if (effect === "vcr") { | ||
screen.effects[effect].config.blur = val; | ||
} else { | ||
screen.effects[effect].node.style.filter = `blur(${val}px)`; | ||
} | ||
}); | ||
} | ||
} | ||
} | ||
} | ||
|
||
f1.open(); | ||
f2.open(); | ||
f3.open(); | ||
f4.open(); | ||
f5.open(); | ||
|
||
setTimeout(() => { | ||
for (const prop in config.effects) { | ||
if (!!config.effects[prop].enabled) { | ||
screen.add(prop, config.effects[prop].options); | ||
} | ||
} | ||
}, 1000); | ||
}, []); | ||
|
||
return ( | ||
<Box className="tv"> | ||
<Box id="screen" /> | ||
</Box> | ||
); | ||
}; | ||
|
||
export default OldTV; |
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import React from "react"; | ||
import videojs from "video.js"; | ||
import "videojs-contrib-quality-levels"; | ||
import "videojs-hls-quality-selector"; | ||
import "video.js/dist/video-js.css"; | ||
|
||
export const VideoJS = (props) => { | ||
const videoRef = React.useRef(null); | ||
const playerRef = React.useRef(null); | ||
const { options, onReady } = props; | ||
|
||
React.useEffect(() => { | ||
// make sure Video.js player is only initialized once | ||
if (!playerRef.current) { | ||
const videoElement = videoRef.current; | ||
if (!videoElement) return; | ||
|
||
const player = (playerRef.current = videojs(videoElement, options, () => { | ||
console.log("player is ready"); | ||
onReady && onReady(player); | ||
})); | ||
} else { | ||
// you can update player here [update player through props] | ||
// const player = playerRef.current; | ||
// player.autoplay(options.autoplay); | ||
// player.src(options.sources); | ||
} | ||
}, [options, onReady]); | ||
|
||
// Dispose the Video.js player when the functional component unmounts | ||
React.useEffect(() => { | ||
return () => { | ||
if (playerRef.current) { | ||
playerRef.current.dispose(); | ||
playerRef.current = null; | ||
} | ||
}; | ||
}, []); | ||
|
||
return ( | ||
<div data-vjs-player> | ||
<video | ||
muted | ||
autoPlay | ||
ref={videoRef} | ||
className="video-js vjs-big-play-centered" | ||
/> | ||
</div> | ||
); | ||
}; | ||
|
||
export default VideoJS; |
Oops, something went wrong.
f7075ef
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: