Commit 96dc91e3 authored by 15011343103's avatar 15011343103

feat

parent 3c147b3b
...@@ -80,14 +80,7 @@ body { ...@@ -80,14 +80,7 @@ body {
padding: 10px 20px; padding: 10px 20px;
background: rgba(0, 0, 0, 0.2); background: rgba(0, 0, 0, 0.2);
border-radius: 4px; border-radius: 4px;
max-width: 80%; width: 80%;
}
.subtitle-text {
color: #fff;
font-size: 1.2rem;
text-align: center;
line-height: 1.5;
} }
.fixed-btn-group { .fixed-btn-group {
...@@ -193,10 +186,11 @@ body::-webkit-scrollbar, html::-webkit-scrollbar { ...@@ -193,10 +186,11 @@ body::-webkit-scrollbar, html::-webkit-scrollbar {
} }
.subtitle-text { .subtitle-text {
font-size: 18px; color: #fff;
line-height: 1.5; font-size: 2.4rem;
color: #333; font-weight: bold;
text-align: center; text-align: center;
line-height: 1.5;
} }
.controls { .controls {
......
...@@ -143,22 +143,30 @@ function initializeApp(data) { ...@@ -143,22 +143,30 @@ function initializeApp(data) {
break; break;
} }
} }
// 更新当前页面的高亮和字幕 // 更新当前页面的高亮 group
const currentPage = this.pages[this.currentPage]; const currentPage = this.pages[this.currentPage];
if (currentPage && currentPage.groups) { if (currentPage && currentPage.groups) {
for (let idx = 0; idx < currentPage.groups.length; idx++) { for (let idx = 0; idx < currentPage.groups.length; idx++) {
const group = currentPage.groups[idx]; const group = currentPage.groups[idx];
if (group.start != null && group.end != null && currentTime >= group.start && currentTime <= group.end) { if (group.start != null && group.end != null && currentTime >= group.start && currentTime <= group.end) {
this.currentGroupIndex = idx; this.currentGroupIndex = idx;
this.currentAudioText = group.sentence;
this.isRectVisible = true; this.isRectVisible = true;
return; break;
} }
} }
} }
this.currentGroupIndex = -1; // 字幕严格跟随 audio_points.points
this.currentAudioText = ''; let subtitle = '';
this.isRectVisible = false; for (let i = 0; i < this.audioPoints.length; i++) {
const p = this.audioPoints[i];
if (currentTime >= p.start && currentTime <= p.end) {
subtitle = p.text;
break;
}
}
this.currentAudioText = subtitle;
if (!subtitle) this.isRectVisible = false;
if (!subtitle) this.currentGroupIndex = -1;
}, },
handleAudioEnded() { handleAudioEnded() {
this.isPlaying = false; this.isPlaying = false;
......
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