package cn.com.ctop.track.controller;

import cn.com.ctop.track.service.MediaService;
import com.alibaba.fastjson.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/video")
public class MaterialController {
    @Autowired
    private MediaService mediaService;



    @ResponseBody
    @RequestMapping(value = "/test")
    public void test() throws Exception {
        mediaService.test();


    }


    @ResponseBody
    @RequestMapping(value = "/test2")
    public void test2() throws Exception {
        mediaService.test2();

    }


    @ResponseBody
    @RequestMapping(value = "/test3")
    public void test3() throws Exception {
        mediaService.test3();

    }

    @ResponseBody
    @RequestMapping(value = "/test4")
    public void test4() throws Exception {
        mediaService.test4();

    }


    @ResponseBody
    @RequestMapping(value = "/test5")
    public void test5() throws Exception {
        mediaService.test5();

    }




    @ResponseBody
    @RequestMapping(value = "/upload")
    public void upload() throws Exception {
        mediaService.vodUpload();

    }

    // 视频拼接
    @ResponseBody
    @RequestMapping(value = "/editMedia")
    public void editMedia() throws Exception {

       // mediaService.editMedia();
    }

    // 获取视频合成任务列表

    @ResponseBody
    @RequestMapping(value = "/getTask")
    public void getTask(String taskId) throws Exception {

        mediaService.getTask(taskId);
    }

    // 视频拆条
    @ResponseBody
    @RequestMapping(value = "/splitMedia")
    public void splitMedia(String fileId) throws Exception {
        mediaService.splitMedia(fileId);
    }

    // 视频合成 替换音轨
    @ResponseBody
    @RequestMapping(value = "/composeMedia")
    public void composeMedia(String fileId) throws Exception {
        JSONArray videoArray = new JSONArray();
      //  videoArray.add("387702292666447535");
        videoArray.add("387702292980880553");


        JSONArray AudioArray = new JSONArray();
       // AudioArray.add("387702292668811825");
        AudioArray.add("387702292669379335");

        Integer videoMute = 1;


        mediaService.composeMedia(videoArray, AudioArray, videoMute);
    }


}
