<dependency><groupId>com.qcloud</groupId><artifactId>vod_api</artifactId><version>2.1.4</version></dependency>
jar 文件 | 说明 |
vod_api-2.1.4.jar | 云点播 SDK。 |
jackson-annotations-2.9.0.jar,jackson-core-2.9.7.jar,jackson-databind-2.9.7.jar,gson-2.2.4.jar | 开源的 JSON 相关库。 |
cos_api-5.4.10.jar | 腾讯云对象存储服务 COS SDK。 |
tencentcloud-sdk-java-3.1.2.jar | 腾讯云 API SDK。 |
commons-codec-1.10.jar,commons-logging-1.2.jar,log4j-1.2.17.jar,slf4j-api-1.7.21.jar,slf4j-log4j12-1.7.21.jar | 开源日志相关库。 |
httpclient-4.5.3.jar,httpcore-4.4.6.jar,okhttp-2.5.0.jar,okio-1.6.0.jar | 开源的 HTTP 处理库。 |
joda-time-2.9.9.jar | 开源时间处理库。 |
jaxb-api-2.3.0.jar | 开源 XML 处理库。 |
bcprov-jdk15on-1.59.jar | 开源加密处理库。 |
VodUploadClient client = new VodUploadClient("your secretId", "your secretKey");
VodUploadRequest request = new VodUploadRequest();request.setMediaFilePath("/data/videos/Wildlife.wmv");
try {VodUploadResponse response = client.upload("ap-guangzhou", request);logger.info("Upload FileId = {}", response.getFileId());} catch (Exception e) {// 业务方进行异常处理logger.error("Upload Err", e);}
VodUploadClient client = new VodUploadClient("your secretId", "your secretKey");VodUploadRequest request = new VodUploadRequest();request.setMediaFilePath("/data/videos/Wildlife.wmv");request.setCoverFilePath("/data/videos/Wildlife.jpg");try {VodUploadResponse response = client.upload("ap-guangzhou", request);logger.info("Upload FileId = {}", response.getFileId());} catch (Exception e) {// 业务方进行异常处理logger.error("Upload Err", e);}
VodUploadClient client = new VodUploadClient("your secretId", "your secretKey");VodUploadRequest request = new VodUploadRequest();request.setMediaFilePath("/data/videos/Wildlife.wmv");request.setProcedure("Your Procedure Name");try {VodUploadResponse response = client.upload("ap-guangzhou", request);logger.info("Upload FileId = {}", response.getFileId());} catch (Exception e) {// 业务方进行异常处理logger.error("Upload Err", e);}
VodUploadClient client = new VodUploadClient("your secretId", "your secretKey");VodUploadRequest request = new VodUploadRequest();request.setMediaFilePath("/data/videos/Wildlife.wmv");request.setSubAppId(101);try {VodUploadResponse response = client.upload("ap-guangzhou", request);logger.info("Upload FileId = {}", response.getFileId());} catch (Exception e) {// 业务方进行异常处理logger.error("Upload Err", e);}
VodUploadClient client = new VodUploadClient("your secretId", "your secretKey");VodUploadRequest request = new VodUploadRequest();request.setMediaFilePath("/data/videos/Wildlife.wmv");request.setStorageRegion("ap-chongqing");try {VodUploadResponse response = client.upload("ap-guangzhou", request);logger.info("Upload FileId = {}", response.getFileId());} catch (Exception e) {// 业务方进行异常处理logger.error("Upload Err", e);}
ConcurrentUploadNumber
参数进行指定。VodUploadClient client = new VodUploadClient("your secretId", "your secretKey");VodUploadRequest request = new VodUploadRequest();request.setMediaFilePath("/data/videos/Wildlife.wmv");request.setConcurrentUploadNumber(5);try {VodUploadResponse response = client.upload("ap-guangzhou", request);logger.info("Upload FileId = {}", response.getFileId());} catch (Exception e) {// 业务方进行异常处理logger.error("Upload Err", e);}
VodUploadClient client = new VodUploadClient("Credentials TmpSecretId", "Credentials TmpSecretKey", "Credentials Token");VodUploadRequest request = new VodUploadRequest();request.setMediaFilePath("/data/videos/Wildlife.wmv");try {VodUploadResponse response = client.upload("ap-guangzhou", request);logger.info("Upload FileId = {}", response.getFileId());} catch (Exception e) {// 业务方进行异常处理logger.error("Upload Err", e);}
VodUploadClient client = new VodUploadClient("your secretId", "your secretKey");VodUploadRequest request = new VodUploadRequest();request.setMediaFilePath("/data/videos/Wildlife.wmv");HttpProfile httpProfile = new HttpProfile();httpProfile.setProxyHost("your proxy ip");httpProfile.setProxyPort(8080); //your proxy portclient.setHttpProfile(httpProfile);try {VodUploadResponse response = client.upload("ap-guangzhou", request);logger.info("Upload FileId = {}", response.getFileId());} catch (Exception e) {// 业务方进行异常处理logger.error("Upload Err", e);}
../
)。在调用 SDK 上传接口时,MediaFilePath
参数填写 manifest 路径,SDK 会解析出相关的媒体文件列表一并上传。VodUploadClient client = new VodUploadClient("your secretId", "your secretKey");VodUploadRequest request = new VodUploadRequest();request.setMediaFilePath("/data/videos/prog_index.m3u8");try {VodUploadResponse response = client.upload("ap-guangzhou", request);logger.info("Upload FileId = {}", response.getFileId());} catch (Exception e) {// 业务方进行异常处理logger.error("Upload Err", e);}
VodUploadClient
属性名称 | 属性描述 | 类型 | 必填 |
secretId | 云 API 密钥 ID。 | String | 是 |
secretKey | 云 API 密钥 Key。 | String | 是 |
VodUploadRequest
属性名称 | 属性描述 | 类型 | 必填 |
MediaFilePath | 待上传的媒体文件路径。必须为本地路径,不支持 URL。 | String | 是 |
SubAppId | Integer | 否 | |
MediaType | String | 否 | |
MediaName | 上传后的媒体名称,若不填默认采用 MediaFilePath 的文件名。 | String | 否 |
CoverFilePath | 待上传的封面文件路径。必须为本地路径,不支持 URL。 | String | 否 |
CoverType | String | 否 | |
Procedure | String | 否 | |
ExpireTime | String | 否 | |
ClassId | Integer | 否 | |
SourceContext | 来源上下文,用于透传用户请求信息,上传回调接口将返回该字段值,最长250个字符。 | String | 否 |
StorageRegion | String | 否 | |
ConcurrentUploadNumber | 分片并发数,针对大文件分片时有效。 | Integer | 否 |
VodUploadResponse
属性名称 | 属性描述 | 类型 |
FileId | 媒体文件的唯一标识。 | String |
MediaUrl | 媒体播放地址。 | String |
CoverUrl | 媒体封面地址。 | String |
RequestId | 唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId。 | String |
VodUploadClient.upload(String region, VodUploadRequest request)
参数名称 | 参数描述 | 类型 | 必填 |
region | String | 是 | |
request | 上传请求。 | VodUploadRequest | 是 |
状态码 | 含义 |
InternalError | 内部错误。 |
InvalidParameter.ExpireTime | 参数值错误:过期时间。 |
InvalidParameterValue.CoverType | 参数值错误:封面类型。 |
InvalidParameterValue.MediaType | 参数值错误:媒体类型。 |
InvalidParameterValue.SubAppId | 参数值错误:子应用 ID。 |
InvalidParameterValue.VodSessionKey | 参数值错误:点播会话。 |
ResourceNotFound | 资源不存在。 |
本页内容是否解决了您的问题?