import { Context } from "../context/Context"; import { BaseOperation } from "./base/BaseOperation"; import { EOperationStatus } from "./enum/EOperationStatus"; import { EOperationType } from "./enum/EOperationType"; import { IOperation } from "./interface/IOperation"; import { ActionParams } from "../action/type/ActionParams"; export class DisableTracksOperation extends BaseOperation implements IOperation { constructor(context: Context){ super(context); this.type=EOperationType.DISABLE_TRACKS; } /*@overwrite*/ public async handler(params ? : ActionParams) : Promise{ return new Promise( async (resolve, reject)=>{ try { this.context.getDeterminants().setUpdating(true); if(this.context.getResources().getAudioTrack()){ this.context.getResources().getAudioTrack().setEnabled(false); } if(this.context.getResources().getVideoTrack()){ this.context.getResources().getVideoTrack().setEnabled(false); } if(this.context.getResources().getScreeanTrack()){ this.context.getResources().getScreeanTrack().stop(); this.context.getResources().getScreeanTrack().close(); } this.status = EOperationStatus.PERFORMED; } catch (error) { this.addError(error); this.status = EOperationStatus.FAILED; } resolve(this.status); }); } }