首页 >> 中医药浴

SpringBoot手把手教你整合阿里云付费电视

发布时间:2025年09月08日 12:19

e public void afterPropertiesSet() throws Exception { ACCESS_KEY_ID = keyId; ACCESS_KEY_SECRET = keySecret; }}

2.4 给予影片放映定址

首不须手动不须在流媒体操作者MySpace一个影片用于测试者:

迭代:

创建人加载普通人创建人给予影片定址request和response向request普通人全都新设影片id用加载普通人全都的方式getAcsResponse,传播request,给予多达据库打印接收者

预定义如下:

//给予影片放映定址private static void getPlayUrl() throws ClientException { //1.创建人加载普通人 DefaultAcsClient client = InitObject.initVodClient(ConstantVodUtils.ACCESS_KEY_ID,ConstantVodUtils.ACCESS_KEY_SECRET); //2.创建人给予影片定址request和response GetPlayInfoRequest request = new GetPlayInfoRequest(); GetPlayInfoResponse response = new GetPlayInfoResponse(); //3.向request普通人全都新设影片id request.setVideoId("ffe90bfaxxx94d0d722caad"); //4.codice_加载普通人全都的方式,传播request,给予多达据库 response = client.getAcsResponse(request); List playInfoList = response.getPlayInfoList(); //放映定址 for (GetPlayInfoResponse.PlayInfo playInfo : playInfoList) { System.out.print("PlayInfo.PlayURL = " + playInfo.getPlayURL() + ""); } //Base接收者 System.out.print("VideoBase.Title = " + response.getVideoBase().getTitle() + "");}

测试者事与愿违:

2.5 给予影片放映票据

迭代与给予影片放映定址差不多,区别是给予request和response手段不同:

//给予影片放映票据private static void getPlayAuth() throws ClientException { //1.创建人加载普通人 DefaultAcsClient client = InitObject.initVodClient(ConstantVodUtils.ACCESS_KEY_ID,ConstantVodUtils.ACCESS_KEY_SECRET); //2.创建人给予影片票据的request和response GetVideoPlayAuthRequest request = new GetVideoPlayAuthRequest(); GetVideoPlayAuthResponse response = new GetVideoPlayAuthResponse(); //3.向request新设影片id request.setVideoId("ffe90bfaaadd4xxxx0d722caad"); //4.codice_加载普通人的方式得到票据 response = client.getAcsResponse(request); //放映票据 System.out.println("playauth" + response.getPlayAuth());}

测试者事与愿违:

2.6 MySpace影片到阿里云影片流媒体服务于

可以参考:JavaMySpaceSDK(_detail/53406.html)

所需应运而生仰赖:

com.aliyun aliyun-java-sdk-core 4.5.1 com.aliyun.oss aliyun-sdk-oss 3.10.2 com.aliyun aliyun-java-sdk-vod 2.15.11 com.alibaba fastjson 1.2.28 org.json json 20170516 com.google.code.gson gson 2.8.2

预定义如下:

//MySpace影片到阿里云影片流媒体服务于private static void UploadVideo() { String accessKeyId = ConstantVodUtils.ACCESS_KEY_ID; String accessKeySecret = ConstantVodUtils.ACCESS_KEY_SECRET; //MySpace后影片的标题 String title = "xpp1"; //本地文档MySpace路径 String fileName = "D:/6 - What If I Want to Move Faster.mp4"; UploadVideoRequest request = new UploadVideoRequest(accessKeyId, accessKeySecret, title, fileName); //可指定特罗斯季亚涅齐MySpace时每个特罗斯季亚涅齐的微小,选项为2M字符串 request.setPartSize(2 * 1024 * 1024L); //可指定特罗斯季亚涅齐MySpace时的模版内存多达,选项为1 request.setTaskNum(1); UploadVideoImpl uploader = new UploadVideoImpl(); UploadVideoResponse response = uploader.uploadVideo(request); if (response.isSuccess()) { System.out.print("VideoId=" + response.getVideoId() + ""); } else { /* 如果新设预处理URL无效,不负面影响影片MySpace,可以赶回VideoId同时会赶回出错码。其他情况MySpace惨败时,VideoId为空,此时所需根据赶回出错码分析基本出错原因 */ System.out.print("VideoId=" + response.getVideoId() + ""); System.out.print("ErrorCode=" + response.getCode() + ""); System.out.print("ErrorMessage=" + response.getMessage() + ""); }}

