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)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
使用java的Calendar對(duì)象獲得當(dāng)前日期
本文給大家分享的是使用使用java的Calendar對(duì)象獲得當(dāng)前日期的上幾個(gè)度開始、結(jié)束時(shí)間,主要思路是先獲得當(dāng)前季度的開始和結(jié)束日期,在當(dāng)前日期的基礎(chǔ)上往前推3個(gè)月即上個(gè)季度的開始和結(jié)束日期,十分的實(shí)用,小伙伴們可以參考下。2015-07-07Servlet實(shí)現(xiàn)簡(jiǎn)單文件上傳功能
這篇文章主要為大家詳細(xì)介紹了Servlet實(shí)現(xiàn)簡(jiǎn)單文件上傳功能,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-10-10如何解決SpringBoot2.x版本對(duì)Velocity模板不支持的方案
這篇文章主要介紹了如何解決SpringBoot2.x版本對(duì)Velocity模板不支持的方案,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過來看看吧2018-12-12Java數(shù)據(jù)結(jié)構(gòu)之散列表詳解
散列表(Hash table,也叫哈希表),是根據(jù)關(guān)鍵碼值(Key value)而直接進(jìn)行訪問的數(shù)據(jù)結(jié)構(gòu)。本文將為大家具體介紹一下散列表的原理及其代碼實(shí)現(xiàn)2022-01-01