Commit 41637290 authored by kingweight's avatar kingweight

更新url后缀

parent 14b7c953
......@@ -176,7 +176,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
this.currentFragmentQues = ques;
this.currentFragmentIndex = i;
this.fragmentVideoUrl = this.item.video_url || '';
const videoUrl = this.item.video_url ? this.item.video_url.replace('.mp4', '_h.mp4') : '';
const videoUrl = this.fragmentVideoUrl;
this.fragmentVideoCurrentTime = ques.time || 0;
this.fragmentSelectedTime = ques.time || 0;
this.videoThumbnails = [];
......@@ -416,7 +416,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
}
// 检查缓存
const videoUrl = this.item.video_url ? this.item.video_url.replace('.mp4', '_h.mp4') : '';
const videoUrl = this.fragmentVideoUrl;
const cachedData = this.thumbnailCache.get(videoUrl);
// 视频元数据加载完成后,如果缓存不存在则生成缩略图
......@@ -524,7 +524,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
onVideoIsAccessibleInCDN(url: string) {
console.log('视频已上传到CDN:', url);
this.fragmentVideoUrl = url;
this.fragmentVideoUrl = url.replace("_h.mp4", ".mp4").replace(".mp4", "_l.mp4");
this.changeDetectorRef.detectChanges();
}
......@@ -555,7 +555,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
}
// 检查缓存
const videoUrl = this.item.video_url ? this.item.video_url.replace('.mp4', '_h.mp4') : '';
const videoUrl = this.fragmentVideoUrl;
const cachedData = this.thumbnailCache.get(videoUrl);
if (cachedData && cachedData.thumbnails.length > 0) {
console.log('使用缓存的缩略图,跳过生成');
......@@ -651,7 +651,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
// 将生成的缩略图存入缓存
if (this.videoThumbnails.length > 0) {
const videoUrl = this.item.video_url ? this.item.video_url.replace('.mp4', '_h.mp4') : '';
const videoUrl = this.fragmentVideoUrl;
const cacheData = {
thumbnails: [...this.videoThumbnails], // 创建副本避免引用问题
duration: this.fragmentVideoDuration,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment