@editframe/elements 0.33.0-beta → 0.34.6-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/EF_FRAMEGEN.js +5 -3
- package/dist/EF_FRAMEGEN.js.map +1 -1
- package/dist/_virtual/{_@oxc-project_runtime@0.94.0 → _@oxc-project_runtime@0.95.0}/helpers/decorate.js +1 -1
- package/dist/canvas/EFCanvas.d.ts +7 -4
- package/dist/canvas/EFCanvas.js +1 -1
- package/dist/canvas/EFCanvasItem.d.ts +4 -4
- package/dist/canvas/EFCanvasItem.js +1 -1
- package/dist/canvas/overlays/SelectionOverlay.d.ts +95 -0
- package/dist/canvas/overlays/SelectionOverlay.js +1 -1
- package/dist/canvas/selection/SelectionController.js +7 -11
- package/dist/canvas/selection/SelectionController.js.map +1 -1
- package/dist/elements/EFAudio.d.ts +25 -7
- package/dist/elements/EFAudio.js +31 -61
- package/dist/elements/EFAudio.js.map +1 -1
- package/dist/elements/EFCaptions.d.ts +65 -52
- package/dist/elements/EFCaptions.js +186 -400
- package/dist/elements/EFCaptions.js.map +1 -1
- package/dist/elements/EFImage.d.ts +34 -6
- package/dist/elements/EFImage.js +114 -79
- package/dist/elements/EFImage.js.map +1 -1
- package/dist/elements/EFMedia/AssetIdMediaEngine.js +17 -17
- package/dist/elements/EFMedia/AssetIdMediaEngine.js.map +1 -1
- package/dist/elements/EFMedia/AssetMediaEngine.js +41 -25
- package/dist/elements/EFMedia/AssetMediaEngine.js.map +1 -1
- package/dist/elements/EFMedia/BaseMediaEngine.js +4 -4
- package/dist/elements/EFMedia/BaseMediaEngine.js.map +1 -1
- package/dist/elements/EFMedia/BufferedSeekingInput.js +1 -1
- package/dist/elements/EFMedia/BufferedSeekingInput.js.map +1 -1
- package/dist/elements/EFMedia/JitMediaEngine.js +31 -17
- package/dist/elements/EFMedia/JitMediaEngine.js.map +1 -1
- package/dist/elements/EFMedia/shared/AudioSpanUtils.js +3 -3
- package/dist/elements/EFMedia/shared/AudioSpanUtils.js.map +1 -1
- package/dist/elements/EFMedia/videoTasks/ScrubInputCache.js +17 -9
- package/dist/elements/EFMedia/videoTasks/ScrubInputCache.js.map +1 -1
- package/dist/elements/EFMedia.d.ts +66 -20
- package/dist/elements/EFMedia.js +412 -30
- package/dist/elements/EFMedia.js.map +1 -1
- package/dist/elements/EFPanZoom.d.ts +4 -4
- package/dist/elements/EFPanZoom.js +1 -1
- package/dist/elements/EFSourceMixin.js +43 -15
- package/dist/elements/EFSourceMixin.js.map +1 -1
- package/dist/elements/EFSurface.d.ts +23 -10
- package/dist/elements/EFSurface.js +64 -22
- package/dist/elements/EFSurface.js.map +1 -1
- package/dist/elements/EFTemporal.d.ts +8 -2
- package/dist/elements/EFTemporal.js +42 -31
- package/dist/elements/EFTemporal.js.map +1 -1
- package/dist/elements/EFText.d.ts +5 -4
- package/dist/elements/EFText.js +11 -2
- package/dist/elements/EFText.js.map +1 -1
- package/dist/elements/EFTextSegment.d.ts +4 -4
- package/dist/elements/EFTextSegment.js +1 -1
- package/dist/elements/EFThumbnailStrip.d.ts +4 -4
- package/dist/elements/EFThumbnailStrip.js +1 -1
- package/dist/elements/EFTimegroup.d.ts +22 -8
- package/dist/elements/EFTimegroup.js +203 -115
- package/dist/elements/EFTimegroup.js.map +1 -1
- package/dist/elements/EFVideo.d.ts +57 -20
- package/dist/elements/EFVideo.js +324 -72
- package/dist/elements/EFVideo.js.map +1 -1
- package/dist/elements/EFWaveform.d.ts +33 -7
- package/dist/elements/EFWaveform.js +103 -59
- package/dist/elements/EFWaveform.js.map +1 -1
- package/dist/elements/renderTemporalAudio.js +14 -3
- package/dist/elements/renderTemporalAudio.js.map +1 -1
- package/dist/getRenderInfo.d.ts +2 -2
- package/dist/gui/ContextMixin.js +1 -1
- package/dist/gui/Controllable.d.ts +2 -0
- package/dist/gui/EFActiveRootTemporal.d.ts +4 -4
- package/dist/gui/EFActiveRootTemporal.js +1 -1
- package/dist/gui/EFConfiguration.d.ts +4 -4
- package/dist/gui/EFConfiguration.js +1 -1
- package/dist/gui/EFControls.d.ts +2 -2
- package/dist/gui/EFControls.js +1 -1
- package/dist/gui/EFDial.d.ts +4 -4
- package/dist/gui/EFDial.js +1 -1
- package/dist/gui/EFFilmstrip.d.ts +3 -2
- package/dist/gui/EFFilmstrip.js +1 -1
- package/dist/gui/EFFitScale.js +1 -1
- package/dist/gui/EFFocusOverlay.d.ts +4 -4
- package/dist/gui/EFFocusOverlay.js +1 -1
- package/dist/gui/EFOverlayItem.d.ts +4 -4
- package/dist/gui/EFOverlayItem.js +1 -1
- package/dist/gui/EFOverlayLayer.d.ts +4 -4
- package/dist/gui/EFOverlayLayer.js +1 -1
- package/dist/gui/EFPause.d.ts +4 -4
- package/dist/gui/EFPause.js +1 -1
- package/dist/gui/EFPlay.d.ts +4 -4
- package/dist/gui/EFPlay.js +1 -1
- package/dist/gui/EFPreview.d.ts +4 -4
- package/dist/gui/EFPreview.js +1 -1
- package/dist/gui/EFResizableBox.d.ts +4 -4
- package/dist/gui/EFResizableBox.js +1 -1
- package/dist/gui/EFScrubber.d.ts +4 -4
- package/dist/gui/EFScrubber.js +1 -1
- package/dist/gui/EFTimeDisplay.d.ts +4 -4
- package/dist/gui/EFTimeDisplay.js +1 -1
- package/dist/gui/EFTimelineRuler.d.ts +4 -4
- package/dist/gui/EFTimelineRuler.js +1 -1
- package/dist/gui/EFToggleLoop.d.ts +4 -4
- package/dist/gui/EFToggleLoop.js +1 -1
- package/dist/gui/EFTogglePlay.d.ts +4 -4
- package/dist/gui/EFTogglePlay.js +1 -1
- package/dist/gui/EFTransformHandles.d.ts +4 -4
- package/dist/gui/EFTransformHandles.js +1 -1
- package/dist/gui/EFWorkbench.d.ts +5 -4
- package/dist/gui/EFWorkbench.js +1 -1
- package/dist/gui/PlaybackController.d.ts +10 -2
- package/dist/gui/PlaybackController.js +52 -30
- package/dist/gui/PlaybackController.js.map +1 -1
- package/dist/gui/TWMixin.js +1 -1
- package/dist/gui/TWMixin.js.map +1 -1
- package/dist/gui/TargetOrContextMixin.js +1 -1
- package/dist/gui/hierarchy/EFHierarchy.d.ts +4 -4
- package/dist/gui/hierarchy/EFHierarchy.js +1 -1
- package/dist/gui/hierarchy/EFHierarchyItem.d.ts +3 -3
- package/dist/gui/hierarchy/EFHierarchyItem.js +1 -1
- package/dist/gui/timeline/EFTimeline.d.ts +6 -2
- package/dist/gui/timeline/EFTimeline.js +1 -1
- package/dist/gui/timeline/EFTimelineRow.d.ts +57 -0
- package/dist/gui/timeline/EFTimelineRow.js +1 -1
- package/dist/gui/timeline/TrimHandles.d.ts +4 -4
- package/dist/gui/timeline/TrimHandles.js +1 -1
- package/dist/gui/timeline/tracks/AudioTrack.d.ts +2 -0
- package/dist/gui/timeline/tracks/AudioTrack.js +1 -1
- package/dist/gui/timeline/tracks/CaptionsTrack.d.ts +58 -0
- package/dist/gui/timeline/tracks/CaptionsTrack.js +1 -1
- package/dist/gui/timeline/tracks/HTMLTrack.d.ts +13 -0
- package/dist/gui/timeline/tracks/HTMLTrack.js +1 -1
- package/dist/gui/timeline/tracks/ImageTrack.d.ts +14 -0
- package/dist/gui/timeline/tracks/ImageTrack.js +1 -1
- package/dist/gui/timeline/tracks/TextTrack.d.ts +26 -0
- package/dist/gui/timeline/tracks/TextTrack.js +1 -1
- package/dist/gui/timeline/tracks/TimegroupTrack.d.ts +47 -0
- package/dist/gui/timeline/tracks/TimegroupTrack.js +4 -12
- package/dist/gui/timeline/tracks/TimegroupTrack.js.map +1 -1
- package/dist/gui/timeline/tracks/TrackItem.d.ts +81 -0
- package/dist/gui/timeline/tracks/TrackItem.js +1 -1
- package/dist/gui/timeline/tracks/VideoTrack.d.ts +25 -0
- package/dist/gui/timeline/tracks/VideoTrack.js +1 -1
- package/dist/gui/timeline/tracks/WaveformTrack.d.ts +14 -0
- package/dist/gui/timeline/tracks/WaveformTrack.js +1 -1
- package/dist/gui/timeline/tracks/ensureTrackItemInit.d.ts +1 -0
- package/dist/gui/timeline/tracks/preloadTracks.d.ts +9 -0
- package/dist/gui/tree/EFTree.d.ts +5 -4
- package/dist/gui/tree/EFTree.js +1 -1
- package/dist/gui/tree/EFTreeItem.d.ts +4 -4
- package/dist/gui/tree/EFTreeItem.js +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/preview/AdaptiveResolutionTracker.js +6 -14
- package/dist/preview/AdaptiveResolutionTracker.js.map +1 -1
- package/dist/preview/FrameController.d.ts +123 -0
- package/dist/preview/FrameController.js +216 -0
- package/dist/preview/FrameController.js.map +1 -0
- package/dist/preview/RenderContext.d.ts +1 -0
- package/dist/preview/RenderContext.js +193 -0
- package/dist/preview/RenderContext.js.map +1 -0
- package/dist/preview/encoding/canvasEncoder.js +166 -0
- package/dist/preview/encoding/canvasEncoder.js.map +1 -0
- package/dist/preview/encoding/mainThreadEncoder.js +39 -0
- package/dist/preview/encoding/mainThreadEncoder.js.map +1 -0
- package/dist/preview/encoding/types.d.ts +1 -0
- package/dist/preview/encoding/workerEncoder.js +58 -0
- package/dist/preview/encoding/workerEncoder.js.map +1 -0
- package/dist/preview/logger.js +41 -0
- package/dist/preview/logger.js.map +1 -0
- package/dist/preview/previewTypes.js +11 -10
- package/dist/preview/previewTypes.js.map +1 -1
- package/dist/preview/renderTimegroupPreview.js +259 -236
- package/dist/preview/renderTimegroupPreview.js.map +1 -1
- package/dist/preview/renderTimegroupToCanvas.d.ts +5 -0
- package/dist/preview/renderTimegroupToCanvas.js +100 -489
- package/dist/preview/renderTimegroupToCanvas.js.map +1 -1
- package/dist/preview/renderTimegroupToVideo.d.ts +1 -0
- package/dist/preview/renderTimegroupToVideo.js +80 -22
- package/dist/preview/renderTimegroupToVideo.js.map +1 -1
- package/dist/preview/renderers.js.map +1 -1
- package/dist/preview/rendering/inlineImages.js +56 -0
- package/dist/preview/rendering/inlineImages.js.map +1 -0
- package/dist/preview/rendering/renderToImage.d.ts +1 -0
- package/dist/preview/rendering/renderToImage.js +120 -0
- package/dist/preview/rendering/renderToImage.js.map +1 -0
- package/dist/preview/rendering/renderToImageForeignObject.js +135 -0
- package/dist/preview/rendering/renderToImageForeignObject.js.map +1 -0
- package/dist/preview/rendering/renderToImageNative.d.ts +1 -0
- package/dist/preview/rendering/renderToImageNative.js +129 -0
- package/dist/preview/rendering/renderToImageNative.js.map +1 -0
- package/dist/preview/rendering/svgSerializer.js +43 -0
- package/dist/preview/rendering/svgSerializer.js.map +1 -0
- package/dist/preview/rendering/types.d.ts +2 -0
- package/dist/preview/statsTrackingStrategy.js +3 -1
- package/dist/preview/statsTrackingStrategy.js.map +1 -1
- package/dist/preview/workers/WorkerPool.js +8 -57
- package/dist/preview/workers/WorkerPool.js.map +1 -1
- package/dist/render/EFRenderAPI.d.ts +35 -0
- package/dist/render/EFRenderAPI.js +1 -0
- package/dist/render/EFRenderAPI.js.map +1 -1
- package/dist/sandbox/PlaybackControls.d.ts +1 -0
- package/dist/sandbox/ScenarioRunner.d.ts +1 -0
- package/dist/sandbox/defineSandbox.d.ts +1 -0
- package/dist/sandbox/index.d.ts +3 -0
- package/dist/style.css +3 -0
- package/dist/transcoding/types/index.d.ts +6 -3
- package/package.json +2 -3
- package/test/EFVideo.framegen.browsertest.ts +8 -1
- package/test/profilingPlugin.ts +1 -3
- package/test/setup.ts +23 -1
- package/dist/EF_INTERACTIVE.js +0 -7
- package/dist/EF_INTERACTIVE.js.map +0 -1
- package/dist/elements/EFMedia/BufferedSeekingInput.d.ts +0 -50
- package/dist/elements/EFMedia/audioTasks/makeAudioBufferTask.d.ts +0 -12
- package/dist/elements/EFMedia/audioTasks/makeAudioBufferTask.js +0 -104
- package/dist/elements/EFMedia/audioTasks/makeAudioBufferTask.js.map +0 -1
- package/dist/elements/EFMedia/audioTasks/makeAudioFrequencyAnalysisTask.js +0 -168
- package/dist/elements/EFMedia/audioTasks/makeAudioFrequencyAnalysisTask.js.map +0 -1
- package/dist/elements/EFMedia/audioTasks/makeAudioInitSegmentFetchTask.js +0 -46
- package/dist/elements/EFMedia/audioTasks/makeAudioInitSegmentFetchTask.js.map +0 -1
- package/dist/elements/EFMedia/audioTasks/makeAudioInputTask.js +0 -49
- package/dist/elements/EFMedia/audioTasks/makeAudioInputTask.js.map +0 -1
- package/dist/elements/EFMedia/audioTasks/makeAudioSeekTask.js +0 -30
- package/dist/elements/EFMedia/audioTasks/makeAudioSeekTask.js.map +0 -1
- package/dist/elements/EFMedia/audioTasks/makeAudioSegmentFetchTask.js +0 -49
- package/dist/elements/EFMedia/audioTasks/makeAudioSegmentFetchTask.js.map +0 -1
- package/dist/elements/EFMedia/audioTasks/makeAudioSegmentIdTask.js +0 -47
- package/dist/elements/EFMedia/audioTasks/makeAudioSegmentIdTask.js.map +0 -1
- package/dist/elements/EFMedia/audioTasks/makeAudioTimeDomainAnalysisTask.js +0 -140
- package/dist/elements/EFMedia/audioTasks/makeAudioTimeDomainAnalysisTask.js.map +0 -1
- package/dist/elements/EFMedia/shared/BufferUtils.d.ts +0 -13
- package/dist/elements/EFMedia/shared/BufferUtils.js +0 -86
- package/dist/elements/EFMedia/shared/BufferUtils.js.map +0 -1
- package/dist/elements/EFMedia/shared/MediaTaskUtils.d.ts +0 -17
- package/dist/elements/EFMedia/tasks/makeMediaEngineTask.js +0 -90
- package/dist/elements/EFMedia/tasks/makeMediaEngineTask.js.map +0 -1
- package/dist/elements/EFMedia/videoTasks/makeScrubVideoBufferTask.js +0 -80
- package/dist/elements/EFMedia/videoTasks/makeScrubVideoBufferTask.js.map +0 -1
- package/dist/elements/EFMedia/videoTasks/makeScrubVideoInitSegmentFetchTask.js +0 -49
- package/dist/elements/EFMedia/videoTasks/makeScrubVideoInitSegmentFetchTask.js.map +0 -1
- package/dist/elements/EFMedia/videoTasks/makeScrubVideoInputTask.js +0 -58
- package/dist/elements/EFMedia/videoTasks/makeScrubVideoInputTask.js.map +0 -1
- package/dist/elements/EFMedia/videoTasks/makeScrubVideoSeekTask.js +0 -71
- package/dist/elements/EFMedia/videoTasks/makeScrubVideoSeekTask.js.map +0 -1
- package/dist/elements/EFMedia/videoTasks/makeScrubVideoSegmentFetchTask.js +0 -52
- package/dist/elements/EFMedia/videoTasks/makeScrubVideoSegmentFetchTask.js.map +0 -1
- package/dist/elements/EFMedia/videoTasks/makeScrubVideoSegmentIdTask.js +0 -50
- package/dist/elements/EFMedia/videoTasks/makeScrubVideoSegmentIdTask.js.map +0 -1
- package/dist/elements/EFMedia/videoTasks/makeUnifiedVideoSeekTask.js +0 -109
- package/dist/elements/EFMedia/videoTasks/makeUnifiedVideoSeekTask.js.map +0 -1
- package/dist/elements/EFMedia/videoTasks/makeVideoBufferTask.d.ts +0 -12
- package/dist/elements/EFMedia/videoTasks/makeVideoBufferTask.js +0 -97
- package/dist/elements/EFMedia/videoTasks/makeVideoBufferTask.js.map +0 -1
- package/dist/elements/SampleBuffer.d.ts +0 -19
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { __decorate } from "../_virtual/_@oxc-project_runtime@0.94.0/helpers/decorate.js";
|
|
1
|
+
import { __decorate } from "../_virtual/_@oxc-project_runtime@0.95.0/helpers/decorate.js";
|
|
3
2
|
import { EFTemporal, flushStartTimeMsCache } from "./EFTemporal.js";
|
|
3
|
+
import { PRIORITY_CAPTIONS, createFrameTaskWrapper } from "../preview/FrameController.js";
|
|
4
4
|
import { EFSourceMixin } from "./EFSourceMixin.js";
|
|
5
5
|
import { FetchMixin } from "./FetchMixin.js";
|
|
6
|
+
import { AsyncValue } from "./EFMedia.js";
|
|
6
7
|
import { EFAudio } from "./EFAudio.js";
|
|
7
8
|
import { CrossUpdateController } from "./CrossUpdateController.js";
|
|
8
9
|
import { EFVideo } from "./EFVideo.js";
|
|
9
10
|
import { flushSequenceDurationCache } from "./EFTimegroup.js";
|
|
10
|
-
import { Task, TaskStatus } from "@lit/task";
|
|
11
11
|
import { LitElement, css, html } from "lit";
|
|
12
12
|
import { customElement, property } from "lit/decorators.js";
|
|
13
13
|
|
|
@@ -19,239 +19,99 @@ const stopWords = new Set([
|
|
|
19
19
|
"?",
|
|
20
20
|
","
|
|
21
21
|
]);
|
|
22
|
-
let EFCaptionsActiveWord = class EFCaptionsActiveWord$1 extends
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
this.
|
|
28
|
-
this.
|
|
29
|
-
this.
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
this
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
opacity: 0;
|
|
40
|
-
pointer-events: none;
|
|
41
|
-
}
|
|
42
|
-
`];
|
|
43
|
-
}
|
|
44
|
-
render() {
|
|
45
|
-
if (stopWords.has(this.wordText)) {
|
|
46
|
-
this.hidden = true;
|
|
47
|
-
return;
|
|
22
|
+
let EFCaptionsActiveWord = class EFCaptionsActiveWord$1 extends HTMLElement {
|
|
23
|
+
#wordText = "";
|
|
24
|
+
#wordIndex = 0;
|
|
25
|
+
constructor() {
|
|
26
|
+
super();
|
|
27
|
+
this.style.display = "inline-block";
|
|
28
|
+
this.style.whiteSpace = "normal";
|
|
29
|
+
this.style.lineHeight = "1";
|
|
30
|
+
}
|
|
31
|
+
set wordText(text) {
|
|
32
|
+
this.#wordText = text;
|
|
33
|
+
if (!text || stopWords.has(text)) {
|
|
34
|
+
this.style.display = "none";
|
|
35
|
+
this.textContent = "";
|
|
36
|
+
} else {
|
|
37
|
+
this.style.display = "inline-block";
|
|
38
|
+
this.textContent = text;
|
|
48
39
|
}
|
|
49
|
-
this.hidden = false;
|
|
50
|
-
const seedValue = this.wordIndex * 9007 % 233 / 233;
|
|
51
|
-
this.style.setProperty("--ef-word-seed", seedValue.toString());
|
|
52
|
-
return html`${this.wordText}`;
|
|
53
40
|
}
|
|
54
|
-
get
|
|
55
|
-
return
|
|
41
|
+
get wordText() {
|
|
42
|
+
return this.#wordText;
|
|
56
43
|
}
|
|
57
|
-
|
|
58
|
-
|
|
44
|
+
set wordIndex(index) {
|
|
45
|
+
this.#wordIndex = index;
|
|
46
|
+
const seedValue = index * 9007 % 233 / 233;
|
|
47
|
+
this.style.setProperty("--ef-word-seed", seedValue.toString());
|
|
59
48
|
}
|
|
60
|
-
get
|
|
61
|
-
return this
|
|
49
|
+
get wordIndex() {
|
|
50
|
+
return this.#wordIndex;
|
|
62
51
|
}
|
|
63
52
|
};
|
|
64
|
-
__decorate([property({
|
|
65
|
-
type: Number,
|
|
66
|
-
attribute: false
|
|
67
|
-
})], EFCaptionsActiveWord.prototype, "wordStartMs", void 0);
|
|
68
|
-
__decorate([property({
|
|
69
|
-
type: Number,
|
|
70
|
-
attribute: false
|
|
71
|
-
})], EFCaptionsActiveWord.prototype, "wordEndMs", void 0);
|
|
72
|
-
__decorate([property({
|
|
73
|
-
type: String,
|
|
74
|
-
attribute: false
|
|
75
|
-
})], EFCaptionsActiveWord.prototype, "wordText", void 0);
|
|
76
|
-
__decorate([property({
|
|
77
|
-
type: Number,
|
|
78
|
-
attribute: false
|
|
79
|
-
})], EFCaptionsActiveWord.prototype, "wordIndex", void 0);
|
|
80
|
-
__decorate([property({
|
|
81
|
-
type: Boolean,
|
|
82
|
-
reflect: true
|
|
83
|
-
})], EFCaptionsActiveWord.prototype, "hidden", void 0);
|
|
84
53
|
EFCaptionsActiveWord = __decorate([customElement("ef-captions-active-word")], EFCaptionsActiveWord);
|
|
85
|
-
let EFCaptionsSegment = class EFCaptionsSegment$1 extends
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
this.
|
|
90
|
-
this.
|
|
91
|
-
this.
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
this
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
render() {
|
|
103
|
-
if (stopWords.has(this.segmentText)) {
|
|
104
|
-
this.hidden = true;
|
|
105
|
-
return;
|
|
54
|
+
let EFCaptionsSegment = class EFCaptionsSegment$1 extends HTMLElement {
|
|
55
|
+
#segmentText = "";
|
|
56
|
+
constructor() {
|
|
57
|
+
super();
|
|
58
|
+
this.style.display = "inline-block";
|
|
59
|
+
this.style.whiteSpace = "normal";
|
|
60
|
+
this.style.lineHeight = "1";
|
|
61
|
+
}
|
|
62
|
+
set segmentText(text) {
|
|
63
|
+
this.#segmentText = text;
|
|
64
|
+
if (!text || stopWords.has(text)) {
|
|
65
|
+
this.style.display = "none";
|
|
66
|
+
this.textContent = "";
|
|
67
|
+
} else {
|
|
68
|
+
this.style.display = "inline-block";
|
|
69
|
+
this.textContent = text;
|
|
106
70
|
}
|
|
107
|
-
this.hidden = false;
|
|
108
|
-
return html`${this.segmentText}`;
|
|
109
|
-
}
|
|
110
|
-
get startTimeMs() {
|
|
111
|
-
return (this.closest("ef-captions")?.startTimeMs || 0) + (this.segmentStartMs || 0);
|
|
112
71
|
}
|
|
113
|
-
get
|
|
114
|
-
return
|
|
115
|
-
}
|
|
116
|
-
get durationMs() {
|
|
117
|
-
return this.segmentEndMs - this.segmentStartMs;
|
|
72
|
+
get segmentText() {
|
|
73
|
+
return this.#segmentText;
|
|
118
74
|
}
|
|
119
75
|
};
|
|
120
|
-
__decorate([property({
|
|
121
|
-
type: Number,
|
|
122
|
-
attribute: false
|
|
123
|
-
})], EFCaptionsSegment.prototype, "segmentStartMs", void 0);
|
|
124
|
-
__decorate([property({
|
|
125
|
-
type: Number,
|
|
126
|
-
attribute: false
|
|
127
|
-
})], EFCaptionsSegment.prototype, "segmentEndMs", void 0);
|
|
128
|
-
__decorate([property({
|
|
129
|
-
type: String,
|
|
130
|
-
attribute: false
|
|
131
|
-
})], EFCaptionsSegment.prototype, "segmentText", void 0);
|
|
132
|
-
__decorate([property({
|
|
133
|
-
type: Boolean,
|
|
134
|
-
reflect: true
|
|
135
|
-
})], EFCaptionsSegment.prototype, "hidden", void 0);
|
|
136
76
|
EFCaptionsSegment = __decorate([customElement("ef-captions-segment")], EFCaptionsSegment);
|
|
137
77
|
let EFCaptionsBeforeActiveWord = class EFCaptionsBeforeActiveWord$1 extends EFCaptionsSegment {
|
|
138
|
-
constructor(
|
|
139
|
-
super(
|
|
140
|
-
this.
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
152
|
-
:host([hidden]) {
|
|
153
|
-
opacity: 0;
|
|
154
|
-
pointer-events: none;
|
|
155
|
-
}
|
|
156
|
-
`];
|
|
157
|
-
}
|
|
158
|
-
render() {
|
|
159
|
-
if (stopWords.has(this.segmentText)) {
|
|
160
|
-
this.hidden = true;
|
|
161
|
-
return;
|
|
78
|
+
constructor() {
|
|
79
|
+
super();
|
|
80
|
+
this.style.whiteSpace = "pre";
|
|
81
|
+
}
|
|
82
|
+
set segmentText(text) {
|
|
83
|
+
const hasActiveWord = (this.closest("ef-captions")?.querySelector("ef-captions-active-word"))?.wordText;
|
|
84
|
+
const finalText = text && hasActiveWord ? text + " " : text;
|
|
85
|
+
if (!finalText || stopWords.has(finalText)) {
|
|
86
|
+
this.style.display = "none";
|
|
87
|
+
this.textContent = "";
|
|
88
|
+
} else {
|
|
89
|
+
this.style.display = "inline-block";
|
|
90
|
+
this.textContent = finalText;
|
|
162
91
|
}
|
|
163
|
-
this.hidden = false;
|
|
164
|
-
const activeWord = this.closest("ef-captions")?.querySelector("ef-captions-active-word");
|
|
165
|
-
const hasActiveWord = activeWord?.wordText && !activeWord.hidden;
|
|
166
|
-
return html`${this.segmentText}${hasActiveWord ? " " : ""}`;
|
|
167
|
-
}
|
|
168
|
-
get startTimeMs() {
|
|
169
|
-
return (this.closest("ef-captions")?.startTimeMs || 0) + (this.segmentStartMs || 0);
|
|
170
|
-
}
|
|
171
|
-
get endTimeMs() {
|
|
172
|
-
return (this.closest("ef-captions")?.startTimeMs || 0) + (this.segmentEndMs || 0);
|
|
173
|
-
}
|
|
174
|
-
get durationMs() {
|
|
175
|
-
return this.segmentEndMs - this.segmentStartMs;
|
|
176
92
|
}
|
|
177
93
|
};
|
|
178
|
-
__decorate([property({
|
|
179
|
-
type: Boolean,
|
|
180
|
-
reflect: true
|
|
181
|
-
})], EFCaptionsBeforeActiveWord.prototype, "hidden", void 0);
|
|
182
|
-
__decorate([property({
|
|
183
|
-
type: String,
|
|
184
|
-
attribute: false
|
|
185
|
-
})], EFCaptionsBeforeActiveWord.prototype, "segmentText", void 0);
|
|
186
|
-
__decorate([property({
|
|
187
|
-
type: Number,
|
|
188
|
-
attribute: false
|
|
189
|
-
})], EFCaptionsBeforeActiveWord.prototype, "segmentStartMs", void 0);
|
|
190
|
-
__decorate([property({
|
|
191
|
-
type: Number,
|
|
192
|
-
attribute: false
|
|
193
|
-
})], EFCaptionsBeforeActiveWord.prototype, "segmentEndMs", void 0);
|
|
194
94
|
EFCaptionsBeforeActiveWord = __decorate([customElement("ef-captions-before-active-word")], EFCaptionsBeforeActiveWord);
|
|
195
95
|
let EFCaptionsAfterActiveWord = class EFCaptionsAfterActiveWord$1 extends EFCaptionsSegment {
|
|
196
|
-
constructor(
|
|
197
|
-
super(
|
|
198
|
-
this.
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
line-height: 1;
|
|
209
|
-
}
|
|
210
|
-
:host([hidden]) {
|
|
211
|
-
opacity: 0;
|
|
212
|
-
pointer-events: none;
|
|
213
|
-
}
|
|
214
|
-
`];
|
|
215
|
-
}
|
|
216
|
-
render() {
|
|
217
|
-
if (stopWords.has(this.segmentText)) {
|
|
218
|
-
this.hidden = true;
|
|
219
|
-
return;
|
|
96
|
+
constructor() {
|
|
97
|
+
super();
|
|
98
|
+
this.style.whiteSpace = "pre";
|
|
99
|
+
}
|
|
100
|
+
set segmentText(text) {
|
|
101
|
+
const finalText = text ? " " + text : text;
|
|
102
|
+
if (!finalText || stopWords.has(finalText)) {
|
|
103
|
+
this.style.display = "none";
|
|
104
|
+
this.textContent = "";
|
|
105
|
+
} else {
|
|
106
|
+
this.style.display = "inline-block";
|
|
107
|
+
this.textContent = finalText;
|
|
220
108
|
}
|
|
221
|
-
this.hidden = false;
|
|
222
|
-
const activeWord = this.closest("ef-captions")?.querySelector("ef-captions-active-word");
|
|
223
|
-
return html`${activeWord?.wordText && !activeWord.hidden ? " " : ""}${this.segmentText}`;
|
|
224
|
-
}
|
|
225
|
-
get startTimeMs() {
|
|
226
|
-
return (this.closest("ef-captions")?.startTimeMs || 0) + (this.segmentStartMs || 0);
|
|
227
|
-
}
|
|
228
|
-
get endTimeMs() {
|
|
229
|
-
return (this.closest("ef-captions")?.startTimeMs || 0) + (this.segmentEndMs || 0);
|
|
230
|
-
}
|
|
231
|
-
get durationMs() {
|
|
232
|
-
return this.segmentEndMs - this.segmentStartMs;
|
|
233
109
|
}
|
|
234
110
|
};
|
|
235
|
-
__decorate([property({
|
|
236
|
-
type: Boolean,
|
|
237
|
-
reflect: true
|
|
238
|
-
})], EFCaptionsAfterActiveWord.prototype, "hidden", void 0);
|
|
239
|
-
__decorate([property({
|
|
240
|
-
type: String,
|
|
241
|
-
attribute: false
|
|
242
|
-
})], EFCaptionsAfterActiveWord.prototype, "segmentText", void 0);
|
|
243
|
-
__decorate([property({
|
|
244
|
-
type: Number,
|
|
245
|
-
attribute: false
|
|
246
|
-
})], EFCaptionsAfterActiveWord.prototype, "segmentStartMs", void 0);
|
|
247
|
-
__decorate([property({
|
|
248
|
-
type: Number,
|
|
249
|
-
attribute: false
|
|
250
|
-
})], EFCaptionsAfterActiveWord.prototype, "segmentEndMs", void 0);
|
|
251
111
|
EFCaptionsAfterActiveWord = __decorate([customElement("ef-captions-after-active-word")], EFCaptionsAfterActiveWord);
|
|
252
112
|
let EFCaptions = class EFCaptions$1 extends EFSourceMixin(EFTemporal(FetchMixin(LitElement)), { assetType: "caption_files" }) {
|
|
253
|
-
constructor(...
|
|
254
|
-
super(...
|
|
113
|
+
constructor(..._args) {
|
|
114
|
+
super(..._args);
|
|
255
115
|
this.targetSelector = "";
|
|
256
116
|
this.wordStyle = "";
|
|
257
117
|
this.captionsSrc = "";
|
|
@@ -261,118 +121,8 @@ let EFCaptions = class EFCaptions$1 extends EFSourceMixin(EFTemporal(FetchMixin(
|
|
|
261
121
|
this.segmentContainers = this.getElementsByTagName("ef-captions-segment");
|
|
262
122
|
this.beforeActiveWordContainers = this.getElementsByTagName("ef-captions-before-active-word");
|
|
263
123
|
this.afterActiveWordContainers = this.getElementsByTagName("ef-captions-after-active-word");
|
|
264
|
-
this.
|
|
265
|
-
|
|
266
|
-
args: () => [this.target, this.fetch],
|
|
267
|
-
task: async ([_target, fetch], { signal }) => {
|
|
268
|
-
if (!this.targetElement) return null;
|
|
269
|
-
const src = this.targetElement.src ?? "";
|
|
270
|
-
let normalizedSrc = src.startsWith("/") ? src.slice(1) : src;
|
|
271
|
-
normalizedSrc = normalizedSrc.replace(/^\/+/, "");
|
|
272
|
-
const response = await fetch(`/api/v1/isobmff_files/local/md5?src=${encodeURIComponent(normalizedSrc)}`, { signal });
|
|
273
|
-
if (!response.ok) return;
|
|
274
|
-
return (await response.json()).md5 ?? void 0;
|
|
275
|
-
}
|
|
276
|
-
});
|
|
277
|
-
this.transcriptionDataTask = new Task(this, {
|
|
278
|
-
autoRun: EF_INTERACTIVE,
|
|
279
|
-
args: () => [
|
|
280
|
-
this.transcriptionsPath(),
|
|
281
|
-
this.fetch,
|
|
282
|
-
this.hasCustomCaptionsData
|
|
283
|
-
],
|
|
284
|
-
task: async ([transcriptionsPath, fetch, hasCustomData], { signal }) => {
|
|
285
|
-
if (hasCustomData || !transcriptionsPath) return null;
|
|
286
|
-
return (await fetch(transcriptionsPath, { signal })).json();
|
|
287
|
-
}
|
|
288
|
-
});
|
|
289
|
-
this.fragmentIndexTask = new Task(this, {
|
|
290
|
-
autoRun: EF_INTERACTIVE,
|
|
291
|
-
args: () => [this.transcriptionDataTask.value, this.ownCurrentTimeMs],
|
|
292
|
-
task: async ([transcription, ownCurrentTimeMs], { signal }) => {
|
|
293
|
-
signal?.throwIfAborted();
|
|
294
|
-
if (!transcription) return null;
|
|
295
|
-
return Math.floor(ownCurrentTimeMs / transcription.work_slice_ms);
|
|
296
|
-
}
|
|
297
|
-
});
|
|
298
|
-
this.customCaptionsDataTask = new Task(this, {
|
|
299
|
-
autoRun: EF_INTERACTIVE,
|
|
300
|
-
args: () => [
|
|
301
|
-
this.captionsSrc,
|
|
302
|
-
this.captionsData,
|
|
303
|
-
this.captionsScript,
|
|
304
|
-
this.fetch
|
|
305
|
-
],
|
|
306
|
-
task: async ([captionsSrc, captionsData, captionsScript, fetch], { signal }) => {
|
|
307
|
-
if (captionsData) return captionsData;
|
|
308
|
-
if (captionsScript) {
|
|
309
|
-
const scriptElement = document.getElementById(captionsScript);
|
|
310
|
-
if (scriptElement?.textContent) try {
|
|
311
|
-
return JSON.parse(scriptElement.textContent);
|
|
312
|
-
} catch (error) {
|
|
313
|
-
console.error(`Failed to parse captions from script #${captionsScript}:`, error);
|
|
314
|
-
return null;
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
if (captionsSrc) try {
|
|
318
|
-
return await (await fetch(captionsSrc, { signal })).json();
|
|
319
|
-
} catch (error) {
|
|
320
|
-
console.error(`Failed to load captions from ${captionsSrc}:`, error);
|
|
321
|
-
return null;
|
|
322
|
-
}
|
|
323
|
-
return null;
|
|
324
|
-
}
|
|
325
|
-
});
|
|
326
|
-
this.transcriptionFragmentDataTask = new Task(this, {
|
|
327
|
-
autoRun: EF_INTERACTIVE,
|
|
328
|
-
args: () => [
|
|
329
|
-
this.transcriptionDataTask.value,
|
|
330
|
-
this.fragmentIndexTask.value,
|
|
331
|
-
this.fetch
|
|
332
|
-
],
|
|
333
|
-
task: async ([transcription, fragmentIndex, fetch], { signal }) => {
|
|
334
|
-
if (transcription === null || transcription === void 0 || fragmentIndex === null || fragmentIndex === void 0) return null;
|
|
335
|
-
return (await fetch(this.transcriptionFragmentPath(transcription.id, fragmentIndex), { signal })).json();
|
|
336
|
-
}
|
|
337
|
-
});
|
|
338
|
-
this.unifiedCaptionsDataTask = new Task(this, {
|
|
339
|
-
autoRun: EF_INTERACTIVE,
|
|
340
|
-
args: () => [this.customCaptionsDataTask.value, this.transcriptionFragmentDataTask.value],
|
|
341
|
-
task: async ([_customData, _transcriptionData], { signal }) => {
|
|
342
|
-
signal?.throwIfAborted();
|
|
343
|
-
if (this.customCaptionsDataTask.status === TaskStatus.PENDING) {
|
|
344
|
-
await this.customCaptionsDataTask.taskComplete;
|
|
345
|
-
signal?.throwIfAborted();
|
|
346
|
-
}
|
|
347
|
-
if (this.transcriptionFragmentDataTask.status === TaskStatus.PENDING) {
|
|
348
|
-
await this.transcriptionFragmentDataTask.taskComplete;
|
|
349
|
-
signal?.throwIfAborted();
|
|
350
|
-
}
|
|
351
|
-
return this.customCaptionsDataTask.value || this.transcriptionFragmentDataTask.value;
|
|
352
|
-
}
|
|
353
|
-
});
|
|
354
|
-
this.frameTask = new Task(this, {
|
|
355
|
-
autoRun: EF_INTERACTIVE,
|
|
356
|
-
args: () => [this.unifiedCaptionsDataTask.status, this.ownCurrentTimeMs],
|
|
357
|
-
onError: (error) => {
|
|
358
|
-
this.frameTask.taskComplete.catch(() => {});
|
|
359
|
-
if (error instanceof DOMException && error.name === "AbortError" || error instanceof Error && (error.name === "AbortError" || error.message?.includes("signal is aborted") || error.message?.includes("The user aborted a request"))) return;
|
|
360
|
-
console.error("EFCaptions frameTask error", error);
|
|
361
|
-
},
|
|
362
|
-
task: async ([_status, _ownCurrentTimeMs], { signal }) => {
|
|
363
|
-
try {
|
|
364
|
-
await this.unifiedCaptionsDataTask.taskComplete;
|
|
365
|
-
} catch (error) {
|
|
366
|
-
if (error instanceof DOMException && error.name === "AbortError") {
|
|
367
|
-
signal?.throwIfAborted();
|
|
368
|
-
return;
|
|
369
|
-
}
|
|
370
|
-
throw error;
|
|
371
|
-
}
|
|
372
|
-
signal?.throwIfAborted();
|
|
373
|
-
this.updateTextContainers();
|
|
374
|
-
}
|
|
375
|
-
});
|
|
124
|
+
this.unifiedCaptionsDataTask = new AsyncValue();
|
|
125
|
+
this.frameTask = createFrameTaskWrapper(this);
|
|
376
126
|
}
|
|
377
127
|
static {
|
|
378
128
|
this.styles = [css`
|
|
@@ -409,12 +159,103 @@ let EFCaptions = class EFCaptions$1 extends EFSourceMixin(EFTemporal(FetchMixin(
|
|
|
409
159
|
normalizedSrc = normalizedSrc.replace(/^\/+/, "");
|
|
410
160
|
return `/api/v1/assets/local/captions?src=${encodeURIComponent(normalizedSrc)}`;
|
|
411
161
|
}
|
|
412
|
-
|
|
413
|
-
|
|
162
|
+
#captionsDataLoaded = false;
|
|
163
|
+
#captionsDataPromise = null;
|
|
164
|
+
#captionsDataValue = null;
|
|
165
|
+
#transcriptionData = null;
|
|
166
|
+
/**
|
|
167
|
+
* Load captions data from all possible sources
|
|
168
|
+
*/
|
|
169
|
+
async loadCaptionsData(signal) {
|
|
170
|
+
if (this.#captionsDataLoaded && this.#captionsDataValue) return this.#captionsDataValue;
|
|
171
|
+
if (this.#captionsDataPromise) return this.#captionsDataPromise;
|
|
172
|
+
this.unifiedCaptionsDataTask.startPending();
|
|
173
|
+
this.#captionsDataPromise = this.#doLoadCaptionsData(signal);
|
|
174
|
+
try {
|
|
175
|
+
this.#captionsDataValue = await this.#captionsDataPromise;
|
|
176
|
+
this.#captionsDataLoaded = true;
|
|
177
|
+
if (this.#captionsDataValue) this.unifiedCaptionsDataTask.setValue(this.#captionsDataValue);
|
|
178
|
+
return this.#captionsDataValue;
|
|
179
|
+
} catch (error) {
|
|
180
|
+
if (error instanceof DOMException && error.name === "AbortError") throw error;
|
|
181
|
+
console.error("Failed to load captions data:", error);
|
|
182
|
+
return null;
|
|
183
|
+
} finally {
|
|
184
|
+
this.#captionsDataPromise = null;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
async #doLoadCaptionsData(signal) {
|
|
188
|
+
if (this.captionsData) return this.captionsData;
|
|
189
|
+
if (this.captionsScript) {
|
|
190
|
+
const scriptElement = document.getElementById(this.captionsScript);
|
|
191
|
+
if (scriptElement?.textContent) try {
|
|
192
|
+
return JSON.parse(scriptElement.textContent);
|
|
193
|
+
} catch (error) {
|
|
194
|
+
console.error(`Failed to parse captions from script #${this.captionsScript}:`, error);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
if (this.captionsSrc) try {
|
|
198
|
+
return await (await this.fetch(this.captionsSrc, { signal })).json();
|
|
199
|
+
} catch (error) {
|
|
200
|
+
if (error instanceof DOMException && error.name === "AbortError") throw error;
|
|
201
|
+
console.error(`Failed to load captions from ${this.captionsSrc}:`, error);
|
|
202
|
+
}
|
|
203
|
+
if (this.targetElement && !this.hasCustomCaptionsData) {
|
|
204
|
+
const transcriptionPath = this.transcriptionsPath();
|
|
205
|
+
if (transcriptionPath) try {
|
|
206
|
+
this.#transcriptionData = await (await this.fetch(transcriptionPath, { signal })).json();
|
|
207
|
+
signal?.throwIfAborted();
|
|
208
|
+
if (this.#transcriptionData) return this.#loadTranscriptionFragment(signal);
|
|
209
|
+
} catch (error) {
|
|
210
|
+
if (error instanceof DOMException && error.name === "AbortError") throw error;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
async #loadTranscriptionFragment(signal) {
|
|
216
|
+
if (!this.#transcriptionData) return null;
|
|
217
|
+
const fragmentIndex = Math.floor(this.ownCurrentTimeMs / this.#transcriptionData.work_slice_ms);
|
|
218
|
+
const fragmentPath = `${this.apiHost}/api/v1/transcriptions/${this.#transcriptionData.id}/fragments/${fragmentIndex}`;
|
|
219
|
+
try {
|
|
220
|
+
return await (await this.fetch(fragmentPath, { signal })).json();
|
|
221
|
+
} catch (error) {
|
|
222
|
+
if (error instanceof DOMException && error.name === "AbortError") throw error;
|
|
223
|
+
console.error("Failed to load transcription fragment:", error);
|
|
224
|
+
return null;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Query readiness state for a given time.
|
|
229
|
+
* @implements FrameRenderable
|
|
230
|
+
*/
|
|
231
|
+
getFrameState(_timeMs) {
|
|
232
|
+
const hasData = this.#captionsDataLoaded && this.#captionsDataValue !== null;
|
|
233
|
+
return {
|
|
234
|
+
needsPreparation: !hasData,
|
|
235
|
+
isReady: hasData,
|
|
236
|
+
priority: PRIORITY_CAPTIONS
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Async preparation - waits for captions data to load.
|
|
241
|
+
* @implements FrameRenderable
|
|
242
|
+
*/
|
|
243
|
+
async prepareFrame(_timeMs, signal) {
|
|
244
|
+
await this.loadCaptionsData(signal);
|
|
245
|
+
signal.throwIfAborted();
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Synchronous render - updates caption text containers.
|
|
249
|
+
* Sets textContent directly on child elements (light DOM).
|
|
250
|
+
* @implements FrameRenderable
|
|
251
|
+
*/
|
|
252
|
+
renderFrame(_timeMs) {
|
|
253
|
+
this.updateTextContainers();
|
|
414
254
|
}
|
|
415
255
|
#rootTimegroupUpdateController;
|
|
416
256
|
connectedCallback() {
|
|
417
257
|
super.connectedCallback();
|
|
258
|
+
this.loadCaptionsData().catch(() => {});
|
|
418
259
|
const target = this.targetSelector ? document.getElementById(this.targetSelector) : null;
|
|
419
260
|
if (target && (target instanceof EFAudio || target instanceof EFVideo)) new CrossUpdateController(target, this);
|
|
420
261
|
else if (this.hasCustomCaptionsData && this.rootTimegroup) new CrossUpdateController(this.rootTimegroup, this);
|
|
@@ -476,6 +317,9 @@ let EFCaptions = class EFCaptions$1 extends EFSourceMixin(EFTemporal(FetchMixin(
|
|
|
476
317
|
this.updateTextContainers();
|
|
477
318
|
if (changedProperties.has("captionsData") || changedProperties.has("captionsSrc") || changedProperties.has("captionsScript")) {
|
|
478
319
|
this.#cachedIntrinsicDurationMs = null;
|
|
320
|
+
this.#captionsDataLoaded = false;
|
|
321
|
+
this.#captionsDataValue = null;
|
|
322
|
+
this.loadCaptionsData().catch(() => {});
|
|
479
323
|
this.requestUpdate("intrinsicDurationMs");
|
|
480
324
|
flushSequenceDurationCache();
|
|
481
325
|
flushStartTimeMsCache();
|
|
@@ -487,7 +331,7 @@ let EFCaptions = class EFCaptions$1 extends EFSourceMixin(EFTemporal(FetchMixin(
|
|
|
487
331
|
if (changedProperties.has("ownCurrentTimeMs")) this.updateTextContainers();
|
|
488
332
|
}
|
|
489
333
|
updateTextContainers() {
|
|
490
|
-
const captionsData = this
|
|
334
|
+
const captionsData = this.#captionsDataValue;
|
|
491
335
|
if (!captionsData) return;
|
|
492
336
|
let currentTimeMs = this.ownCurrentTimeMs;
|
|
493
337
|
if (this.hasCustomCaptionsData && this.parentTimegroup) {
|
|
@@ -502,94 +346,36 @@ let EFCaptions = class EFCaptions$1 extends EFSourceMixin(EFTemporal(FetchMixin(
|
|
|
502
346
|
const currentWord = captionsData.word_segments.find((word) => currentTimeSec >= word.start && currentTimeSec < word.end);
|
|
503
347
|
const currentSegment = captionsData.segments.find((segment) => currentTimeSec >= segment.start && currentTimeSec < segment.end);
|
|
504
348
|
for (const wordContainer of this.activeWordContainers) if (currentWord) {
|
|
505
|
-
wordContainer.wordText = currentWord.text;
|
|
506
|
-
wordContainer.wordStartMs = currentWord.start * 1e3;
|
|
507
|
-
wordContainer.wordEndMs = currentWord.end * 1e3;
|
|
508
349
|
const wordIndex = captionsData.word_segments.findIndex((w) => w.start === currentWord.start && w.end === currentWord.end && w.text === currentWord.text);
|
|
509
350
|
wordContainer.wordIndex = wordIndex >= 0 ? wordIndex : 0;
|
|
510
|
-
wordContainer.
|
|
511
|
-
} else
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
wordContainer.wordEndMs = 0;
|
|
515
|
-
wordContainer.requestUpdate();
|
|
516
|
-
}
|
|
517
|
-
for (const segmentContainer of this.segmentContainers) {
|
|
518
|
-
if (currentSegment) {
|
|
519
|
-
segmentContainer.segmentText = currentSegment.text;
|
|
520
|
-
segmentContainer.segmentStartMs = currentSegment.start * 1e3;
|
|
521
|
-
segmentContainer.segmentEndMs = currentSegment.end * 1e3;
|
|
522
|
-
} else {
|
|
523
|
-
segmentContainer.segmentText = "";
|
|
524
|
-
segmentContainer.segmentStartMs = 0;
|
|
525
|
-
segmentContainer.segmentEndMs = 0;
|
|
526
|
-
}
|
|
527
|
-
segmentContainer.requestUpdate();
|
|
528
|
-
}
|
|
351
|
+
wordContainer.wordText = currentWord.text;
|
|
352
|
+
} else wordContainer.wordText = "";
|
|
353
|
+
for (const segmentContainer of this.segmentContainers) if (currentSegment) segmentContainer.segmentText = currentSegment.text;
|
|
354
|
+
else segmentContainer.segmentText = "";
|
|
529
355
|
if (currentWord && currentSegment) {
|
|
530
356
|
const segmentWords = captionsData.word_segments.filter((word) => word.start >= currentSegment.start && word.end <= currentSegment.end);
|
|
531
357
|
const currentWordIndex = segmentWords.findIndex((word) => word.start === currentWord.start && word.end === currentWord.end);
|
|
532
358
|
if (currentWordIndex !== -1) {
|
|
533
359
|
const beforeWords = segmentWords.slice(0, currentWordIndex).map((w) => w.text.trim()).join(" ");
|
|
534
360
|
const afterWords = segmentWords.slice(currentWordIndex + 1).map((w) => w.text.trim()).join(" ");
|
|
535
|
-
for (const container of this.beforeActiveWordContainers)
|
|
536
|
-
|
|
537
|
-
container.segmentStartMs = currentWord.start * 1e3;
|
|
538
|
-
container.segmentEndMs = currentWord.end * 1e3;
|
|
539
|
-
container.requestUpdate();
|
|
540
|
-
}
|
|
541
|
-
for (const container of this.afterActiveWordContainers) {
|
|
542
|
-
container.segmentText = afterWords;
|
|
543
|
-
container.segmentStartMs = currentWord.start * 1e3;
|
|
544
|
-
container.segmentEndMs = currentWord.end * 1e3;
|
|
545
|
-
container.requestUpdate();
|
|
546
|
-
}
|
|
361
|
+
for (const container of this.beforeActiveWordContainers) container.segmentText = beforeWords;
|
|
362
|
+
for (const container of this.afterActiveWordContainers) container.segmentText = afterWords;
|
|
547
363
|
}
|
|
548
364
|
} else if (currentSegment) {
|
|
549
365
|
const segmentWords = captionsData.word_segments.filter((word) => word.start >= currentSegment.start && word.end <= currentSegment.end);
|
|
550
366
|
const firstWord = segmentWords[0];
|
|
551
367
|
if (firstWord && currentTimeSec < firstWord.start) {
|
|
552
368
|
const allWords = segmentWords.map((w) => w.text.trim()).join(" ");
|
|
553
|
-
for (const container of this.beforeActiveWordContainers)
|
|
554
|
-
|
|
555
|
-
container.segmentStartMs = currentSegment.start * 1e3;
|
|
556
|
-
container.segmentEndMs = currentSegment.end * 1e3;
|
|
557
|
-
container.requestUpdate();
|
|
558
|
-
}
|
|
559
|
-
for (const container of this.afterActiveWordContainers) {
|
|
560
|
-
container.segmentText = allWords;
|
|
561
|
-
container.segmentStartMs = currentSegment.start * 1e3;
|
|
562
|
-
container.segmentEndMs = currentSegment.end * 1e3;
|
|
563
|
-
container.requestUpdate();
|
|
564
|
-
}
|
|
369
|
+
for (const container of this.beforeActiveWordContainers) container.segmentText = "";
|
|
370
|
+
for (const container of this.afterActiveWordContainers) container.segmentText = allWords;
|
|
565
371
|
} else {
|
|
566
372
|
const allCompletedWords = segmentWords.map((w) => w.text.trim()).join(" ");
|
|
567
|
-
for (const container of this.beforeActiveWordContainers)
|
|
568
|
-
|
|
569
|
-
container.segmentStartMs = currentSegment.start * 1e3;
|
|
570
|
-
container.segmentEndMs = currentSegment.end * 1e3;
|
|
571
|
-
container.requestUpdate();
|
|
572
|
-
}
|
|
573
|
-
for (const container of this.afterActiveWordContainers) {
|
|
574
|
-
container.segmentText = "";
|
|
575
|
-
container.segmentStartMs = currentSegment.start * 1e3;
|
|
576
|
-
container.segmentEndMs = currentSegment.end * 1e3;
|
|
577
|
-
container.requestUpdate();
|
|
578
|
-
}
|
|
373
|
+
for (const container of this.beforeActiveWordContainers) container.segmentText = allCompletedWords;
|
|
374
|
+
for (const container of this.afterActiveWordContainers) container.segmentText = "";
|
|
579
375
|
}
|
|
580
376
|
} else {
|
|
581
|
-
for (const container of this.beforeActiveWordContainers)
|
|
582
|
-
|
|
583
|
-
container.segmentStartMs = 0;
|
|
584
|
-
container.segmentEndMs = 0;
|
|
585
|
-
container.requestUpdate();
|
|
586
|
-
}
|
|
587
|
-
for (const container of this.afterActiveWordContainers) {
|
|
588
|
-
container.segmentText = "";
|
|
589
|
-
container.segmentStartMs = 0;
|
|
590
|
-
container.segmentEndMs = 0;
|
|
591
|
-
container.requestUpdate();
|
|
592
|
-
}
|
|
377
|
+
for (const container of this.beforeActiveWordContainers) container.segmentText = "";
|
|
378
|
+
for (const container of this.afterActiveWordContainers) container.segmentText = "";
|
|
593
379
|
}
|
|
594
380
|
}
|
|
595
381
|
get targetElement() {
|
|
@@ -610,7 +396,7 @@ let EFCaptions = class EFCaptions$1 extends EFSourceMixin(EFTemporal(FetchMixin(
|
|
|
610
396
|
if (scriptElement?.textContent) try {
|
|
611
397
|
captionsData = JSON.parse(scriptElement.textContent);
|
|
612
398
|
} catch {}
|
|
613
|
-
} else if (this
|
|
399
|
+
} else if (this.#captionsDataValue) captionsData = this.#captionsDataValue;
|
|
614
400
|
if (!captionsData) {
|
|
615
401
|
if (!this.captionsData && !this.captionsScript && !this.captionsSrc) this.#cachedIntrinsicDurationMs = void 0;
|
|
616
402
|
return;
|
|
@@ -626,7 +412,7 @@ let EFCaptions = class EFCaptions$1 extends EFSourceMixin(EFTemporal(FetchMixin(
|
|
|
626
412
|
return result;
|
|
627
413
|
}
|
|
628
414
|
get hasOwnDuration() {
|
|
629
|
-
return !!(this.captionsData || this.captionsScript || this
|
|
415
|
+
return !!(this.captionsData || this.captionsScript || this.#captionsDataValue);
|
|
630
416
|
}
|
|
631
417
|
};
|
|
632
418
|
__decorate([property({
|