spring boot 實(shí)現(xiàn)阿里云視頻點(diǎn)播功能(刪除視頻)
目錄:
1.spring boot實(shí)現(xiàn)阿里云視頻點(diǎn)播上傳視頻(復(fù)制粘貼即可)
2.spring boot 實(shí)現(xiàn)阿里云視頻點(diǎn)播 --刪除視頻
導(dǎo)包和部分類在spring boot實(shí)現(xiàn)阿里云視頻點(diǎn)播上傳視頻(復(fù)制粘貼即可)博客有說(shuō)明,就不再重復(fù)了。
InitVodCilent
public class InitVodCilent { public static DefaultAcsClient initVodClient(String accessKeyId, String accessKeySecret) throws ClientException { String regionId = 'cn-shanghai'; // 點(diǎn)播服務(wù)接入?yún)^(qū)域 DefaultProfile profile = DefaultProfile.getProfile(regionId, accessKeyId, accessKeySecret); DefaultAcsClient client = new DefaultAcsClient(profile); return client; }}
service
@Override public void removeMoreAlyVideo(List videoIdList) { try { //初始化對(duì)象 DefaultAcsClient client = InitVodCilent.initVodClient(ConstantVodUtils.ACCESS_KEY_ID, ConstantVodUtils.ACCESS_KEY_SECRET); //創(chuàng)建刪除視頻request對(duì)象 DeleteVideoRequest request = new DeleteVideoRequest(); //videoIdList值轉(zhuǎn)換成 1,2,3 String videoIds = StringUtils.join(videoIdList.toArray(), ','); //向request設(shè)置視頻id request.setVideoIds(videoIds); //調(diào)用初始化對(duì)象的方法實(shí)現(xiàn)刪除 client.getAcsResponse(request); }catch(Exception e) { e.printStackTrace(); throw new EduException(20001,'刪除視頻失敗'); } }
controller
//根據(jù)視頻id刪除阿里云視頻 @DeleteMapping('removeAlyVideo/{id}') public R removeAlyVideo(@PathVariable String id) { try { //初始化對(duì)象 DefaultAcsClient client = InitVodCilent.initVodClient(ConstantVodUtils.ACCESS_KEY_ID, ConstantVodUtils.ACCESS_KEY_SECRET); //創(chuàng)建刪除視頻request對(duì)象 DeleteVideoRequest request = new DeleteVideoRequest(); //向request設(shè)置視頻id request.setVideoIds(id); //調(diào)用初始化對(duì)象的方法實(shí)現(xiàn)刪除 client.getAcsResponse(request); return '刪除成功'; }catch(Exception e) { e.printStackTrace(); } } //刪除多個(gè)阿里云視頻的方法 //參數(shù)多個(gè)視頻id List videoIdList @DeleteMapping('delete-batch') public R deleteBatch(@RequestParam('videoIdList') List<String> videoIdList) { vodService.removeMoreAlyVideo(videoIdList); return '刪除成功'; }
到此這篇關(guān)于spring boot 實(shí)現(xiàn)阿里云視頻點(diǎn)播(刪除視頻功能)的文章就介紹到這了,更多相關(guān)spring boot 阿里云視頻點(diǎn)播內(nèi)容請(qǐng)搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!
相關(guān)文章:
1. ASP中解決“對(duì)象關(guān)閉時(shí),不允許操作?!钡脑幃悊?wèn)題……2. xml中的空格之完全解說(shuō)3. html小技巧之td,div標(biāo)簽里內(nèi)容不換行4. XML入門(mén)的常見(jiàn)問(wèn)題(四)5. CSS3中Transition屬性詳解以及示例分享6. ASP中if語(yǔ)句、select 、while循環(huán)的使用方法7. 匹配模式 - XSL教程 - 48. WMLScript的語(yǔ)法基礎(chǔ)9. WML語(yǔ)言的基本情況10. msxml3.dll 錯(cuò)誤 800c0019 系統(tǒng)錯(cuò)誤:-2146697191解決方法
