日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

腾讯云 视频 点播 视频上传接口

發布時間:2025/3/21 编程问答 19 豆豆
生活随笔 收集整理的這篇文章主要介紹了 腾讯云 视频 点播 视频上传接口 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

?

?

申請騰訊云? 獲取id? 及? key

?

【騰訊云視頻】Web上傳 地址

?

https://cloud.tencent.com/document/product/266/9239

?

Java 簽名示例

?

https://cloud.tencent.com/document/product/266/10638

?

demo

http://video.qcloud.com/sdk/ugcuploader.html?_ga=1.215462160.645636177.1512724448

?

?

?

根據Java 簽名示例獲取相關的簽名? 根據上面簽名案例

var getSignature = function (callback) {
??? $.ajax({
??????? type: "get",
??????? url: "getMyKey",
??????? dataType: "text",
??????? success: function (result) {
??????????? callback(result);
??????? },
??????? error: function (result) {
??????????? alert("失敗");
??????? }
??? });
}

頁面引入相關js

?

<script src="//imgcache.qq.com/open/qcloud/js/vod/sdk/ugcUploader.js" type="text/javascript"></script>

?

<label>
?? ??? ??? ??? ?????? 上傳視頻 :
?? ??? ??? ??? ?</label>
?? ??? ??? ??? ??? <input type="file"? id="videoFile" name="videoFile" required="required" accept=".avi,.3gp,.mpg,.flv,.mp4,.mkv,.wmv,.rmvb" >
?? ??? ??? ??? ?</div>
?? ??? ??? ??? ?<div id="Blenght" class="progress progress-striped" style="display:none;width: 300px;height: 15px;margin-left:45px;margin-bottom: 1px;">
?? ??? ??? ??? ???? <div id="my-bar-success" class="progress-bar progress-bar-success my-bar-success" role="progressbar"
?? ??? ??? ??? ????????? aria-valuenow="60" aria-valuemin="0" aria-valuemax="100"
?? ??? ??? ??? ????????? style="width: 0%;">
?? ??? ??? ??? ???? </div>
?? ??? ??? ??? ???? <div id="countNum" class="len-countNum">
?? ??? ??? ??? ???? <em id="style-em-1" class="em-style"></em><em id="style-em-2" class="em-style"></em></div>
?? ??? ??? ??? ?</div>

?

function saveVideo() {
??? //判斷是否為空
??? //開始上傳視頻文件
??? var videoObj = document.getElementById("videoFile");
??? /*console.log();*/
??? if (videoObj.files.length) {
??????? var resultMsg = qcVideo.ugcUploader.start({
??????????? videoFile: videoObj.files[0],
??????????? getSignature: getSignature,
??????????? success: function (result) {
??????????? },
??????????? error: function (result) {
??????????????? alert('上傳失敗的原因:' + result.msg);
??????????????? $(".div-grop").show();
??????????????? $("#Blenght").css("display", "none");
??????????????? $("#qued").show();
??????????? },
??????????? progress: function (result) {
??????????????? var progressNum = result.shacurr;
??????????????? progressNum = progressNum * 100;
??????????????? $("#my-bar-success").css("width", parseInt(progressNum) + "%");
??????????????? $("#style-em-1").html(parseInt(progressNum) + "%");
??????????? },
??????????? finish: function (result) {
??????????????? if (!result) {
??????????????????? layer.msg('操作異常,請稍后重試!', {time: 2000});
??????????????????? return false;
??????????????? }
??????????????? var id = result.fileId;
??????????????? var path = result.videoUrl;
??????????????? var name = result.videoName;
??????????????? if (id == "" || id == null) {
??????????????????? layer.msg('請先上傳文件!', {time: 2000});
??????????????????? return false;
??????????????? }
??????????????? if (path == "" || path == null) {
??????????????????? layer.msg('請先上傳文件!', {time: 2000});
??????????????????? return false;
??????????????? }
??????????????? if (name == "" || name == null) {
??????????????????? layer.msg('請先上傳文件!', {time: 2000});
??????????????????? return false;
??????????????? }
??????????????? $("#videoId").val(id);
??????????????? $("#videoPath").val(path);
??????????????? $("#videoName").val(name);//
??????????????? $.ajax({
??????????????????? type: "POST",
??????????????????? url: "saveVideo",
??????????????????? data: $('#videoform').serialize(),
??????????????????? dataType: "text",
??????????????????? success: function (result) {

??????????????????? },
??????????????????? error: function (result) {

??????????????????? }
??????????????? });
??????????? }
??????? });
??? } else {
??????? layer.msg('請選擇上傳文件!', {time: 2000});
??? }
}
?
??

?

轉載于:https://www.cnblogs.com/jiahaoJAVA/p/8028325.html

《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀

總結

以上是生活随笔為你收集整理的腾讯云 视频 点播 视频上传接口的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。