package com.gc.easy.flv.controller;

import com.gc.easy.flv.config.FlvConfig;
import me.zhengjie.annotation.rest.AnonymousGetMapping;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;

import java.io.UnsupportedEncodingException;

/**
 * FLV流转换
 *
 * @author gc.x
 */
@Controller
public class FLVPlayController {
	@Autowired
	private FlvConfig flvConfig;

	@AnonymousGetMapping(value = "/api/front/flv/hls/stream")
	public String getAppHtml1(String url, Model model) throws UnsupportedEncodingException {
		String decodedUrl = java.net.URLDecoder.decode(url, "UTF-8");
		String videoPath="/api/front/flv/get/stream?url="+decodedUrl;
		model.addAttribute("videoPath", videoPath);
		model.addAttribute("wight", flvConfig.getWight());
		model.addAttribute("height", flvConfig.getHeight());
		return "video";
	}
}
