视频优化

This commit is contained in:
sk1551 2021-01-30 09:11:45 +08:00
parent 41fa6526c0
commit 128fb0dd4f
2 changed files with 9 additions and 13 deletions

View File

@ -20,11 +20,14 @@ export function downLoadZip(str, filename) {
} }
export function downLoadVideoUrl(str) { export function downLoadVideoUrl(str) {
var url = baseUrl + str var url = baseUrl + str
return axios({ axios({
method: 'get', method: 'get',
url: url, url: url,
responseType: 'blob', responseType: 'arraybuffer',
headers: { 'Authorization': 'Bearer ' + getToken() }, headers: { 'Authorization': 'Bearer ' + getToken() },
}).then(res => {
// console.log(res);
return res.data
}) })
} }
@ -37,8 +40,7 @@ export function downLoadUrl(str, item) {
headers: { 'Authorization': 'Bearer ' + getToken() }, headers: { 'Authorization': 'Bearer ' + getToken() },
}).then(res => { }).then(res => {
// console.log(res); // console.log(res);
// downloadFileFun(res.data, item) downloadFileFun(res.data, item)
res.send();
}) })
} }

View File

@ -171,17 +171,11 @@ export default {
return data; return data;
}, },
/** 查询培训列表 */ /** 查询培训列表 */
async getList() { getList() {
this.loading = true; this.loading = true;
let videobuffer="";
await downLoadVideoUrl("/profile/video/lg4y3idmDCEme_eu6FzAAoOdcyS2.mp4").then((res)=>{
videobuffer=res;
console.log(videobuffer);
})
listVideo(this.queryParams).then((response) => { listVideo(this.queryParams).then((response) => {
this.videoList = response.rows; this.videoList = response.rows;
this.playerOptions = response.rows.map((ele) => { this.playerOptions = response.rows.map((ele) => {
console.log(ele.videourl);
return { return {
autoplay: false, autoplay: false,
muted: true, muted: true,
@ -192,8 +186,8 @@ export default {
{ {
type: ele.filetype, type: ele.filetype,
// mp4 // mp4
// src: ele.videourl src: ele.videourl
src: videobuffer.request.response, // src: downLoadVideoUrl(ele.videourl),
}, },
], ],
notSupportedMessage: "此视频暂无法播放,请稍后再试", notSupportedMessage: "此视频暂无法播放,请稍后再试",