1、通过视频id异步上传课件,支持ppt、pptx及pdf文件格式
2、接口URL中的{userid}为点播账号userid,具体参考菜单【使用须知】->【获取密钥】
3、接口支持https协议
http://api.polyv.net/v2/video/{userid}/uploadPPT/asyn
http://api.polyv.net/v2/video/1b448be323/uploadPPT/asyn
vid=1b448be3239482977934f099f2ceaa0a_1&format=json&sign=F3BAA6F7687AEBEEDACC70F25A79E65D582D1D09&ptime=1617672685886
private static final Logger log = LoggerFactory.getLogger(VodVideoCourseWare.class);
/**
* 异步上传课件
*/
@Test
public void testUploadCourseWareAsync() 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/uploadPPT/asyn", userid);
String vid = "1b448be32303e4922a8f70d6b48220ae_1";
String format = "json";
String pptFilePath = getClass().getResource("/file/").getPath() + "Courseware.ppt";
File courseware = new File(pptFilePath);
Map<String, String> requestMap = new HashMap<>();
requestMap.put("ptime", ptime);
requestMap.put("vid", vid);
requestMap.put("format", format);
Map<String, File> fileMap = new HashMap<>();
fileMap.put("courseware", courseware);
requestMap.put("sign", VodSignUtil.getSign(requestMap, secretKey));
String response = HttpUtil.postFile(url, requestMap, fileMap, Constant.UTF8);
log.debug("测试异步上传课件,{}", response);
//do somethings
}
{
"code": 200,
"status": "success",
"message": "success",
"data": "ppt上传成功"
}
{
"code":400,
"status":"error",
"message":"sign can not be empty.",
"data":""
}
{
"code":400,
"status":"error",
"message":"ppt文件不能超过50M",
"data":""
}
{
"code":400,
"status":"error",
"message":"文件类型必须为ppt、pptx或pdf",
"data":""
}
{
"code":400,
"status":"error",
"message":"当前vid关联的课件正在转码中,请稍后再试。",
"data":""
}