package com.tuoheng.miniprogram.controller;

import com.aliyuncs.vod.model.v20170321.CreateUploadVideoResponse;
import com.aliyuncs.vod.model.v20170321.RefreshUploadVideoResponse;
import com.tuoheng.miniprogram.service.IAliyuncsVodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: 吴彬
 * @CreateTime: 2022-08-31  08:35
 * @Description: 阿里云点播服务 前端控制器
 * @Version: 1.0
 */
@RestController
@RequestMapping("/aliyuncsVod/miniprogram")
public class AliyuncsVodController {

    @Autowired
    IAliyuncsVodService aliyuncsVodService;


    /**
     * 获取音视频上传地址和凭证
     *
     * @param title
     * @param fileName
     * @return
     */
    @GetMapping("/createUploadVideo")
    public CreateUploadVideoResponse createUploadVideo(String title, String fileName) {
        return aliyuncsVodService.createUploadVideo(title, fileName);
    }


    /**
     * 刷新音/视频上传凭证
     *
     * @param videoId 音频或视频ID
     * @return
     */
    @GetMapping("/refreshUploadVideo")
    public RefreshUploadVideoResponse refreshUploadVideo(String videoId) {
        return aliyuncsVodService.refreshUploadVideo(videoId);
    }
}
