mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-05-07 18:18:42 -05:00
Brings the TinyTorch lab guide's Quarto project in line with
book/quarto/, the only other in-tree Quarto publication that builds
both web and PDF outputs from a single source. The previous name had
three redundancies:
- already under tinytorch/, so "site-" prefix wasn't disambiguating
- also produces the PDF lab guide, so "site-" was misleading
- the top-level site/ dir made "site-quarto" read as "the site's
quarto config" rather than "the tinytorch site, in quarto"
After this rename the convention is straightforward:
book/quarto/ -> the textbook (web + PDF)
tinytorch/quarto/ -> the TinyTorch lab guide (web + PDF)
mlsysim/docs/ -> mlsysim API reference (kept as docs/, since it
really is API reference, not a publication)
Touches 7 GitHub workflows, both .gitignore files, the rename target's
own self-references (Makefile, _quarto.yml configs, STYLE.md,
measure-pdf-images.py), and 6 copies of subscribe-modal.js plus a few
shared scripts/configs whose comments documented the old path.
Verified: rebuilt pdf/TinyTorch-Guide.pdf (2.1M) cleanly from the new
location with 'make pdf' from tinytorch/quarto/.
30 lines
926 B
JavaScript
30 lines
926 B
JavaScript
import { resizeImage } from './utils.js';
|
|
|
|
let mediaStream = null;
|
|
|
|
export async function startCamera() {
|
|
const cameraVideo = document.getElementById('cameraVideo');
|
|
const cameraContainer = document.getElementById('cameraContainer');
|
|
try {
|
|
mediaStream = await navigator.mediaDevices.getUserMedia({ video: true });
|
|
cameraVideo.srcObject = mediaStream;
|
|
cameraContainer.style.display = 'block';
|
|
} catch (err) {
|
|
console.error("Camera access denied:", err);
|
|
alert("Could not access camera. Please check permissions.");
|
|
}
|
|
}
|
|
|
|
export function stopCamera() {
|
|
const cameraContainer = document.getElementById('cameraContainer');
|
|
if (mediaStream) {
|
|
mediaStream.getTracks().forEach(track => track.stop());
|
|
mediaStream = null;
|
|
}
|
|
cameraContainer.style.display = 'none';
|
|
}
|
|
|
|
export function setupCameraEvents() {
|
|
// Avatar camera events removed
|
|
}
|