1. 腾讯云点播 官网文档入口:
云点播简介_云点播购买指南_云点播操作指南-腾讯云
2. 业务需求
2.1.上传视频
2.2.浏览视频
2.3.删除视频
3. 腾讯云提供服务器上传和客户端上传。我使用springboot后端实现客户端上传视频。
3.1 后端要求 生成签名,前端拿着签名凭证,才能上传视频成功
云点播 签名生成示例-开发指南-文档中心-腾讯云
安装依赖
<!-- 腾讯视频点播VOD --><dependency><groupId>com.tencentcloudapi</groupId><artifactId>tencentcloud-sdk-java</artifactId><version>3.1.2</version></dependency>
vod:# 腾讯云视频点播vodsecretId: secretIdsecretKey: secretKeyvodSubAppId: vodSubAppId#任务流procedure: procedure#播放密钥playKey: playKey#播放器 Web 端基础版 LicenselicenseUrl: licenseUrl
声明签名工具类
package com.xxxx.util;import java.util.Base64;import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.nio.charset.StandardCharsets;/*** 腾讯云视频点播签名工具类*/public class VodSignatureUtil {private String secretId;private String secretKey;private long currentTime;private int random;private int signValidDuration;private String procedure;private long vodSubAppId;/*** 签名算法*/private static final String HMAC_ALGORITHM = "HmacSHA1";private static final String CONTENT_CHARSET = "UTF-8";public static byte[] byteMerger(byte[] byte1, byte[] byte2) {byte[] byte3 = new byte[byte1.length + byte2.length];System.arraycopy(byte1, 0, byte3, 0, byte1.length);System.arraycopy(byte2, 0, byte3, byte1.length, byte2.length);return byte3;}/*** 获取签名* @return strSign* @throws Exception*/public String getUploadSignature() throws Exception {String strSign = "";String contextStr = "";// 生成原始参数字符串long endTime = (currentTime + signValidDuration);contextStr += "secretId=" + java.net.URLEncoder.encode(secretId, "utf8");contextStr +=