import TRTC from "../utils/trtc-wx"; class EduTRTC { static instance = null _SDKInstance = null page = null static getInstance() { if (!EduTRTC.instance) { EduTRTC.instance = new EduTRTC(); } return EduTRTC.instance; } initPage(page) { this.page = page; } getSDK() { if (this._SDKInstance == null) { if (this.page == null) { throw new Error("TRTC未初始化") } let obj = new TRTC(this.page); this._SDKInstance = obj; } return this._SDKInstance; } createPusher(page) { return this.getSDK().createPusher({ beautyLevel: 9, mode: 'live', }).pusherAttributes; } exitRoom(page) { const result = this.getSDK().exitRoom(); page = null; this._SDKInstance = null; return result; } getPlayerList(){ return this.getSDK().getPlayerList() } } export default EduTRTC;