import { Operation } from 'express-openapi' ; import IVideoApiModel from '../../../../api/video/IVideoApiModel' ; import container from '../../../../ModelContainer' ; import * as api from '../../../api' ; export const get = async ( req , res ) => { const videoFileApiModel = container . get < IVideoApiModel > ( 'IVideoApiModel' ) ; try { if ( typeof req . headers . host === 'undefined' ) { throw new Error ( 'HostIsUndefined' ) ; } const playlist = await videoFileApiModel . getM3u8 ( req . headers . host , api . isSecureProtocol ( req ) , parseInt ( req . params . videoFileId , 10 ) ) ; if ( playlist === null ) { api . responseError ( res , { code : 404 , message : 'play list is not found' , } ) ; } else { api . responsePlayList ( req , res , playlist ) ; } } catch ( err ) { api . responseServerError ( res , err . message ) ; } } ; get . apiDoc = { summary : 'ビデオプレイリスト' , tags : [ 'videos' ] , description : 'ビデオプレイリストを取得する' , parameters : [ { $ref : '#/components/parameters/PathVideoFileId' , } , ] , responses : { 200 : { description : 'ビデオプレイリストを取得しました' , content : { 'application/x-mpegURL' : { } , } , } , default : { description : '予期しないエラー' , content : { 'application/json' : { schema : { $ref : '#/components/schemas/Error' , } , } , } , } , } , } ;