Example 1 — Empty Stream Still Has an id
Even a stream with no tracks gets a unique GUID.
const stream = new MediaStream();
console.log(stream.getTracks().length); // 0
console.log(stream.id.length); // 36
console.log(stream.id); // e.g. "…-…-…-…-…" How It Works
- Create an empty stream. No tracks required.
- Browser still assigns an id. Object identity, not track count.
- Length is 36. GUID format (MDN).
- No permissions needed. Safe classroom demo.

