package com.ensign.crm.module.infra.controller.admin.video;

import com.ensign.crm.framework.common.pojo.CommonResult;
import com.ensign.crm.module.infra.service.file.FileService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.security.PermitAll;

/**
 * @Description: 播放minio中视频
 * @Date: 29/11/2024 10:27 am
 * @Created: by ZZSLL
 */

@RestController
@RequestMapping("/infra/video")
@Tag(name = "管理后台 - 视频")
public class VideoController {

    @Autowired
    private FileService fileService;

    @GetMapping("/play")
    @Operation(summary = "播放视频")
    @PermitAll // 仅测试
    public CommonResult<String> play(@RequestParam String bucket, @RequestParam String path) {
        return CommonResult.success(fileService.readAsVideo(bucket, path));
    }
}
