Skip to content
Open

Ux #25

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions frontend/app/lib/videoStorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,24 @@ export async function clearVideos(): Promise<void> {
});
}

export async function addVideo(video: StoredVideo): Promise<void> {
const db = await openDB();
const transaction = db.transaction(STORE_NAME, "readwrite");
const store = transaction.objectStore(STORE_NAME);
store.put(video);

return new Promise((resolve, reject) => {
transaction.oncomplete = () => {
db.close();
resolve();
};
transaction.onerror = () => {
db.close();
reject(transaction.error);
};
});
}

const THUMBNAIL_WIDTH = 80;
const THUMBNAIL_HEIGHT = 60;

Expand Down
Loading