import { inject , injectable } from 'inversify' ; import * as apid from '../../../../../api' ; import IRepositoryModel from '../IRepositoryModel' ; import IStreamApiModel from './IStreamApiModel' ; @ injectable ( ) export default class StreamApiModel implements IStreamApiModel { private repository : IRepositoryModel ; constructor ( @ inject ( 'IRepositoryModel' ) repository ) { this . repository = repository ; } param isHalfWidth return public async getStreamInfo ( isHalfWidth ) { const result = await this . repository . get ( '/streams' , { params : { isHalfWidth : isHalfWidth , } , } ) ; return result . data ; } param channelId param mode return public async startLiveHLS ( channelId , mode ) { const result = await this . repository . get ( `/streams/live/${ channelId }/hls` , { params : { mode : mode , } , } ) ; return result . data . streamId ; } param videoFileId param ss param mode return public async startRecordedHLS ( videoFileId , ss , mode ) { const result = await this . repository . get ( `/streams/recorded/${ videoFileId }/hls` , { params : { ss : ss , mode : mode , } , } ) ; return result . data . streamId ; } param streamId return public async stop ( streamId ) { await this . repository . delete ( `/streams/${ streamId }` ) ; } return public async stopAll ( ) { await this . repository . delete ( '/streams' ) ; } param streamId return public async keep ( streamId ) { await this . repository . put ( `/streams/${ streamId }/keep` ) ; } }