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 { //初始化對(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. jsp實(shí)現(xiàn)textarea中的文字保存換行空格存到數(shù)據(jù)庫(kù)的方法2. ASP實(shí)現(xiàn)加法驗(yàn)證碼3. asp知識(shí)整理筆記4(問答模式)4. 詳解idea中web.xml默認(rèn)版本問題解決5. 解決ajax的delete、put方法接收不到參數(shù)的問題方法6. IntelliJ IDEA 統(tǒng)一設(shè)置編碼為utf-8編碼的實(shí)現(xiàn)7. jsp EL表達(dá)式詳解8. java 優(yōu)雅關(guān)閉線程池的方案9. IntelliJ IDEA 2020最新激活碼(親測(cè)有效,可激活至 2089 年)10. 使用Python爬取Json數(shù)據(jù)的示例代碼
