This file contains hidden or 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
const blob = new Blob([combinedBuffer], { type: mimeType }); | |
const url = URL.createObjectURL(blob); | |
video.src = url; |
This file contains hidden or 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
// Get a specific chunk | |
const getVideoChunk = async (chunkId) => { | |
try { | |
const db = await initDB(); | |
return new Promise((resolve, reject) => { | |
const transaction = db.transaction(['chunks'], 'readonly'); | |
const store = transaction.objectStore('chunks'); | |
const request = store.get(chunkId); |
This file contains hidden or 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
const storeCompleteVideo = async (metadata, chunks) => { | |
try { | |
const db = await initDB(); | |
return new Promise((resolve, reject) => { | |
const transaction = db.transaction(['metadata', 'chunks'], 'readwrite'); | |
transaction.onerror = (event) => { | |
reject(event.target.error); | |
}; |
This file contains hidden or 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
let dbInstance = null; | |
// Initialize the database once and store the connection | |
const initDB = () => { | |
return new Promise((resolve, reject) => { | |
if (dbInstance) { | |
// Using existing database connection | |
resolve(dbInstance); | |
return; | |
} |
This file contains hidden or 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
const metadata = { | |
id: videoId, | |
title: videoFile.name, | |
mimeType: videoFile.type, | |
size: arrayBuffer.byteLength, | |
chunkCount: chunks.length, | |
dateAdded: new Date().toISOString() | |
}; |
This file contains hidden or 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
const arrayBuffer = await videoFile.arrayBuffer(); | |
const chunkSize = 1024 * 1024; // 1MB chunks | |
const chunks = []; | |
let offset = 0; | |
while (offset < arrayBuffer.byteLength) { | |
const size = Math.min(chunkSize, arrayBuffer.byteLength - offset); | |
const chunk = arrayBuffer.slice(offset, offset + size); | |
chunks.push(chunk); | |
offset += size; |
This file contains hidden or 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
import './App.css' | |
import { Controls } from './components/Controls' | |
import { Lights } from './components/Lights' | |
import { Score } from './components/Score' | |
import { useGame } from './hooks/useGame' | |
function App() { | |
const { | |
blinkSeq, | |
isBlinking, |
This file contains hidden or 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
import { Colors } from "./colors"; | |
import styles from "./JSExports.module.scss"; | |
export const JSExports = () => { | |
return ( | |
<div> | |
<p> | |
Used scss and css and JS to access these colors, kinda complicated but | |
useful AF |
This file contains hidden or 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
import variables from "./JSExports.module.scss"; | |
export const Colors = variables; |
This file contains hidden or 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
@import './variables'; | |
$primary-color: var(--primary-color); | |
$secondary-color: var(--secondary-color); | |
.boxes { | |
display: flex; | |
justify-content: space-around; | |
&__box { |
NewerOlder