2025-09-18 11:40:12 +08:00
|
|
|
package com.fuyuanshen.app.controller;
|
|
|
|
|
|
2025-10-24 11:22:35 +08:00
|
|
|
import com.fuyuanshen.app.service.AudioProcessService;
|
|
|
|
|
import com.fuyuanshen.app.service.VideoProcessService;
|
2025-09-18 11:40:12 +08:00
|
|
|
import com.fuyuanshen.common.core.domain.R;
|
|
|
|
|
import com.fuyuanshen.common.web.core.BaseController;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import org.springframework.http.MediaType;
|
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
2025-10-24 11:22:35 +08:00
|
|
|
import org.springframework.web.bind.annotation.*;
|
2025-09-18 11:40:12 +08:00
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
2025-10-24 11:22:35 +08:00
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.util.Base64;
|
2025-09-18 11:40:12 +08:00
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
/**
|
2025-10-24 11:22:35 +08:00
|
|
|
* APP 视频处理控制器
|
2025-09-18 11:40:12 +08:00
|
|
|
*/
|
|
|
|
|
@Validated
|
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping("/app/video")
|
|
|
|
|
public class AppVideoController extends BaseController {
|
|
|
|
|
|
2025-10-24 11:22:35 +08:00
|
|
|
private final VideoProcessService videoProcessService;
|
|
|
|
|
private final AudioProcessService audioProcessService;
|
2025-09-18 11:40:12 +08:00
|
|
|
|
2025-10-24 11:22:35 +08:00
|
|
|
@PostMapping(value = "/upload", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
|
|
|
|
public R<List<String>> uploadVideo(@RequestParam("file") MultipartFile file) {
|
|
|
|
|
return R.ok(videoProcessService.processVideo(file));
|
2025-09-18 11:40:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2025-10-24 11:22:35 +08:00
|
|
|
* 上传音频文件并转码
|
2025-09-18 11:40:12 +08:00
|
|
|
*/
|
2025-10-24 11:22:35 +08:00
|
|
|
@PostMapping(value = "/audio", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
|
|
|
|
|
public R<List<String>> uploadAudio(@RequestParam("file") MultipartFile file) {
|
|
|
|
|
return R.ok(audioProcessService.processAudio(file));
|
2025-09-18 11:40:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
2025-10-24 11:22:35 +08:00
|
|
|
* 文字转音频TTS服务
|
2025-09-18 11:40:12 +08:00
|
|
|
*/
|
2025-10-24 11:22:35 +08:00
|
|
|
@GetMapping("/audioTTS")
|
|
|
|
|
public R<List<String>> uploadAudioTTS(@RequestParam String text) throws IOException {
|
|
|
|
|
return R.ok(audioProcessService.generateStandardPcmData(text));
|
2025-09-18 11:40:12 +08:00
|
|
|
}
|
|
|
|
|
}
|