UNPKG

agora-edu-core

Version:

Core APIs for building an online classroom

119 lines (117 loc) 3.58 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.RecordingStore = void 0; var _base = require("../base"); var _ = require("../../../.."); var _error = require("../../../../utils/error"); var _agoraRteSdk = require("agora-rte-sdk"); var _class; function _applyDecoratedDescriptor(i, e, r, n, l) { var a = {}; return Object.keys(n).forEach(function (i) { a[i] = n[i]; }), a.enumerable = !!a.enumerable, a.configurable = !!a.configurable, ("value" in a || a.initializer) && (a.writable = !0), a = r.slice().reverse().reduce(function (r, n) { return n(i, e, r) || r; }, a), l && void 0 !== a.initializer && (a.value = a.initializer ? a.initializer.call(l) : void 0, a.initializer = void 0), void 0 === a.initializer ? (Object.defineProperty(i, e, a), null) : a; } /** * `RecordingStore` 类提供录制相关能力。 */ /** @en * The `RecordingStore` class provides recording-related abilities. */ let RecordingStore = exports.RecordingStore = (_class = class RecordingStore extends _base.EduStoreBase { /** * 开始录制 * @returns **/ /** @en * Starts recording * @returns */ async startRecording(recordArgs) { try { const { sessionInfo } = _.EduClassroomConfig.shared; await this.classroomStore.api.updateRecordingState({ roomUuid: sessionInfo.roomUuid, state: 1, args: recordArgs, backupCount: 0 }); } catch (error) { return _error.EduErrorCenter.shared.handleThrowableError(_error.AGEduErrorCode.EDU_ERR_START_RECORDING_FAIL, error); } } /** * 停止录制 * @returns **/ /** @en * Stops recording * @returns */ async stopRecording() { try { const { sessionInfo } = _.EduClassroomConfig.shared; await this.classroomStore.api.updateRecordingState({ roomUuid: sessionInfo.roomUuid, state: 0 }); } catch (error) { return _error.EduErrorCenter.shared.handleThrowableError(_error.AGEduErrorCode.EDU_ERR_STOP_RECORDING_FAIL, error); } } /** * 暂停录制 * @returns **/ /** @en * Stops recording * @returns */ async pauseRecording() { try { const { sessionInfo } = _.EduClassroomConfig.shared; await this.classroomStore.api.updateRecordingStateOngoing({ roomUuid: sessionInfo.roomUuid, opts: { onHold: true } }); } catch (error) { return _error.EduErrorCenter.shared.handleThrowableError(_error.AGEduErrorCode.EDU_ERR_STOP_RECORDING_FAIL, error); } } /** * 恢复录制 * @returns **/ /** @en * Stops recording * @returns */ async resumeRecording() { try { const { sessionInfo } = _.EduClassroomConfig.shared; await this.classroomStore.api.updateRecordingStateOngoing({ roomUuid: sessionInfo.roomUuid, opts: { onHold: false } }); } catch (error) { return _error.EduErrorCenter.shared.handleThrowableError(_error.AGEduErrorCode.EDU_ERR_STOP_RECORDING_FAIL, error); } } onInstall() {} /** * @internal */ /** @en * @internal */ onDestroy() {} }, _applyDecoratedDescriptor(_class.prototype, "pauseRecording", [_agoraRteSdk.bound], Object.getOwnPropertyDescriptor(_class.prototype, "pauseRecording"), _class.prototype), _applyDecoratedDescriptor(_class.prototype, "resumeRecording", [_agoraRteSdk.bound], Object.getOwnPropertyDescriptor(_class.prototype, "resumeRecording"), _class.prototype), _class);