Commit 5ca1d6cc authored by JinWei's avatar JinWei

Merge branch 'feature-jj_vedio_practice' into 'master'

更新url后缀

See merge request !4
parents 12c6b620 41637290
...@@ -176,7 +176,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O ...@@ -176,7 +176,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
this.currentFragmentQues = ques; this.currentFragmentQues = ques;
this.currentFragmentIndex = i; this.currentFragmentIndex = i;
this.fragmentVideoUrl = this.item.video_url || ''; 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.fragmentVideoCurrentTime = ques.time || 0;
this.fragmentSelectedTime = ques.time || 0; this.fragmentSelectedTime = ques.time || 0;
this.videoThumbnails = []; this.videoThumbnails = [];
...@@ -416,7 +416,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O ...@@ -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); const cachedData = this.thumbnailCache.get(videoUrl);
// 视频元数据加载完成后,如果缓存不存在则生成缩略图 // 视频元数据加载完成后,如果缓存不存在则生成缩略图
...@@ -524,7 +524,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O ...@@ -524,7 +524,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
onVideoIsAccessibleInCDN(url: string) { onVideoIsAccessibleInCDN(url: string) {
console.log('视频已上传到CDN:', url); console.log('视频已上传到CDN:', url);
this.fragmentVideoUrl = url; this.fragmentVideoUrl = url.replace("_h.mp4", ".mp4").replace(".mp4", "_l.mp4");
this.changeDetectorRef.detectChanges(); this.changeDetectorRef.detectChanges();
} }
...@@ -555,7 +555,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O ...@@ -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); const cachedData = this.thumbnailCache.get(videoUrl);
if (cachedData && cachedData.thumbnails.length > 0) { if (cachedData && cachedData.thumbnails.length > 0) {
console.log('使用缓存的缩略图,跳过生成'); console.log('使用缓存的缩略图,跳过生成');
...@@ -651,7 +651,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O ...@@ -651,7 +651,7 @@ export class FormComponent extends ComponentBase implements OnInit, OnChanges, O
// 将生成的缩略图存入缓存 // 将生成的缩略图存入缓存
if (this.videoThumbnails.length > 0) { 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 = { const cacheData = {
thumbnails: [...this.videoThumbnails], // 创建副本避免引用问题 thumbnails: [...this.videoThumbnails], // 创建副本避免引用问题
duration: this.fragmentVideoDuration, 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