package com.zcloud.util.ali;


import com.alibaba.fastjson.JSON;
import com.aliyun.tea.*;
import com.aliyun.teaopenapi.*;
import com.aliyun.teaopenapi.models.*;
import com.aliyun.vod20170321.*;
import com.aliyun.vod20170321.models.*;
import com.zcloud.entity.PageData;
import com.zcloud.util.Const;
public class AudioOrVideoCreateUpload {

	/**
     * 使用AK&SK初始化账号Client
     * @param accessKeyId
     * @param accessKeySecret
     * @return Client
     * @throws Exception
     */
    public static com.aliyun.vod20170321.Client createClient() throws Exception {
        Config config = new Config()
                // 您的AccessKey ID
                .setAccessKeyId(Const.ALI_ACCESSKEY)
                // 您的AccessKey Secret
                .setAccessKeySecret(Const.ALI_ACCESSKEY_SECRET);
        // 访问的域名
        config.endpoint = Const.ENDPOINT;
        return new com.aliyun.vod20170321.Client(config);
    }
    public static GetVideoPlayAuthResponse getVideoPlayAuth(PageData pd) throws Exception {
    	  com.aliyun.vod20170321.Client client = createClient();
		  GetVideoPlayAuthRequest getVideoPlayAuthRequest = new GetVideoPlayAuthRequest();
			getVideoPlayAuthRequest.videoId = pd.getString("videoId");
			//getVideoPlayAuthRequest.authInfoTimeout = 3000l;
		    // 复制代码运行请自行打印 API 的返回值
		  return  client.getVideoPlayAuth(getVideoPlayAuthRequest);
	}
    public static void main(String[] args_) throws Exception {
    	PageData pd = new PageData();
    	pd.put("videoId", "6a892c4fd47e46e7bec8fea6d3ed813f");
    	GetVideoPlayAuthResponse response = getVideoPlayAuth(pd);
    	System.out.println(JSON.toJSON(response));
//        java.util.List<String> args = java.util.Arrays.asList(args_);
//        com.aliyun.vod20170321.Client client = createClient();
//        //RefreshUploadVideoRequest request = new RefreshUploadVideoRequest().setVideoId("2fc8ac0a565948d295c9036904730575");
//        CreateUploadVideoRequest createUploadVideoRequest = new CreateUploadVideoRequest()
//                .setFileName("filename.mp4")
//                .setTitle("this is a sample");
////         复制代码运行请自行打印 API 的返回值
////        client.refreshUploadVideo(request)
//        CreateUploadVideoResponse  resp=  client.createUploadVideo(createUploadVideoRequest);
//      //  RefreshUploadVideoResponse resp=client.refreshUploadVideo(request);
//        com.aliyun.teaconsole.Client.log(com.aliyun.teautil.Common.toJSONString(TeaModel.buildMap(resp)));
    }
}
