@editframe/elements 0.20.4-beta.0 → 0.23.6-beta.0
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/DelayedLoadingState.js +0 -27
- package/dist/EF_FRAMEGEN.d.ts +5 -3
- package/dist/EF_FRAMEGEN.js +49 -11
- package/dist/_virtual/_@oxc-project_runtime@0.94.0/helpers/decorate.js +7 -0
- package/dist/attachContextRoot.d.ts +1 -0
- package/dist/attachContextRoot.js +9 -0
- package/dist/elements/ContextProxiesController.d.ts +1 -2
- package/dist/elements/EFAudio.js +5 -9
- package/dist/elements/EFCaptions.d.ts +1 -3
- package/dist/elements/EFCaptions.js +112 -129
- package/dist/elements/EFImage.js +6 -7
- package/dist/elements/EFMedia/AssetIdMediaEngine.js +2 -5
- package/dist/elements/EFMedia/AssetMediaEngine.js +36 -33
- package/dist/elements/EFMedia/BaseMediaEngine.js +57 -73
- package/dist/elements/EFMedia/BufferedSeekingInput.d.ts +1 -1
- package/dist/elements/EFMedia/BufferedSeekingInput.js +134 -78
- package/dist/elements/EFMedia/JitMediaEngine.js +9 -19
- package/dist/elements/EFMedia/audioTasks/makeAudioBufferTask.js +7 -13
- package/dist/elements/EFMedia/audioTasks/makeAudioFrequencyAnalysisTask.js +2 -3
- package/dist/elements/EFMedia/audioTasks/makeAudioInitSegmentFetchTask.js +1 -1
- package/dist/elements/EFMedia/audioTasks/makeAudioInputTask.js +6 -5
- package/dist/elements/EFMedia/audioTasks/makeAudioSeekTask.js +1 -3
- package/dist/elements/EFMedia/audioTasks/makeAudioSegmentFetchTask.js +1 -1
- package/dist/elements/EFMedia/audioTasks/makeAudioSegmentIdTask.js +1 -1
- package/dist/elements/EFMedia/audioTasks/makeAudioTimeDomainAnalysisTask.js +1 -1
- package/dist/elements/EFMedia/shared/AudioSpanUtils.js +9 -25
- package/dist/elements/EFMedia/shared/BufferUtils.js +2 -17
- package/dist/elements/EFMedia/shared/GlobalInputCache.js +0 -24
- package/dist/elements/EFMedia/shared/PrecisionUtils.js +0 -21
- package/dist/elements/EFMedia/shared/ThumbnailExtractor.js +0 -17
- package/dist/elements/EFMedia/tasks/makeMediaEngineTask.js +1 -10
- package/dist/elements/EFMedia/videoTasks/MainVideoInputCache.d.ts +29 -0
- package/dist/elements/EFMedia/videoTasks/MainVideoInputCache.js +32 -0
- package/dist/elements/EFMedia/videoTasks/ScrubInputCache.js +1 -15
- package/dist/elements/EFMedia/videoTasks/makeScrubVideoBufferTask.js +1 -7
- package/dist/elements/EFMedia/videoTasks/makeScrubVideoInputTask.js +8 -5
- package/dist/elements/EFMedia/videoTasks/makeScrubVideoSeekTask.js +12 -13
- package/dist/elements/EFMedia/videoTasks/makeScrubVideoSegmentIdTask.js +1 -1
- package/dist/elements/EFMedia/videoTasks/makeUnifiedVideoSeekTask.js +134 -70
- package/dist/elements/EFMedia/videoTasks/makeVideoBufferTask.js +11 -18
- package/dist/elements/EFMedia.d.ts +19 -0
- package/dist/elements/EFMedia.js +44 -25
- package/dist/elements/EFSourceMixin.js +5 -7
- package/dist/elements/EFSurface.js +6 -9
- package/dist/elements/EFTemporal.browsertest.d.ts +11 -0
- package/dist/elements/EFTemporal.d.ts +10 -0
- package/dist/elements/EFTemporal.js +100 -41
- package/dist/elements/EFThumbnailStrip.js +23 -73
- package/dist/elements/EFTimegroup.browsertest.d.ts +3 -3
- package/dist/elements/EFTimegroup.d.ts +35 -14
- package/dist/elements/EFTimegroup.js +138 -181
- package/dist/elements/EFVideo.d.ts +16 -2
- package/dist/elements/EFVideo.js +156 -108
- package/dist/elements/EFWaveform.js +23 -40
- package/dist/elements/SampleBuffer.js +3 -7
- package/dist/elements/TargetController.js +5 -5
- package/dist/elements/durationConverter.js +4 -4
- package/dist/elements/renderTemporalAudio.d.ts +10 -0
- package/dist/elements/renderTemporalAudio.js +35 -0
- package/dist/elements/updateAnimations.js +19 -43
- package/dist/gui/ContextMixin.d.ts +5 -5
- package/dist/gui/ContextMixin.js +167 -162
- package/dist/gui/Controllable.browsertest.d.ts +0 -0
- package/dist/gui/Controllable.d.ts +15 -0
- package/dist/gui/Controllable.js +9 -0
- package/dist/gui/EFConfiguration.js +7 -7
- package/dist/gui/EFControls.browsertest.d.ts +11 -0
- package/dist/gui/EFControls.d.ts +18 -4
- package/dist/gui/EFControls.js +70 -28
- package/dist/gui/EFDial.browsertest.d.ts +0 -0
- package/dist/gui/EFDial.d.ts +18 -0
- package/dist/gui/EFDial.js +141 -0
- package/dist/gui/EFFilmstrip.browsertest.d.ts +11 -0
- package/dist/gui/EFFilmstrip.d.ts +12 -2
- package/dist/gui/EFFilmstrip.js +214 -129
- package/dist/gui/EFFitScale.js +5 -8
- package/dist/gui/EFFocusOverlay.js +4 -4
- package/dist/gui/EFPause.browsertest.d.ts +0 -0
- package/dist/gui/EFPause.d.ts +23 -0
- package/dist/gui/EFPause.js +59 -0
- package/dist/gui/EFPlay.browsertest.d.ts +0 -0
- package/dist/gui/EFPlay.d.ts +23 -0
- package/dist/gui/EFPlay.js +59 -0
- package/dist/gui/EFPreview.d.ts +4 -0
- package/dist/gui/EFPreview.js +18 -9
- package/dist/gui/EFResizableBox.browsertest.d.ts +0 -0
- package/dist/gui/EFResizableBox.d.ts +34 -0
- package/dist/gui/EFResizableBox.js +547 -0
- package/dist/gui/EFScrubber.d.ts +9 -3
- package/dist/gui/EFScrubber.js +13 -13
- package/dist/gui/EFTimeDisplay.d.ts +7 -1
- package/dist/gui/EFTimeDisplay.js +8 -8
- package/dist/gui/EFToggleLoop.d.ts +9 -3
- package/dist/gui/EFToggleLoop.js +7 -5
- package/dist/gui/EFTogglePlay.d.ts +12 -4
- package/dist/gui/EFTogglePlay.js +26 -21
- package/dist/gui/EFWorkbench.js +5 -5
- package/dist/gui/PlaybackController.d.ts +67 -0
- package/dist/gui/PlaybackController.js +310 -0
- package/dist/gui/TWMixin.js +1 -1
- package/dist/gui/TWMixin2.js +1 -1
- package/dist/gui/TargetOrContextMixin.d.ts +10 -0
- package/dist/gui/TargetOrContextMixin.js +98 -0
- package/dist/gui/efContext.d.ts +2 -2
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -1
- package/dist/otel/BridgeSpanExporter.d.ts +13 -0
- package/dist/otel/BridgeSpanExporter.js +87 -0
- package/dist/otel/setupBrowserTracing.d.ts +12 -0
- package/dist/otel/setupBrowserTracing.js +32 -0
- package/dist/otel/tracingHelpers.d.ts +34 -0
- package/dist/otel/tracingHelpers.js +112 -0
- package/dist/style.css +1 -1
- package/dist/transcoding/cache/RequestDeduplicator.js +0 -21
- package/dist/transcoding/cache/URLTokenDeduplicator.js +1 -21
- package/dist/transcoding/utils/UrlGenerator.js +2 -19
- package/dist/utils/LRUCache.js +6 -53
- package/package.json +13 -5
- package/src/elements/ContextProxiesController.ts +10 -10
- package/src/elements/EFAudio.ts +1 -0
- package/src/elements/EFCaptions.browsertest.ts +128 -56
- package/src/elements/EFCaptions.ts +60 -34
- package/src/elements/EFImage.browsertest.ts +1 -2
- package/src/elements/EFMedia/AssetMediaEngine.ts +65 -37
- package/src/elements/EFMedia/BaseMediaEngine.ts +110 -52
- package/src/elements/EFMedia/BufferedSeekingInput.ts +218 -101
- package/src/elements/EFMedia/JitMediaEngine.browsertest.ts +3 -0
- package/src/elements/EFMedia/audioTasks/makeAudioInputTask.ts +7 -3
- package/src/elements/EFMedia/audioTasks/makeAudioSeekTask.chunkboundary.regression.browsertest.ts +1 -1
- package/src/elements/EFMedia/videoTasks/MainVideoInputCache.ts +76 -0
- package/src/elements/EFMedia/videoTasks/makeScrubVideoInputTask.ts +16 -10
- package/src/elements/EFMedia/videoTasks/makeScrubVideoSeekTask.ts +7 -1
- package/src/elements/EFMedia/videoTasks/makeUnifiedVideoSeekTask.ts +222 -116
- package/src/elements/EFMedia.browsertest.ts +8 -15
- package/src/elements/EFMedia.ts +54 -8
- package/src/elements/EFSurface.browsertest.ts +2 -6
- package/src/elements/EFSurface.ts +1 -0
- package/src/elements/EFTemporal.browsertest.ts +58 -1
- package/src/elements/EFTemporal.ts +140 -4
- package/src/elements/EFThumbnailStrip.browsertest.ts +2 -8
- package/src/elements/EFThumbnailStrip.ts +1 -0
- package/src/elements/EFTimegroup.browsertest.ts +16 -15
- package/src/elements/EFTimegroup.ts +281 -275
- package/src/elements/EFVideo.browsertest.ts +162 -74
- package/src/elements/EFVideo.ts +229 -101
- package/src/elements/FetchContext.browsertest.ts +7 -2
- package/src/elements/TargetController.browsertest.ts +1 -0
- package/src/elements/TargetController.ts +1 -0
- package/src/elements/renderTemporalAudio.ts +108 -0
- package/src/elements/updateAnimations.browsertest.ts +181 -6
- package/src/elements/updateAnimations.ts +6 -6
- package/src/gui/ContextMixin.browsertest.ts +274 -27
- package/src/gui/ContextMixin.ts +230 -175
- package/src/gui/Controllable.browsertest.ts +258 -0
- package/src/gui/Controllable.ts +41 -0
- package/src/gui/EFControls.browsertest.ts +294 -80
- package/src/gui/EFControls.ts +139 -28
- package/src/gui/EFDial.browsertest.ts +84 -0
- package/src/gui/EFDial.ts +172 -0
- package/src/gui/EFFilmstrip.browsertest.ts +712 -0
- package/src/gui/EFFilmstrip.ts +213 -23
- package/src/gui/EFPause.browsertest.ts +202 -0
- package/src/gui/EFPause.ts +73 -0
- package/src/gui/EFPlay.browsertest.ts +202 -0
- package/src/gui/EFPlay.ts +73 -0
- package/src/gui/EFPreview.ts +20 -5
- package/src/gui/EFResizableBox.browsertest.ts +79 -0
- package/src/gui/EFResizableBox.ts +898 -0
- package/src/gui/EFScrubber.ts +7 -5
- package/src/gui/EFTimeDisplay.browsertest.ts +19 -19
- package/src/gui/EFTimeDisplay.ts +3 -1
- package/src/gui/EFToggleLoop.ts +6 -5
- package/src/gui/EFTogglePlay.ts +30 -23
- package/src/gui/PlaybackController.ts +522 -0
- package/src/gui/TWMixin.css +3 -0
- package/src/gui/TargetOrContextMixin.ts +185 -0
- package/src/gui/efContext.ts +2 -2
- package/src/otel/BridgeSpanExporter.ts +150 -0
- package/src/otel/setupBrowserTracing.ts +73 -0
- package/src/otel/tracingHelpers.ts +251 -0
- package/test/cache-integration-verification.browsertest.ts +1 -1
- package/types.json +1 -1
- package/dist/elements/ContextProxiesController.js +0 -69
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { EF_INTERACTIVE } from "../EF_INTERACTIVE.js";
|
|
2
|
-
import {
|
|
2
|
+
import { __decorate } from "../_virtual/_@oxc-project_runtime@0.94.0/helpers/decorate.js";
|
|
3
3
|
import { EFTemporal, flushStartTimeMsCache } from "./EFTemporal.js";
|
|
4
|
+
import { EFSourceMixin } from "./EFSourceMixin.js";
|
|
4
5
|
import { FetchMixin } from "./FetchMixin.js";
|
|
5
6
|
import { flushSequenceDurationCache } from "./EFTimegroup.js";
|
|
6
7
|
import { EFAudio } from "./EFAudio.js";
|
|
@@ -9,15 +10,14 @@ import { CrossUpdateController } from "./CrossUpdateController.js";
|
|
|
9
10
|
import { Task, TaskStatus } from "@lit/task";
|
|
10
11
|
import { LitElement, css, html } from "lit";
|
|
11
12
|
import { customElement, property } from "lit/decorators.js";
|
|
12
|
-
|
|
13
|
-
const stopWords = new Set([
|
|
13
|
+
var stopWords = new Set([
|
|
14
14
|
"",
|
|
15
15
|
".",
|
|
16
16
|
"!",
|
|
17
17
|
"?",
|
|
18
18
|
","
|
|
19
19
|
]);
|
|
20
|
-
|
|
20
|
+
var EFCaptionsActiveWord = class EFCaptionsActiveWord$1 extends EFTemporal(LitElement) {
|
|
21
21
|
constructor(..._args) {
|
|
22
22
|
super(..._args);
|
|
23
23
|
this.wordStartMs = 0;
|
|
@@ -30,61 +30,57 @@ let EFCaptionsActiveWord = class EFCaptionsActiveWord$1 extends EFTemporal(LitEl
|
|
|
30
30
|
this.styles = [css`
|
|
31
31
|
:host {
|
|
32
32
|
display: inline-block;
|
|
33
|
-
white-space:
|
|
34
|
-
|
|
33
|
+
white-space: normal;
|
|
34
|
+
line-height: 1;
|
|
35
35
|
}
|
|
36
36
|
:host([hidden]) {
|
|
37
|
-
|
|
37
|
+
opacity: 0;
|
|
38
|
+
pointer-events: none;
|
|
38
39
|
}
|
|
39
40
|
`];
|
|
40
41
|
}
|
|
41
42
|
render() {
|
|
42
43
|
if (stopWords.has(this.wordText)) {
|
|
43
44
|
this.hidden = true;
|
|
44
|
-
return
|
|
45
|
+
return;
|
|
45
46
|
}
|
|
46
47
|
this.hidden = false;
|
|
47
|
-
const
|
|
48
|
-
const seedValue = seed / 233;
|
|
48
|
+
const seedValue = this.wordIndex * 9007 % 233 / 233;
|
|
49
49
|
this.style.setProperty("--ef-word-seed", seedValue.toString());
|
|
50
|
-
return html
|
|
50
|
+
return html`${this.wordText}`;
|
|
51
51
|
}
|
|
52
52
|
get startTimeMs() {
|
|
53
|
-
|
|
54
|
-
const parentStartTime = parentCaptions?.startTimeMs || 0;
|
|
55
|
-
return parentStartTime + (this.wordStartMs || 0);
|
|
53
|
+
return (this.closest("ef-captions")?.startTimeMs || 0) + (this.wordStartMs || 0);
|
|
56
54
|
}
|
|
57
55
|
get endTimeMs() {
|
|
58
|
-
|
|
59
|
-
const parentStartTime = parentCaptions?.startTimeMs || 0;
|
|
60
|
-
return parentStartTime + (this.wordEndMs || 0);
|
|
56
|
+
return (this.closest("ef-captions")?.startTimeMs || 0) + (this.wordEndMs || 0);
|
|
61
57
|
}
|
|
62
58
|
get durationMs() {
|
|
63
59
|
return this.wordEndMs - this.wordStartMs;
|
|
64
60
|
}
|
|
65
61
|
};
|
|
66
|
-
|
|
62
|
+
__decorate([property({
|
|
67
63
|
type: Number,
|
|
68
64
|
attribute: false
|
|
69
65
|
})], EFCaptionsActiveWord.prototype, "wordStartMs", void 0);
|
|
70
|
-
|
|
66
|
+
__decorate([property({
|
|
71
67
|
type: Number,
|
|
72
68
|
attribute: false
|
|
73
69
|
})], EFCaptionsActiveWord.prototype, "wordEndMs", void 0);
|
|
74
|
-
|
|
70
|
+
__decorate([property({
|
|
75
71
|
type: String,
|
|
76
72
|
attribute: false
|
|
77
73
|
})], EFCaptionsActiveWord.prototype, "wordText", void 0);
|
|
78
|
-
|
|
74
|
+
__decorate([property({
|
|
79
75
|
type: Number,
|
|
80
76
|
attribute: false
|
|
81
77
|
})], EFCaptionsActiveWord.prototype, "wordIndex", void 0);
|
|
82
|
-
|
|
78
|
+
__decorate([property({
|
|
83
79
|
type: Boolean,
|
|
84
80
|
reflect: true
|
|
85
81
|
})], EFCaptionsActiveWord.prototype, "hidden", void 0);
|
|
86
|
-
EFCaptionsActiveWord =
|
|
87
|
-
|
|
82
|
+
EFCaptionsActiveWord = __decorate([customElement("ef-captions-active-word")], EFCaptionsActiveWord);
|
|
83
|
+
var EFCaptionsSegment = class EFCaptionsSegment$1 extends EFTemporal(LitElement) {
|
|
88
84
|
constructor(..._args2) {
|
|
89
85
|
super(..._args2);
|
|
90
86
|
this.segmentStartMs = 0;
|
|
@@ -95,53 +91,48 @@ let EFCaptionsSegment = class EFCaptionsSegment$1 extends EFTemporal(LitElement)
|
|
|
95
91
|
static {
|
|
96
92
|
this.styles = [css`
|
|
97
93
|
:host {
|
|
98
|
-
display: block;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
display: none;
|
|
94
|
+
display: inline-block;
|
|
95
|
+
white-space: normal;
|
|
96
|
+
line-height: 1;
|
|
102
97
|
}
|
|
103
98
|
`];
|
|
104
99
|
}
|
|
105
100
|
render() {
|
|
106
101
|
if (stopWords.has(this.segmentText)) {
|
|
107
102
|
this.hidden = true;
|
|
108
|
-
return
|
|
103
|
+
return;
|
|
109
104
|
}
|
|
110
105
|
this.hidden = false;
|
|
111
106
|
return html`${this.segmentText}`;
|
|
112
107
|
}
|
|
113
108
|
get startTimeMs() {
|
|
114
|
-
|
|
115
|
-
const parentStartTime = parentCaptions?.startTimeMs || 0;
|
|
116
|
-
return parentStartTime + (this.segmentStartMs || 0);
|
|
109
|
+
return (this.closest("ef-captions")?.startTimeMs || 0) + (this.segmentStartMs || 0);
|
|
117
110
|
}
|
|
118
111
|
get endTimeMs() {
|
|
119
|
-
|
|
120
|
-
const parentStartTime = parentCaptions?.startTimeMs || 0;
|
|
121
|
-
return parentStartTime + (this.segmentEndMs || 0);
|
|
112
|
+
return (this.closest("ef-captions")?.startTimeMs || 0) + (this.segmentEndMs || 0);
|
|
122
113
|
}
|
|
123
114
|
get durationMs() {
|
|
124
115
|
return this.segmentEndMs - this.segmentStartMs;
|
|
125
116
|
}
|
|
126
117
|
};
|
|
127
|
-
|
|
118
|
+
__decorate([property({
|
|
128
119
|
type: Number,
|
|
129
120
|
attribute: false
|
|
130
121
|
})], EFCaptionsSegment.prototype, "segmentStartMs", void 0);
|
|
131
|
-
|
|
122
|
+
__decorate([property({
|
|
132
123
|
type: Number,
|
|
133
124
|
attribute: false
|
|
134
125
|
})], EFCaptionsSegment.prototype, "segmentEndMs", void 0);
|
|
135
|
-
|
|
126
|
+
__decorate([property({
|
|
136
127
|
type: String,
|
|
137
128
|
attribute: false
|
|
138
129
|
})], EFCaptionsSegment.prototype, "segmentText", void 0);
|
|
139
|
-
|
|
130
|
+
__decorate([property({
|
|
140
131
|
type: Boolean,
|
|
141
132
|
reflect: true
|
|
142
133
|
})], EFCaptionsSegment.prototype, "hidden", void 0);
|
|
143
|
-
EFCaptionsSegment =
|
|
144
|
-
|
|
134
|
+
EFCaptionsSegment = __decorate([customElement("ef-captions-segment")], EFCaptionsSegment);
|
|
135
|
+
var EFCaptionsBeforeActiveWord = class EFCaptionsBeforeActiveWord$1 extends EFCaptionsSegment {
|
|
145
136
|
constructor(..._args3) {
|
|
146
137
|
super(..._args3);
|
|
147
138
|
this.hidden = false;
|
|
@@ -154,52 +145,52 @@ let EFCaptionsBeforeActiveWord = class EFCaptionsBeforeActiveWord$1 extends EFCa
|
|
|
154
145
|
:host {
|
|
155
146
|
display: inline-block;
|
|
156
147
|
white-space: pre;
|
|
148
|
+
line-height: 1;
|
|
157
149
|
}
|
|
158
150
|
:host([hidden]) {
|
|
159
|
-
|
|
151
|
+
opacity: 0;
|
|
152
|
+
pointer-events: none;
|
|
160
153
|
}
|
|
161
154
|
`];
|
|
162
155
|
}
|
|
163
156
|
render() {
|
|
164
157
|
if (stopWords.has(this.segmentText)) {
|
|
165
158
|
this.hidden = true;
|
|
166
|
-
return
|
|
159
|
+
return;
|
|
167
160
|
}
|
|
168
161
|
this.hidden = false;
|
|
169
|
-
|
|
162
|
+
const activeWord = this.closest("ef-captions")?.querySelector("ef-captions-active-word");
|
|
163
|
+
const hasActiveWord = activeWord?.wordText && !activeWord.hidden;
|
|
164
|
+
return html`${this.segmentText}${hasActiveWord ? " " : ""}`;
|
|
170
165
|
}
|
|
171
166
|
get startTimeMs() {
|
|
172
|
-
|
|
173
|
-
const parentStartTime = parentCaptions?.startTimeMs || 0;
|
|
174
|
-
return parentStartTime + (this.segmentStartMs || 0);
|
|
167
|
+
return (this.closest("ef-captions")?.startTimeMs || 0) + (this.segmentStartMs || 0);
|
|
175
168
|
}
|
|
176
169
|
get endTimeMs() {
|
|
177
|
-
|
|
178
|
-
const parentStartTime = parentCaptions?.startTimeMs || 0;
|
|
179
|
-
return parentStartTime + (this.segmentEndMs || 0);
|
|
170
|
+
return (this.closest("ef-captions")?.startTimeMs || 0) + (this.segmentEndMs || 0);
|
|
180
171
|
}
|
|
181
172
|
get durationMs() {
|
|
182
173
|
return this.segmentEndMs - this.segmentStartMs;
|
|
183
174
|
}
|
|
184
175
|
};
|
|
185
|
-
|
|
176
|
+
__decorate([property({
|
|
186
177
|
type: Boolean,
|
|
187
178
|
reflect: true
|
|
188
179
|
})], EFCaptionsBeforeActiveWord.prototype, "hidden", void 0);
|
|
189
|
-
|
|
180
|
+
__decorate([property({
|
|
190
181
|
type: String,
|
|
191
182
|
attribute: false
|
|
192
183
|
})], EFCaptionsBeforeActiveWord.prototype, "segmentText", void 0);
|
|
193
|
-
|
|
184
|
+
__decorate([property({
|
|
194
185
|
type: Number,
|
|
195
186
|
attribute: false
|
|
196
187
|
})], EFCaptionsBeforeActiveWord.prototype, "segmentStartMs", void 0);
|
|
197
|
-
|
|
188
|
+
__decorate([property({
|
|
198
189
|
type: Number,
|
|
199
190
|
attribute: false
|
|
200
191
|
})], EFCaptionsBeforeActiveWord.prototype, "segmentEndMs", void 0);
|
|
201
|
-
EFCaptionsBeforeActiveWord =
|
|
202
|
-
|
|
192
|
+
EFCaptionsBeforeActiveWord = __decorate([customElement("ef-captions-before-active-word")], EFCaptionsBeforeActiveWord);
|
|
193
|
+
var EFCaptionsAfterActiveWord = class EFCaptionsAfterActiveWord$1 extends EFCaptionsSegment {
|
|
203
194
|
constructor(..._args4) {
|
|
204
195
|
super(..._args4);
|
|
205
196
|
this.hidden = false;
|
|
@@ -212,56 +203,53 @@ let EFCaptionsAfterActiveWord = class EFCaptionsAfterActiveWord$1 extends EFCapt
|
|
|
212
203
|
:host {
|
|
213
204
|
display: inline-block;
|
|
214
205
|
white-space: pre;
|
|
206
|
+
line-height: 1;
|
|
215
207
|
}
|
|
216
208
|
:host([hidden]) {
|
|
217
|
-
|
|
209
|
+
opacity: 0;
|
|
210
|
+
pointer-events: none;
|
|
218
211
|
}
|
|
219
212
|
`];
|
|
220
213
|
}
|
|
221
214
|
render() {
|
|
222
215
|
if (stopWords.has(this.segmentText)) {
|
|
223
216
|
this.hidden = true;
|
|
224
|
-
return
|
|
217
|
+
return;
|
|
225
218
|
}
|
|
226
219
|
this.hidden = false;
|
|
227
|
-
|
|
220
|
+
const activeWord = this.closest("ef-captions")?.querySelector("ef-captions-active-word");
|
|
221
|
+
return html`${activeWord?.wordText && !activeWord.hidden ? " " : ""}${this.segmentText}`;
|
|
228
222
|
}
|
|
229
223
|
get startTimeMs() {
|
|
230
|
-
|
|
231
|
-
const parentStartTime = parentCaptions?.startTimeMs || 0;
|
|
232
|
-
return parentStartTime + (this.segmentStartMs || 0);
|
|
224
|
+
return (this.closest("ef-captions")?.startTimeMs || 0) + (this.segmentStartMs || 0);
|
|
233
225
|
}
|
|
234
226
|
get endTimeMs() {
|
|
235
|
-
|
|
236
|
-
const parentStartTime = parentCaptions?.startTimeMs || 0;
|
|
237
|
-
return parentStartTime + (this.segmentEndMs || 0);
|
|
227
|
+
return (this.closest("ef-captions")?.startTimeMs || 0) + (this.segmentEndMs || 0);
|
|
238
228
|
}
|
|
239
229
|
get durationMs() {
|
|
240
230
|
return this.segmentEndMs - this.segmentStartMs;
|
|
241
231
|
}
|
|
242
232
|
};
|
|
243
|
-
|
|
233
|
+
__decorate([property({
|
|
244
234
|
type: Boolean,
|
|
245
235
|
reflect: true
|
|
246
236
|
})], EFCaptionsAfterActiveWord.prototype, "hidden", void 0);
|
|
247
|
-
|
|
237
|
+
__decorate([property({
|
|
248
238
|
type: String,
|
|
249
239
|
attribute: false
|
|
250
240
|
})], EFCaptionsAfterActiveWord.prototype, "segmentText", void 0);
|
|
251
|
-
|
|
241
|
+
__decorate([property({
|
|
252
242
|
type: Number,
|
|
253
243
|
attribute: false
|
|
254
244
|
})], EFCaptionsAfterActiveWord.prototype, "segmentStartMs", void 0);
|
|
255
|
-
|
|
245
|
+
__decorate([property({
|
|
256
246
|
type: Number,
|
|
257
247
|
attribute: false
|
|
258
248
|
})], EFCaptionsAfterActiveWord.prototype, "segmentEndMs", void 0);
|
|
259
|
-
EFCaptionsAfterActiveWord =
|
|
260
|
-
|
|
249
|
+
EFCaptionsAfterActiveWord = __decorate([customElement("ef-captions-after-active-word")], EFCaptionsAfterActiveWord);
|
|
250
|
+
var EFCaptions = class EFCaptions$1 extends EFSourceMixin(EFTemporal(FetchMixin(LitElement)), { assetType: "caption_files" }) {
|
|
261
251
|
constructor(..._args5) {
|
|
262
252
|
super(..._args5);
|
|
263
|
-
this.displayMode = "segment";
|
|
264
|
-
this.contextWords = 3;
|
|
265
253
|
this.targetSelector = "";
|
|
266
254
|
this.wordStyle = "";
|
|
267
255
|
this.captionsSrc = "";
|
|
@@ -276,12 +264,10 @@ let EFCaptions = class EFCaptions$1 extends EFSourceMixin(EFTemporal(FetchMixin(
|
|
|
276
264
|
args: () => [this.target, this.fetch],
|
|
277
265
|
task: async ([_target, fetch], { signal }) => {
|
|
278
266
|
if (!this.targetElement) return null;
|
|
279
|
-
|
|
280
|
-
const response = await fetch(md5Path, {
|
|
267
|
+
return (await fetch(`/@ef-asset/${this.targetElement.src ?? ""}`, {
|
|
281
268
|
method: "HEAD",
|
|
282
269
|
signal
|
|
283
|
-
});
|
|
284
|
-
return response.headers.get("etag") ?? void 0;
|
|
270
|
+
})).headers.get("etag") ?? void 0;
|
|
285
271
|
}
|
|
286
272
|
});
|
|
287
273
|
this.transcriptionDataTask = new Task(this, {
|
|
@@ -293,8 +279,7 @@ let EFCaptions = class EFCaptions$1 extends EFSourceMixin(EFTemporal(FetchMixin(
|
|
|
293
279
|
],
|
|
294
280
|
task: async ([transcriptionsPath, fetch, hasCustomData], { signal }) => {
|
|
295
281
|
if (hasCustomData || !transcriptionsPath) return null;
|
|
296
|
-
|
|
297
|
-
return response.json();
|
|
282
|
+
return (await fetch(transcriptionsPath, { signal })).json();
|
|
298
283
|
}
|
|
299
284
|
});
|
|
300
285
|
this.fragmentIndexTask = new Task(this, {
|
|
@@ -302,8 +287,7 @@ let EFCaptions = class EFCaptions$1 extends EFSourceMixin(EFTemporal(FetchMixin(
|
|
|
302
287
|
args: () => [this.transcriptionDataTask.value, this.ownCurrentTimeMs],
|
|
303
288
|
task: async ([transcription, ownCurrentTimeMs]) => {
|
|
304
289
|
if (!transcription) return null;
|
|
305
|
-
|
|
306
|
-
return fragmentIndex;
|
|
290
|
+
return Math.floor(ownCurrentTimeMs / transcription.work_slice_ms);
|
|
307
291
|
}
|
|
308
292
|
});
|
|
309
293
|
this.customCaptionsDataTask = new Task(this, {
|
|
@@ -326,8 +310,7 @@ let EFCaptions = class EFCaptions$1 extends EFSourceMixin(EFTemporal(FetchMixin(
|
|
|
326
310
|
}
|
|
327
311
|
}
|
|
328
312
|
if (captionsSrc) try {
|
|
329
|
-
|
|
330
|
-
return await response.json();
|
|
313
|
+
return await (await fetch(captionsSrc, { signal })).json();
|
|
331
314
|
} catch (error) {
|
|
332
315
|
console.error(`Failed to load captions from ${captionsSrc}:`, error);
|
|
333
316
|
return null;
|
|
@@ -344,9 +327,7 @@ let EFCaptions = class EFCaptions$1 extends EFSourceMixin(EFTemporal(FetchMixin(
|
|
|
344
327
|
],
|
|
345
328
|
task: async ([transcription, fragmentIndex, fetch], { signal }) => {
|
|
346
329
|
if (transcription === null || transcription === void 0 || fragmentIndex === null || fragmentIndex === void 0) return null;
|
|
347
|
-
|
|
348
|
-
const response = await fetch(fragmentPath, { signal });
|
|
349
|
-
return response.json();
|
|
330
|
+
return (await fetch(this.transcriptionFragmentPath(transcription.id, fragmentIndex), { signal })).json();
|
|
350
331
|
}
|
|
351
332
|
});
|
|
352
333
|
this.unifiedCaptionsDataTask = new Task(this, {
|
|
@@ -360,9 +341,10 @@ let EFCaptions = class EFCaptions$1 extends EFSourceMixin(EFTemporal(FetchMixin(
|
|
|
360
341
|
});
|
|
361
342
|
this.frameTask = new Task(this, {
|
|
362
343
|
autoRun: EF_INTERACTIVE,
|
|
363
|
-
args: () => [this.unifiedCaptionsDataTask.status],
|
|
344
|
+
args: () => [this.unifiedCaptionsDataTask.status, this.ownCurrentTimeMs],
|
|
364
345
|
task: async () => {
|
|
365
346
|
await this.unifiedCaptionsDataTask.taskComplete;
|
|
347
|
+
this.updateTextContainers();
|
|
366
348
|
}
|
|
367
349
|
});
|
|
368
350
|
}
|
|
@@ -370,22 +352,15 @@ let EFCaptions = class EFCaptions$1 extends EFSourceMixin(EFTemporal(FetchMixin(
|
|
|
370
352
|
this.styles = [css`
|
|
371
353
|
:host {
|
|
372
354
|
display: inline-flex;
|
|
373
|
-
|
|
374
|
-
|
|
355
|
+
white-space: normal;
|
|
356
|
+
line-height: 1;
|
|
357
|
+
gap: 0;
|
|
375
358
|
}
|
|
376
359
|
::slotted(*) {
|
|
360
|
+
display: inline-block;
|
|
377
361
|
margin: 0;
|
|
378
362
|
padding: 0;
|
|
379
363
|
}
|
|
380
|
-
::slotted(ef-captions-active-word) {
|
|
381
|
-
min-width: 0.5ch; /* Maintain minimum width when empty */
|
|
382
|
-
min-height: 1em; /* Maintain height for baseline alignment */
|
|
383
|
-
}
|
|
384
|
-
::slotted(ef-captions-active-word[hidden]) {
|
|
385
|
-
opacity: 0; /* Hide when empty but maintain layout */
|
|
386
|
-
min-width: 0.5ch;
|
|
387
|
-
min-height: 1em;
|
|
388
|
-
}
|
|
389
364
|
`];
|
|
390
365
|
}
|
|
391
366
|
set target(value) {
|
|
@@ -402,8 +377,7 @@ let EFCaptions = class EFCaptions$1 extends EFSourceMixin(EFTemporal(FetchMixin(
|
|
|
402
377
|
captionsPath() {
|
|
403
378
|
if (!this.targetElement) return null;
|
|
404
379
|
if (this.targetElement.assetId) return `${this.apiHost}/api/v1/caption_files/${this.targetElement.assetId}`;
|
|
405
|
-
|
|
406
|
-
return `/@ef-captions/${targetSrc}`;
|
|
380
|
+
return `/@ef-captions/${this.targetElement.src}`;
|
|
407
381
|
}
|
|
408
382
|
transcriptionFragmentPath(transcriptionId, fragmentIndex) {
|
|
409
383
|
return `${this.apiHost}/api/v1/transcriptions/${transcriptionId}/fragments/${fragmentIndex}`;
|
|
@@ -413,6 +387,16 @@ let EFCaptions = class EFCaptions$1 extends EFSourceMixin(EFTemporal(FetchMixin(
|
|
|
413
387
|
const target = this.targetSelector ? document.getElementById(this.targetSelector) : null;
|
|
414
388
|
if (target && (target instanceof EFAudio || target instanceof EFVideo)) new CrossUpdateController(target, this);
|
|
415
389
|
else if (this.hasCustomCaptionsData && this.rootTimegroup) new CrossUpdateController(this.rootTimegroup, this);
|
|
390
|
+
new MutationObserver(() => {
|
|
391
|
+
if (this.style.display === "none") {
|
|
392
|
+
this.style.removeProperty("display");
|
|
393
|
+
this.style.opacity = "0";
|
|
394
|
+
this.style.pointerEvents = "none";
|
|
395
|
+
}
|
|
396
|
+
}).observe(this, {
|
|
397
|
+
attributes: true,
|
|
398
|
+
attributeFilter: ["style"]
|
|
399
|
+
});
|
|
416
400
|
}
|
|
417
401
|
updated(changedProperties) {
|
|
418
402
|
this.updateTextContainers();
|
|
@@ -430,8 +414,7 @@ let EFCaptions = class EFCaptions$1 extends EFSourceMixin(EFTemporal(FetchMixin(
|
|
|
430
414
|
updateTextContainers() {
|
|
431
415
|
const captionsData = this.unifiedCaptionsDataTask.value;
|
|
432
416
|
if (!captionsData) return;
|
|
433
|
-
const
|
|
434
|
-
const currentTimeSec = currentTimeMs / 1e3;
|
|
417
|
+
const currentTimeSec = this.ownCurrentTimeMs / 1e3;
|
|
435
418
|
const currentWord = captionsData.word_segments.find((word) => currentTimeSec >= word.start && currentTimeSec < word.end);
|
|
436
419
|
const currentSegment = captionsData.segments.find((segment) => currentTimeSec >= segment.start && currentTimeSec < segment.end);
|
|
437
420
|
for (const wordContainer of this.activeWordContainers) if (currentWord) {
|
|
@@ -447,14 +430,17 @@ let EFCaptions = class EFCaptions$1 extends EFSourceMixin(EFTemporal(FetchMixin(
|
|
|
447
430
|
wordContainer.wordEndMs = 0;
|
|
448
431
|
wordContainer.requestUpdate();
|
|
449
432
|
}
|
|
450
|
-
for (const segmentContainer of this.segmentContainers)
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
433
|
+
for (const segmentContainer of this.segmentContainers) {
|
|
434
|
+
if (currentSegment) {
|
|
435
|
+
segmentContainer.segmentText = currentSegment.text;
|
|
436
|
+
segmentContainer.segmentStartMs = currentSegment.start * 1e3;
|
|
437
|
+
segmentContainer.segmentEndMs = currentSegment.end * 1e3;
|
|
438
|
+
} else {
|
|
439
|
+
segmentContainer.segmentText = "";
|
|
440
|
+
segmentContainer.segmentStartMs = 0;
|
|
441
|
+
segmentContainer.segmentEndMs = 0;
|
|
442
|
+
}
|
|
443
|
+
segmentContainer.requestUpdate();
|
|
458
444
|
}
|
|
459
445
|
if (currentWord && currentSegment) {
|
|
460
446
|
const segmentWords = captionsData.word_segments.filter((word) => word.start >= currentSegment.start && word.end <= currentSegment.end);
|
|
@@ -466,28 +452,31 @@ let EFCaptions = class EFCaptions$1 extends EFSourceMixin(EFTemporal(FetchMixin(
|
|
|
466
452
|
container.segmentText = beforeWords;
|
|
467
453
|
container.segmentStartMs = currentWord.start * 1e3;
|
|
468
454
|
container.segmentEndMs = currentWord.end * 1e3;
|
|
455
|
+
container.requestUpdate();
|
|
469
456
|
}
|
|
470
457
|
for (const container of this.afterActiveWordContainers) {
|
|
471
458
|
container.segmentText = afterWords;
|
|
472
459
|
container.segmentStartMs = currentWord.start * 1e3;
|
|
473
460
|
container.segmentEndMs = currentWord.end * 1e3;
|
|
461
|
+
container.requestUpdate();
|
|
474
462
|
}
|
|
475
463
|
}
|
|
476
464
|
} else if (currentSegment) {
|
|
477
465
|
const segmentWords = captionsData.word_segments.filter((word) => word.start >= currentSegment.start && word.end <= currentSegment.end);
|
|
478
466
|
const firstWord = segmentWords[0];
|
|
479
|
-
|
|
480
|
-
if (isBeforeFirstWord) {
|
|
467
|
+
if (firstWord && currentTimeSec < firstWord.start) {
|
|
481
468
|
const allWords = segmentWords.map((w) => w.text.trim()).join(" ");
|
|
482
469
|
for (const container of this.beforeActiveWordContainers) {
|
|
483
470
|
container.segmentText = "";
|
|
484
471
|
container.segmentStartMs = currentSegment.start * 1e3;
|
|
485
472
|
container.segmentEndMs = currentSegment.end * 1e3;
|
|
473
|
+
container.requestUpdate();
|
|
486
474
|
}
|
|
487
475
|
for (const container of this.afterActiveWordContainers) {
|
|
488
476
|
container.segmentText = allWords;
|
|
489
477
|
container.segmentStartMs = currentSegment.start * 1e3;
|
|
490
478
|
container.segmentEndMs = currentSegment.end * 1e3;
|
|
479
|
+
container.requestUpdate();
|
|
491
480
|
}
|
|
492
481
|
} else {
|
|
493
482
|
const allCompletedWords = segmentWords.map((w) => w.text.trim()).join(" ");
|
|
@@ -495,11 +484,13 @@ let EFCaptions = class EFCaptions$1 extends EFSourceMixin(EFTemporal(FetchMixin(
|
|
|
495
484
|
container.segmentText = allCompletedWords;
|
|
496
485
|
container.segmentStartMs = currentSegment.start * 1e3;
|
|
497
486
|
container.segmentEndMs = currentSegment.end * 1e3;
|
|
487
|
+
container.requestUpdate();
|
|
498
488
|
}
|
|
499
489
|
for (const container of this.afterActiveWordContainers) {
|
|
500
490
|
container.segmentText = "";
|
|
501
491
|
container.segmentStartMs = currentSegment.start * 1e3;
|
|
502
492
|
container.segmentEndMs = currentSegment.end * 1e3;
|
|
493
|
+
container.requestUpdate();
|
|
503
494
|
}
|
|
504
495
|
}
|
|
505
496
|
} else {
|
|
@@ -507,11 +498,13 @@ let EFCaptions = class EFCaptions$1 extends EFSourceMixin(EFTemporal(FetchMixin(
|
|
|
507
498
|
container.segmentText = "";
|
|
508
499
|
container.segmentStartMs = 0;
|
|
509
500
|
container.segmentEndMs = 0;
|
|
501
|
+
container.requestUpdate();
|
|
510
502
|
}
|
|
511
503
|
for (const container of this.afterActiveWordContainers) {
|
|
512
504
|
container.segmentText = "";
|
|
513
505
|
container.segmentStartMs = 0;
|
|
514
506
|
container.segmentEndMs = 0;
|
|
507
|
+
container.requestUpdate();
|
|
515
508
|
}
|
|
516
509
|
}
|
|
517
510
|
}
|
|
@@ -533,7 +526,7 @@ let EFCaptions = class EFCaptions$1 extends EFSourceMixin(EFTemporal(FetchMixin(
|
|
|
533
526
|
captionsData = JSON.parse(scriptElement.textContent);
|
|
534
527
|
} catch {}
|
|
535
528
|
} else if (this.customCaptionsDataTask.value) captionsData = this.customCaptionsDataTask.value;
|
|
536
|
-
if (!captionsData) return
|
|
529
|
+
if (!captionsData) return;
|
|
537
530
|
if (captionsData.segments.length === 0 && captionsData.word_segments.length === 0) return 0;
|
|
538
531
|
const maxSegmentEnd = captionsData.segments.length > 0 ? Math.max(...captionsData.segments.map((s) => s.end)) : 0;
|
|
539
532
|
const maxWordEnd = captionsData.word_segments.length > 0 ? Math.max(...captionsData.word_segments.map((w) => w.end)) : 0;
|
|
@@ -543,35 +536,25 @@ let EFCaptions = class EFCaptions$1 extends EFSourceMixin(EFTemporal(FetchMixin(
|
|
|
543
536
|
return !!(this.captionsData || this.captionsScript || this.customCaptionsDataTask.value);
|
|
544
537
|
}
|
|
545
538
|
};
|
|
546
|
-
|
|
547
|
-
type: String,
|
|
548
|
-
attribute: "display-mode",
|
|
549
|
-
reflect: true
|
|
550
|
-
})], EFCaptions.prototype, "displayMode", void 0);
|
|
551
|
-
_decorate([property({
|
|
552
|
-
type: Number,
|
|
553
|
-
attribute: "context-words",
|
|
554
|
-
reflect: true
|
|
555
|
-
})], EFCaptions.prototype, "contextWords", void 0);
|
|
556
|
-
_decorate([property({
|
|
539
|
+
__decorate([property({
|
|
557
540
|
type: String,
|
|
558
541
|
attribute: "target",
|
|
559
542
|
reflect: true
|
|
560
543
|
})], EFCaptions.prototype, "targetSelector", void 0);
|
|
561
|
-
|
|
562
|
-
|
|
544
|
+
__decorate([property({ attribute: "word-style" })], EFCaptions.prototype, "wordStyle", void 0);
|
|
545
|
+
__decorate([property({
|
|
563
546
|
type: String,
|
|
564
547
|
attribute: "captions-src",
|
|
565
548
|
reflect: true
|
|
566
549
|
})], EFCaptions.prototype, "captionsSrc", void 0);
|
|
567
|
-
|
|
550
|
+
__decorate([property({
|
|
568
551
|
type: Object,
|
|
569
552
|
attribute: false
|
|
570
553
|
})], EFCaptions.prototype, "captionsData", void 0);
|
|
571
|
-
|
|
554
|
+
__decorate([property({
|
|
572
555
|
type: String,
|
|
573
556
|
attribute: "captions-script",
|
|
574
557
|
reflect: true
|
|
575
558
|
})], EFCaptions.prototype, "captionsScript", void 0);
|
|
576
|
-
EFCaptions =
|
|
559
|
+
EFCaptions = __decorate([customElement("ef-captions")], EFCaptions);
|
|
577
560
|
export { EFCaptions, EFCaptionsActiveWord, EFCaptionsAfterActiveWord, EFCaptionsBeforeActiveWord, EFCaptionsSegment };
|
package/dist/elements/EFImage.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { EF_INTERACTIVE } from "../EF_INTERACTIVE.js";
|
|
2
|
-
import {
|
|
2
|
+
import { __decorate } from "../_virtual/_@oxc-project_runtime@0.94.0/helpers/decorate.js";
|
|
3
3
|
import { EFTemporal } from "./EFTemporal.js";
|
|
4
|
+
import { EFSourceMixin } from "./EFSourceMixin.js";
|
|
4
5
|
import { FetchMixin } from "./FetchMixin.js";
|
|
5
6
|
import { Task } from "@lit/task";
|
|
6
7
|
import { LitElement, css, html } from "lit";
|
|
7
8
|
import { customElement, property } from "lit/decorators.js";
|
|
8
|
-
import _decorate from "@oxc-project/runtime/helpers/decorate";
|
|
9
9
|
import { createRef, ref } from "lit/directives/ref.js";
|
|
10
|
-
|
|
10
|
+
var EFImage = class EFImage$1 extends EFTemporal(EFSourceMixin(FetchMixin(LitElement), { assetType: "image_files" })) {
|
|
11
11
|
constructor(..._args) {
|
|
12
12
|
super(..._args);
|
|
13
13
|
this.imageRef = createRef();
|
|
@@ -65,8 +65,7 @@ let EFImage = class EFImage$1 extends EFTemporal(EFSourceMixin(FetchMixin(LitEle
|
|
|
65
65
|
}
|
|
66
66
|
render() {
|
|
67
67
|
const assetPath = this.assetPath();
|
|
68
|
-
|
|
69
|
-
return isDirectUrl ? html`<img ${ref(this.imageRef)} src=${assetPath} />` : html`<canvas ${ref(this.canvasRef)}></canvas>`;
|
|
68
|
+
return this.isDirectUrl(assetPath) ? html`<img ${ref(this.imageRef)} src=${assetPath} />` : html`<canvas ${ref(this.canvasRef)}></canvas>`;
|
|
70
69
|
}
|
|
71
70
|
isDirectUrl(src) {
|
|
72
71
|
return src.startsWith("http://") || src.startsWith("https://");
|
|
@@ -80,10 +79,10 @@ let EFImage = class EFImage$1 extends EFTemporal(EFSourceMixin(FetchMixin(LitEle
|
|
|
80
79
|
return this.hasExplicitDuration;
|
|
81
80
|
}
|
|
82
81
|
};
|
|
83
|
-
|
|
82
|
+
__decorate([property({
|
|
84
83
|
type: String,
|
|
85
84
|
attribute: "asset-id",
|
|
86
85
|
reflect: true
|
|
87
86
|
})], EFImage.prototype, "assetId", null);
|
|
88
|
-
EFImage =
|
|
87
|
+
EFImage = __decorate([customElement("ef-image")], EFImage);
|
|
89
88
|
export { EFImage };
|
|
@@ -2,17 +2,14 @@ import { AssetMediaEngine } from "./AssetMediaEngine.js";
|
|
|
2
2
|
var AssetIdMediaEngine = class AssetIdMediaEngine extends AssetMediaEngine {
|
|
3
3
|
static async fetchByAssetId(host, _urlGenerator, assetId, apiHost) {
|
|
4
4
|
const url = `${apiHost}/api/v1/isobmff_files/${assetId}/index`;
|
|
5
|
-
|
|
6
|
-
const data = await response.json();
|
|
7
|
-
return new AssetIdMediaEngine(host, assetId, data, apiHost);
|
|
5
|
+
return new AssetIdMediaEngine(host, assetId, await (await host.fetch(url)).json(), apiHost);
|
|
8
6
|
}
|
|
9
7
|
constructor(host, assetId, data, apiHost) {
|
|
10
8
|
super(host, assetId);
|
|
11
9
|
this.assetId = assetId;
|
|
12
10
|
this.apiHost = apiHost;
|
|
13
11
|
this.data = data;
|
|
14
|
-
|
|
15
|
-
this.durationMs = longestFragment * 1e3;
|
|
12
|
+
this.durationMs = Object.values(this.data).reduce((max, fragment) => Math.max(max, fragment.duration / fragment.timescale), 0) * 1e3;
|
|
16
13
|
}
|
|
17
14
|
get initSegmentPaths() {
|
|
18
15
|
const paths = {};
|