import { LyricWord } from './LyricWord' /** * The line info of lyric. */ export class LyricLine { text: string readonly beginTime: number nextTime: number words: LyricWord[] = [] translation?: string; // 存储翻译文本 /** * @param text The text of lyric line. * @param beginTime The begin timestamp of this lyric line. * @param nextTime The begin timestamp of the next lyric line. */ constructor(text: string, beginTime: number, nextTime: number,words?: LyricWord[],translation?: string ) { this.text = text this.beginTime = beginTime this.nextTime = nextTime this.words = words || [] this.translation = translation || '' } // 新增方法:判断是否有逐字歌词 hasWords(): boolean { return this.words.length > 0 } }