vod普通加密
This commit is contained in:
@@ -12,13 +12,24 @@ import com.aliyuncs.http.MethodType;
|
|||||||
import com.aliyuncs.profile.IClientProfile;
|
import com.aliyuncs.profile.IClientProfile;
|
||||||
import com.aliyuncs.sts.model.v20150401.AssumeRoleRequest;
|
import com.aliyuncs.sts.model.v20150401.AssumeRoleRequest;
|
||||||
import com.aliyuncs.sts.model.v20150401.AssumeRoleResponse;
|
import com.aliyuncs.sts.model.v20150401.AssumeRoleResponse;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.peanut.modules.common.dao.VideoM3u8Dao;
|
||||||
|
import com.peanut.modules.common.entity.VideoM3u8Entity;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
//import org.bytedeco.javacv.FFmpegFrameGrabber;
|
//import org.bytedeco.javacv.FFmpegFrameGrabber;
|
||||||
//import org.bytedeco.javacv.FrameGrabber;
|
//import org.bytedeco.javacv.FrameGrabber;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Component
|
||||||
public class SpdbUtil {
|
public class SpdbUtil {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private static VideoM3u8Dao videoM3u8Dao;
|
||||||
|
|
||||||
private static Client client;
|
private static Client client;
|
||||||
static {
|
static {
|
||||||
com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
|
com.aliyun.teaopenapi.models.Config config = new com.aliyun.teaopenapi.models.Config()
|
||||||
@@ -33,7 +44,6 @@ public class SpdbUtil {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// private static String accessKeyId = "LTAI5tMKmWhPfnPsz2J3bfxL";
|
// private static String accessKeyId = "LTAI5tMKmWhPfnPsz2J3bfxL";
|
||||||
// private static String accessKeySecret = "doFUplbiIxL6PgJME3eSaW8G6HauuC";
|
// private static String accessKeySecret = "doFUplbiIxL6PgJME3eSaW8G6HauuC";
|
||||||
@@ -151,6 +161,23 @@ public class SpdbUtil {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void vodTranslationM3u8(String vid) throws Exception {
|
||||||
|
List<VideoM3u8Entity> videoM3u8Entities = videoM3u8Dao.selectList(new LambdaQueryWrapper<VideoM3u8Entity>().eq(VideoM3u8Entity::getVid, vid));
|
||||||
|
if(videoM3u8Entities.size()>0){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
GenerateKMSDataKeyResponseBody kms = KMS();
|
||||||
|
VideoM3u8Entity videoM3u8Entity = new VideoM3u8Entity();
|
||||||
|
assert kms != null;
|
||||||
|
videoM3u8Entity.setEdk(kms.getCiphertextBlob());
|
||||||
|
videoM3u8Entity.setVid(vid);
|
||||||
|
videoM3u8Dao.insert(videoM3u8Entity);
|
||||||
|
startM3u8(vid,kms.getCiphertextBlob());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static void startM3u8(String vid,String edk){
|
public static void startM3u8(String vid,String edk){
|
||||||
com.aliyun.vod20170321.models.SubmitTranscodeJobsRequest submitTranscodeJobsRequest = new com.aliyun.vod20170321.models.SubmitTranscodeJobsRequest();
|
com.aliyun.vod20170321.models.SubmitTranscodeJobsRequest submitTranscodeJobsRequest = new com.aliyun.vod20170321.models.SubmitTranscodeJobsRequest();
|
||||||
submitTranscodeJobsRequest.setVideoId(vid);
|
submitTranscodeJobsRequest.setVideoId(vid);
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.apache.commons.codec.binary.Base64;
|
import org.apache.commons.codec.binary.Base64;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/sys/vodAli")
|
@RequestMapping("/sys/vodAli")
|
||||||
@@ -36,5 +38,11 @@ public class VodAliController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/uploadCallback")
|
||||||
|
public void uploadCallback(@RequestBody Map<String,Object> map) throws Exception {
|
||||||
|
String vid = String.valueOf(map.get("VideoId"));
|
||||||
|
SpdbUtil.vodTranslationM3u8(vid);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user