()
| 80 | |
| 81 | |
| 82 | constructor() { |
| 83 | const allStreamTypes: PseudoStreamType[] = ['camera', 'screenVideo', 'screenAudio', 'microphone', 'allAudio']; |
| 84 | allStreamTypes.forEach(type => this.userSets.set(type, new Set())); |
| 85 | |
| 86 | // A master stream can die without us asking (user hits "Stop sharing", device |
| 87 | // unplugged). Run the normal teardown so our mirrored state, the persistent |
| 88 | // video element and the UI all drop the dead stream; the next agent iteration |
| 89 | // then fails loudly in the pre-processor instead of capturing a frozen frame. |
| 90 | browserStreamCapture.onStreamEnd = (type) => { |
| 91 | Logger.warn("StreamManager", `Master '${type}' stream died externally, tearing down.`); |
| 92 | switch (type) { |
| 93 | case 'display': |
| 94 | case 'screenAudio': |
| 95 | // Browser screen audio lives on the display stream, so both die together. |
| 96 | this.teardownScreenAudioStream(); |
| 97 | this.teardownDisplayStream(); |
| 98 | break; |
| 99 | case 'camera': |
| 100 | this.teardownCameraStream(); |
| 101 | break; |
| 102 | case 'microphone': |
| 103 | this.teardownMicrophoneStream(); |
| 104 | break; |
| 105 | } |
| 106 | }; |
| 107 | } |
| 108 | |
| 109 | // --- Public API --- |
| 110 |
nothing calls this directly
no test coverage detected