1、通过视频id设置单个视频的打点信息
2、接口URL中的{userid}为点播账号userid,具体参考菜单【使用须知】->【获取密钥】
3、接口仅userid、ptime、vid参与签名,其他参数不参与签名
4、接口支持https协议
http://api.polyv.net/v2/video/{userid}/saveKeyFrame
http://api.polyv.net/v2/video/1b448be323/saveKeyFrame
vid=1b448be323a6a1a6c0c237856f555e88_1&seconds=10,20&btnsettingswitch=Y&btnhref=https://baidu.com&sign=D4F867827C100835254100FF147B1095DA29BB72&btndesc=测试打点按钮&userid=1b448be323&ptime=1617258980678&desc=测试打点10s,测试打点20s
强烈建议您使用点播Java SDK完成API的功能对接,点播Java SDK 对API调用逻辑、异常处理、数据签名、HTTP请求线程池进行了统一封装和优化。
private static final Logger log = LoggerFactory.getLogger(VodChapterMakerTest.class);
/**
* 设置打点信息
* @throws Exception
* @throws NoSuchAlgorithmException
*/
@Test
public void testAddChapterMarker() 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/%s/saveKeyFrame", userId);
String vid = "1b448be323a6a1a6c0c237856f555e88_1";
String desc = "测试打点10s,测试打点20s";
String seconds = "10,20";
String btnsettingswitch = "Y";
String btndesc = "测试打点按钮";
String btnhref = "https://baidu.com";
Map<String, String> requestMap = new HashMap<>();
requestMap.put("userid", userId);
requestMap.put("ptime", ptime);
requestMap.put("vid", vid);
requestMap.put("desc", desc);
requestMap.put("seconds", seconds);
requestMap.put("btnsettingswitch", btnsettingswitch);
requestMap.put("btndesc", btndesc);
requestMap.put("btnhref", btnhref);
//系统只部分参数进行签名
Map<String, String> signMap = new HashMap<>();
signMap.put("userid", userId);
signMap.put("ptime", ptime);
signMap.put("vid", vid);
requestMap.put("sign", VodSignUtil.getSign(signMap, secretKey));
String response = HttpUtil.postFormBody(url, requestMap);
log.debug("测试设置打点信息,{}", response);
//do somethings
}
{
"code": 200,
"status": "success",
"message": "success",
"data": "the key frame add successfully"
}
{
"code": 400,
"status": "error",
"message": "the sign is not right.",
"data": ""
}