import { Media } from "../media/media" ; import { SFU } from "./sfu" ; export class SFUManager { sfu : { [ mediaId ] : SFU ; } = { } ; getSFU ( mediaId ) { return this . sfu [ mediaId ] ; } createSFU ( media ) { return ( this . sfu [ media . mediaId ] = new SFU ( media , ( ) => this . removeSFU ( media . mediaId ) ) ) ; } leave ( subscriberId ) { Object . values ( this . sfu ) . forEach ( ( sfu ) => sfu . leave ( subscriberId ) ) ; } private removeSFU ( mediaId ) { delete this . sfu [ mediaId ] ; } }