Fix WebGL reveal timing and flip texture readiness
This commit is contained in:
@@ -315,11 +315,22 @@ class PlaybackCoordinatorModule extends BaseModule {
|
||||
let cueTimings = Array.isArray(sentence.animation?.cueTimings)
|
||||
? sentence.animation.cueTimings
|
||||
: [];
|
||||
if (wordTimings.length === 0) {
|
||||
const timingDuration = wordTimings.reduce((max, timing) => Math.max(
|
||||
max,
|
||||
Number(timing?.delay || 0) + Number(timing?.duration || 0)
|
||||
), Number(sentence.animation?.totalDuration || 0));
|
||||
const ttsDuration = Number(sentence.tts?.duration || sentence.animation?.totalDuration || 0);
|
||||
if (wordTimings.length === 0 || (timingDuration <= 0 && ttsDuration > 0)) {
|
||||
const words = String(sentence.text || '').match(/\S+/g) || [];
|
||||
const calculated = this.calculateWordTimings(words, sentence.tts?.duration || sentence.animation?.totalDuration || 0);
|
||||
const calculated = this.calculateWordTimings(words, ttsDuration);
|
||||
wordTimings = calculated.wordTimings;
|
||||
cueTimings = [];
|
||||
sentence.animation = {
|
||||
...(sentence.animation || {}),
|
||||
wordTimings,
|
||||
cueTimings,
|
||||
totalDuration: calculated.totalDuration
|
||||
};
|
||||
}
|
||||
|
||||
if (typeof sentence.webglRevealController !== 'function') {
|
||||
|
||||
Reference in New Issue
Block a user