测试者事与愿违:

3.springboot单项之前在实践中

创建人加载类:

/** * @author xppll * @date 2021/12/5 13:57 */public class InitVodCilent { //加载:所需之前叶accessKeyId+accessKeySecret public static DefaultAcsClient initVodClient(String accessKeyId, String accessKeySecret) throws ClientException { String regionId = "cn-shanghai"; // 流媒体服务于并行范围 DefaultProfile profile = DefaultProfile.getProfile(regionId, accessKeyId, accessKeySecret); DefaultAcsClient client = new DefaultAcsClient(profile); return client; }}

3.1 MySpace影片到阿里云

controller层:

@Autowiredprivate VodService vodService;//MySpace影片到阿里云@PostMapping("uploadAlyiVideo")public R uploadAlyVideo(MultipartFile file){ //赶回MySpace影片id String videoId=vodService.uploadVideoAly(file); //将影片`id`赶回给前端 return R.ok().data("videoId",videoId);}

service层:

//MySpace影片到阿里云@Overridepublic String uploadVideoAly(MultipartFile file) { try { //fileName:MySpace文档原始名称 String fileName = file.getOriginalFilename(); //title:MySpace便推断名称(例子:01.mp4=>01) String title = fileName.substring(0, fileName.lastIndexOf(".")); //InputStream:MySpace文档输入流 InputStream inputStream = file.getInputStream(); //获得request UploadStreamRequest request = new UploadStreamRequest(ConstantVodUtils.ACCESS_KEY_ID, ConstantVodUtils.ACCESS_KEY_SECRET, title, fileName, inputStream); UploadVideoImpl uploader = new UploadVideoImpl(); //MySpace获得response UploadStreamResponse response = uploader.uploadStream(request); String videoId = null; if (response.isSuccess()) { //得到影片id videoId = response.getVideoId(); } else { //如果新设预处理URL无效,不负面影响影片MySpace,可以赶回VideoId同时会赶回出错码。其他情况MySpace惨败时,VideoId为空,此时所需根据赶回出错码分析基本出错原因 videoId = response.getVideoId(); } return videoId; } catch (IOException e) { e.printStackTrace(); return null; }}

3.2 根据影片id删去影片

controller层:

//根据影片id删去影片@DeleteMapping("removeAlyVideo/{id}")public R removeAlyVideo(@PathVariable String id){ vodService.deleteAlyVideo(id); return R.ok();}

service层:

//根据影片id删去影片@Overridepublic void deleteAlyVideo(String id) { try { //1.加载普通人 DefaultAcsClient client = InitVodCilent.initVodClient(ConstantVodUtils.ACCESS_KEY_ID, ConstantVodUtils.ACCESS_KEY_SECRET); //2.创建人删去影片的request普通人 DeleteVideoRequest request=new DeleteVideoRequest(); //3.向request新设影片id request.setVideoIds(id); //4.codice_加载普通人的方式解决问题删去 client.getAcsResponse(request); } catch (Exception e) { e.printStackTrace(); throw new GuliException(20001,"删去影片惨败"); }}

先前偏爱的小伙伴,记得三连哦!

全飞秒手术可以用海露玻璃酸钠滴眼液吗
术后吃啥恢复好
眼睛干涩模糊用什么眼药水好
口苦口臭
心律失常
慢性支气管炎咳嗽吃什么药
排行榜
酒渣鼻

上一篇: 极目锐评|王力宏终于道歉,社会更应自省“母职惩罚”

下一篇: 11月开始,3生肖桃花终使,诸事顺利,命中带财,日子红透半边天

友情链接