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ù)制粘貼即可)博客有說明,就不再重復(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 { //初始化對象 DefaultAcsClient client = InitVodCilent.initVodClient(ConstantVodUtils.ACCESS_KEY_ID, ConstantVodUtils.ACCESS_KEY_SECRET); //創(chuàng)建刪除視頻request對象 DeleteVideoRequest request = new DeleteVideoRequest(); //videoIdList值轉(zhuǎn)換成 1,2,3 String videoIds = StringUtils.join(videoIdList.toArray(), ','); //向request設(shè)置視頻id request.setVideoIds(videoIds); //調(diào)用初始化對象的方法實(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 { //初始化對象 DefaultAcsClient client = InitVodCilent.initVodClient(ConstantVodUtils.ACCESS_KEY_ID, ConstantVodUtils.ACCESS_KEY_SECRET); //創(chuàng)建刪除視頻request對象 DeleteVideoRequest request = new DeleteVideoRequest(); //向request設(shè)置視頻id request.setVideoIds(id); //調(diào)用初始化對象的方法實(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)容請搜索好吧啦網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持好吧啦網(wǎng)!
相關(guān)文章:
1. CSS hack用法案例詳解2. 利用promise及參數(shù)解構(gòu)封裝ajax請求的方法3. JSP數(shù)據(jù)交互實(shí)現(xiàn)過程解析4. asp(vbs)Rs.Open和Conn.Execute的詳解和區(qū)別及&H0001的說明5. ASP 信息提示函數(shù)并作返回或者轉(zhuǎn)向6. Ajax實(shí)現(xiàn)表格中信息不刷新頁面進(jìn)行更新數(shù)據(jù)7. PHP設(shè)計(jì)模式中工廠模式深入詳解8. 解決AJAX返回狀態(tài)200沒有調(diào)用success的問題9. .NET中l(wèi)ambda表達(dá)式合并問題及解決方法10. ThinkPHP5實(shí)現(xiàn)JWT Token認(rèn)證的過程(親測可用)
