mirror of
https://github.com/DerTyp7/obs-twitch-camera-frame.git
synced 2025-10-29 04:42:13 +01:00
first commit
This commit is contained in:
36
js/app.js
Normal file
36
js/app.js
Normal file
@@ -0,0 +1,36 @@
|
||||
const subCount = document.getElementById("subCount");
|
||||
const frame = document.getElementById("frame");
|
||||
|
||||
let subCountNumber = 0;
|
||||
|
||||
function updateSubCount() {
|
||||
fetch(
|
||||
`https://api.tipeeestream.com/v1.0/events/forever.json?apiKey=${CONFIG.apiKey}`
|
||||
)
|
||||
.then((res) => res.json())
|
||||
.then((json) => {
|
||||
subCountNumber = json.datas.subscribers;
|
||||
subCount.innerText = subCountNumber;
|
||||
});
|
||||
}
|
||||
|
||||
function sub(subName) {
|
||||
frame.style.animationName = "subAnimation";
|
||||
frame.style.animationDuration = "2s";
|
||||
|
||||
subCount.style.animationName = "backgroundSubAnimation";
|
||||
subCount.style.animationDuration = "2s";
|
||||
|
||||
subCount.innerText = subName + " " + subCountNumber;
|
||||
|
||||
setTimeout(() => {
|
||||
frame.style.animationName = "borderAnimation";
|
||||
frame.style.animationDuration = "20s";
|
||||
|
||||
subCount.style.animationName = "backgroundAnimation";
|
||||
subCount.style.animationDuration = "20s";
|
||||
subCount.innerText = subCountNumber;
|
||||
updateSubCount();
|
||||
}, 2000);
|
||||
}
|
||||
updateSubCount();
|
||||
7
js/socket.io.min.js
vendored
Normal file
7
js/socket.io.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
24
js/socket.js
Normal file
24
js/socket.js
Normal file
@@ -0,0 +1,24 @@
|
||||
fetch("https://api.tipeeestream.com/v2.0/site/socket")
|
||||
.then((res) => res.json())
|
||||
.then((json) => {
|
||||
if (json.code == 200) {
|
||||
const socket = io(`${json.datas.host}:${json.datas.port}`, {
|
||||
query: {
|
||||
access_token: CONFIG.apiKey,
|
||||
},
|
||||
});
|
||||
|
||||
socket.on("connect", () => {
|
||||
console.log("Connected");
|
||||
socket.emit("join-room", {
|
||||
room: CONFIG.apiKey,
|
||||
username: "DerTyp876",
|
||||
});
|
||||
});
|
||||
socket.on("new-event", (data) => {
|
||||
if (data.event.type == "subscription") {
|
||||
sub(data.event.parameters.username);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user