tencent.jquery.pix.component 1.0.80 → 1.0.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -17,7 +17,7 @@ import VideoHTML from "./videohtml";
|
|
|
17
17
|
* @param {string} [options.videoUrl] 视频地址,非腾讯视频时使用,比如上传到cos的视频
|
|
18
18
|
* @param {string} [options.previewUrl] 视频预览图
|
|
19
19
|
* @param {string} [options.timeUnit] 视频的时间单位 默认是s秒 ,如果是ms,则传1000
|
|
20
|
-
* @param {0|1} [options.videoType=1]
|
|
20
|
+
* @param {0|1|2|3|4|5|6|7} [options.videoType=1] 视频清晰度索引,参考 videoTypeMap(0: 标清 ~ 7: 臻彩Max)
|
|
21
21
|
* @param {number} [options.autoHideControlsDelayMs=5000] 自动隐藏控制条延迟时间,单位ms
|
|
22
22
|
* @param {boolean} [options.showProgressBar=true] 是否显示进度条
|
|
23
23
|
* @param {boolean} [options.showVolumeControl=false] 是否显示音量控制
|
|
@@ -762,14 +762,25 @@ VideoPlayer.prototype.remove = function () {
|
|
|
762
762
|
this.$container.empty();
|
|
763
763
|
}
|
|
764
764
|
|
|
765
|
+
const videoTypeMap = {
|
|
766
|
+
0: 'sd',
|
|
767
|
+
1: 'hd',
|
|
768
|
+
2: 'shd',
|
|
769
|
+
3: 'fhd',
|
|
770
|
+
4: 'uhd',
|
|
771
|
+
5: 'hdr10',
|
|
772
|
+
6: 'dolby',
|
|
773
|
+
7: 'suhd',
|
|
774
|
+
};
|
|
775
|
+
|
|
765
776
|
/**
|
|
766
777
|
* 获取视频真实地址
|
|
767
778
|
* @param {string} vid 腾讯视频vid
|
|
768
|
-
* @param {0|1} [type]
|
|
779
|
+
* @param {0|1|2|3|4|5|6|7} [type=1] 清晰度索引,参考 videoTypeMap
|
|
769
780
|
* @returns {Promise<string>} 真实视频地址
|
|
770
781
|
*/
|
|
771
782
|
const getVideoURL = async function (vid, type = 1) {
|
|
772
|
-
const sApiUrl = `https://vv.video.qq.com/getinfo?vid=${vid}&platform=101001&charge=0&otype=json&t=${Date.now()}`;
|
|
783
|
+
const sApiUrl = `https://vv.video.qq.com/getinfo?vid=${vid}&platform=101001&charge=0&otype=json&t=${Date.now()}&defn=${videoTypeMap[type] ?? videoTypeMap[0]}`;
|
|
773
784
|
|
|
774
785
|
try {
|
|
775
786
|
|
|
@@ -778,7 +789,7 @@ const getVideoURL = async function (vid, type = 1) {
|
|
|
778
789
|
const processedStr = res.replace('QZOutputJson=', '');
|
|
779
790
|
const jsonStr = processedStr.substring(0, processedStr.length - 1);
|
|
780
791
|
const resObj = JSON.parse(jsonStr);
|
|
781
|
-
const sRealUrl = `${resObj.vl.vi[0].ul.ui[
|
|
792
|
+
const sRealUrl = `${resObj.vl.vi[0].ul.ui[0].url}${resObj.vl.vi[0].fn}?vkey=${resObj.vl.vi[0].fvkey}`;
|
|
782
793
|
|
|
783
794
|
return sRealUrl;
|
|
784
795
|
} catch (err) {
|