private static final Logger log = LoggerFactory.getLogger(VodSnapshotTest.class);
/**
* 指定视频时间点截图
* @throws Exception
* @throws NoSuchAlgorithmException
*/
@Test
public void testAddSnapshotTask() throws Exception, NoSuchAlgorithmException {
//公共参数,填写自己的实际参数
String secretKey = super.secretKey;
String userId = super.userId;
String ptime = String.valueOf(System.currentTimeMillis());
//业务参数
String url = String.format("http://api.polyv.net/v2/video/snapshot/%s/addTask", userId);
String vid = "1b448be32303e4922a8f70d6b48220ae_1";
String offsetTimes = "5,10,15,20";
String width = "300";
String height = "300";
String callbackUrl = "http://example.polyv.net/snapshot-callback.do";
Map<String, String> requestMap = new HashMap<>();
requestMap.put("userId", userId);
requestMap.put("ptime", ptime);
requestMap.put("vid", vid);
requestMap.put("offsetTimes", offsetTimes);
requestMap.put("width", width);
requestMap.put("height", height);
requestMap.put("callbackUrl", callbackUrl);
requestMap.put("sign", VodSignUtil.getSign(requestMap, secretKey));
String response = HttpUtil.postFormBody(url, requestMap);
log.debug("测试指定视频时间点截图,{}", response);
//do somethings
}