@editframe/elements 0.12.0-beta.8 → 0.13.0-beta.2
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/elements/EFAudio.d.ts +1 -1
- package/dist/elements/EFCaptions.d.ts +5 -5
- package/dist/elements/EFImage.d.ts +1 -1
- package/dist/elements/EFMedia.browsertest.d.ts +1 -1
- package/dist/elements/EFMedia.d.ts +6 -1
- package/dist/elements/{src/elements/EFMedia.js → EFMedia.js} +3 -3
- package/dist/elements/EFTemporal.browsertest.d.ts +1 -1
- package/dist/elements/EFTemporal.d.ts +145 -2
- package/dist/elements/{src/elements/EFTemporal.js → EFTemporal.js} +3 -0
- package/dist/elements/EFTimegroup.browsertest.d.ts +2 -2
- package/dist/elements/EFTimegroup.d.ts +8 -3
- package/dist/elements/{src/elements/EFTimegroup.js → EFTimegroup.js} +104 -53
- package/dist/elements/EFVideo.d.ts +1 -1
- package/dist/elements/{src/elements/EFVideo.js → EFVideo.js} +10 -2
- package/dist/elements/EFWaveform.d.ts +7 -4
- package/dist/elements/{src/elements/EFWaveform.js → EFWaveform.js} +48 -56
- package/dist/elements/TimegroupController.d.ts +2 -2
- package/dist/elements/util.d.ts +1 -1
- package/dist/gui/ContextMixin.browsertest.d.ts +1 -1
- package/dist/gui/ContextMixin.d.ts +4 -1
- package/dist/{elements/src/gui → gui}/ContextMixin.js +26 -42
- package/dist/gui/EFFilmstrip.d.ts +15 -9
- package/dist/{elements/src/gui → gui}/EFFilmstrip.js +64 -16
- package/dist/gui/EFFocusOverlay.d.ts +17 -0
- package/dist/gui/EFFocusOverlay.js +82 -0
- package/dist/gui/EFPreview.d.ts +3 -1
- package/dist/{elements/src/gui → gui}/EFPreview.js +24 -16
- package/dist/gui/EFScrubber.d.ts +1 -1
- package/dist/gui/EFTimeDisplay.d.ts +1 -1
- package/dist/gui/EFToggleLoop.d.ts +1 -1
- package/dist/gui/EFTogglePlay.d.ts +1 -1
- package/dist/gui/EFWorkbench.d.ts +1 -1
- package/dist/{elements/src/gui → gui}/TWMixin.css.js +1 -1
- package/dist/gui/efContext.d.ts +1 -1
- package/dist/index.d.ts +15 -14
- package/dist/{elements/src/index.js → index.js} +2 -0
- package/dist/style.css +769 -19
- package/package.json +5 -4
- package/src/elements/EFAudio.ts +3 -3
- package/src/elements/EFCaptions.browsertest.ts +3 -3
- package/src/elements/EFCaptions.ts +9 -9
- package/src/elements/EFImage.browsertest.ts +2 -2
- package/src/elements/EFImage.ts +4 -4
- package/src/elements/EFMedia.browsertest.ts +6 -6
- package/src/elements/EFMedia.ts +14 -7
- package/src/elements/EFSourceMixin.ts +3 -3
- package/src/elements/EFTemporal.browsertest.ts +1 -1
- package/src/elements/EFTemporal.ts +159 -4
- package/src/elements/EFTimegroup.browsertest.ts +5 -5
- package/src/elements/EFTimegroup.ts +141 -68
- package/src/elements/EFVideo.ts +15 -4
- package/src/elements/EFWaveform.ts +82 -98
- package/src/elements/FetchMixin.ts +2 -2
- package/src/elements/TimegroupController.ts +2 -2
- package/src/elements/durationConverter.ts +1 -1
- package/src/elements/util.ts +1 -1
- package/src/gui/ContextMixin.browsertest.ts +3 -3
- package/src/gui/ContextMixin.ts +37 -49
- package/src/gui/EFFilmstrip.ts +92 -36
- package/src/gui/EFFocusOverlay.ts +79 -0
- package/src/gui/EFPreview.ts +35 -18
- package/src/gui/EFScrubber.ts +3 -3
- package/src/gui/EFTimeDisplay.ts +2 -2
- package/src/gui/EFToggleLoop.ts +4 -4
- package/src/gui/EFTogglePlay.ts +3 -3
- package/src/gui/EFWorkbench.ts +2 -2
- package/src/gui/efContext.ts +1 -1
- package/dist/assets/src/EncodedAsset.js +0 -560
- package/dist/assets/src/MP4File.js +0 -223
- package/dist/assets/src/memoize.js +0 -14
- package/dist/{elements/src/EF_FRAMEGEN.js → EF_FRAMEGEN.js} +0 -0
- package/dist/{elements/src/EF_INTERACTIVE.js → EF_INTERACTIVE.js} +0 -0
- package/dist/{elements/src/EF_RENDERING.js → EF_RENDERING.js} +0 -0
- package/dist/elements/{src/elements/CrossUpdateController.js → CrossUpdateController.js} +0 -0
- package/dist/elements/{src/elements/EFAudio.js → EFAudio.js} +2 -2
- package/dist/elements/{src/elements/EFCaptions.js → EFCaptions.js} +0 -0
- package/dist/elements/{src/elements/EFImage.js → EFImage.js} +0 -0
- package/dist/elements/{src/elements/EFSourceMixin.js → EFSourceMixin.js} +1 -1
- package/dist/elements/{src/elements/FetchMixin.js → FetchMixin.js} +0 -0
- package/dist/elements/{src/elements/TimegroupController.js → TimegroupController.js} +0 -0
- package/dist/elements/{src/elements/durationConverter.js → durationConverter.js} +0 -0
- package/dist/elements/{src/elements/parseTimeToMs.js → parseTimeToMs.js} +0 -0
- package/dist/{elements/src/gui → gui}/EFScrubber.js +0 -0
- package/dist/{elements/src/gui → gui}/EFTimeDisplay.js +0 -0
- package/dist/{elements/src/gui → gui}/EFToggleLoop.js +1 -1
- /package/dist/{elements/src/gui → gui}/EFTogglePlay.js +0 -0
- /package/dist/{elements/src/gui → gui}/EFWorkbench.js +0 -0
- /package/dist/{elements/src/gui → gui}/TWMixin.js +0 -0
- /package/dist/{elements/src/gui → gui}/apiHostContext.js +0 -0
- /package/dist/{elements/src/gui → gui}/efContext.js +0 -0
- /package/dist/{elements/src/gui → gui}/fetchContext.js +0 -0
- /package/dist/{elements/src/gui → gui}/focusContext.js +0 -0
- /package/dist/{elements/src/gui → gui}/focusedElementContext.js +0 -0
- /package/dist/{elements/src/gui → gui}/playingContext.js +0 -0
- /package/dist/{elements/src/msToTimeCode.js → msToTimeCode.js} +0 -0
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
import * as MP4Box from "mp4box";
|
|
2
|
-
import debug from "debug";
|
|
3
|
-
const log = debug("ef:av:mp4file");
|
|
4
|
-
class MP4File extends MP4Box.ISOFile {
|
|
5
|
-
constructor() {
|
|
6
|
-
super(...arguments);
|
|
7
|
-
this.readyPromise = new Promise((resolve, reject) => {
|
|
8
|
-
this.onReady = () => resolve();
|
|
9
|
-
this.onError = reject;
|
|
10
|
-
});
|
|
11
|
-
this.waitingForSamples = [];
|
|
12
|
-
this._hasSeenLastSamples = false;
|
|
13
|
-
this._arrayBufferFileStart = 0;
|
|
14
|
-
}
|
|
15
|
-
setSegmentOptions(id, user, options) {
|
|
16
|
-
const trak = this.getTrackById(id);
|
|
17
|
-
if (trak) {
|
|
18
|
-
trak.nextSample = 0;
|
|
19
|
-
this.fragmentedTracks.push({
|
|
20
|
-
id,
|
|
21
|
-
user,
|
|
22
|
-
trak,
|
|
23
|
-
segmentStream: null,
|
|
24
|
-
nb_samples: "nbSamples" in options && options.nbSamples || 1e3,
|
|
25
|
-
rapAlignement: ("rapAlignement" in options && options.rapAlignement) ?? true
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Fragments all tracks in a file into separate array buffers.
|
|
31
|
-
*/
|
|
32
|
-
async fragmentAllTracks() {
|
|
33
|
-
const trackBuffers = {};
|
|
34
|
-
for await (const segment of this.fragmentIterator()) {
|
|
35
|
-
(trackBuffers[segment.track] ??= []).push(segment.data);
|
|
36
|
-
}
|
|
37
|
-
return trackBuffers;
|
|
38
|
-
}
|
|
39
|
-
async *fragmentIterator() {
|
|
40
|
-
await this.readyPromise;
|
|
41
|
-
const trackInfo = {};
|
|
42
|
-
for (const videoTrack of this.getInfo().videoTracks) {
|
|
43
|
-
trackInfo[videoTrack.id] = { index: 0 };
|
|
44
|
-
this.setSegmentOptions(videoTrack.id, null, {
|
|
45
|
-
rapAlignement: true
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
for (const audioTrack of this.getInfo().audioTracks) {
|
|
49
|
-
trackInfo[audioTrack.id] = { index: 0 };
|
|
50
|
-
const sampleRate = audioTrack.audio.sample_rate;
|
|
51
|
-
const probablePacketSize = 1024;
|
|
52
|
-
const probableFourSecondsOfSamples = Math.ceil(
|
|
53
|
-
sampleRate / probablePacketSize * 4
|
|
54
|
-
);
|
|
55
|
-
this.setSegmentOptions(audioTrack.id, null, {
|
|
56
|
-
nbSamples: probableFourSecondsOfSamples
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
const initSegments = this.initializeSegmentation();
|
|
60
|
-
for (const initSegment of initSegments) {
|
|
61
|
-
yield {
|
|
62
|
-
track: initSegment.id,
|
|
63
|
-
segment: "init",
|
|
64
|
-
data: initSegment.buffer
|
|
65
|
-
};
|
|
66
|
-
}
|
|
67
|
-
const fragmentStartSamples = {};
|
|
68
|
-
let finishedReading = false;
|
|
69
|
-
do {
|
|
70
|
-
for (const fragTrak of this.fragmentedTracks) {
|
|
71
|
-
const trak = fragTrak.trak;
|
|
72
|
-
if (trak.nextSample === void 0) {
|
|
73
|
-
throw new Error("trak.nextSample is undefined");
|
|
74
|
-
}
|
|
75
|
-
if (trak.samples === void 0) {
|
|
76
|
-
throw new Error("trak.samples is undefined");
|
|
77
|
-
}
|
|
78
|
-
log("trak.nextSample", fragTrak.id, trak.nextSample);
|
|
79
|
-
log("trak.samples.length", fragTrak.id, trak.samples.length);
|
|
80
|
-
while (trak.nextSample < trak.samples.length) {
|
|
81
|
-
let result = void 0;
|
|
82
|
-
const fragTrakNextSample = trak.samples[trak.nextSample];
|
|
83
|
-
if (fragTrakNextSample) {
|
|
84
|
-
fragmentStartSamples[fragTrak.id] ||= fragTrakNextSample;
|
|
85
|
-
}
|
|
86
|
-
try {
|
|
87
|
-
result = this.createFragment(
|
|
88
|
-
fragTrak.id,
|
|
89
|
-
trak.nextSample,
|
|
90
|
-
fragTrak.segmentStream
|
|
91
|
-
);
|
|
92
|
-
} catch (error) {
|
|
93
|
-
console.error("Failed to createFragment", error);
|
|
94
|
-
}
|
|
95
|
-
if (result) {
|
|
96
|
-
fragTrak.segmentStream = result;
|
|
97
|
-
trak.nextSample++;
|
|
98
|
-
} else {
|
|
99
|
-
finishedReading = await this.waitForMoreSamples();
|
|
100
|
-
break;
|
|
101
|
-
}
|
|
102
|
-
const nextSample = trak.samples[trak.nextSample];
|
|
103
|
-
const emitSegment = (
|
|
104
|
-
// if rapAlignement is true, we emit a fragment when we have a rap sample coming up next
|
|
105
|
-
fragTrak.rapAlignement === true && nextSample?.is_sync || // if rapAlignement is false, we emit a fragment when we have the required number of samples
|
|
106
|
-
!fragTrak.rapAlignement && trak.nextSample % fragTrak.nb_samples === 0 || // // if this is the last sample, we emit the fragment
|
|
107
|
-
// finished ||
|
|
108
|
-
// if we have more samples than the number of samples requested, we emit the fragment
|
|
109
|
-
trak.nextSample >= trak.samples.length
|
|
110
|
-
);
|
|
111
|
-
if (emitSegment) {
|
|
112
|
-
const trackInfoForFrag = trackInfo[fragTrak.id];
|
|
113
|
-
if (!trackInfoForFrag) {
|
|
114
|
-
throw new Error("trackInfoForFrag is undefined");
|
|
115
|
-
}
|
|
116
|
-
const startSample = fragmentStartSamples[fragTrak.id];
|
|
117
|
-
const endSample = trak.samples[trak.nextSample - 1];
|
|
118
|
-
if (!startSample || !endSample) {
|
|
119
|
-
throw new Error("startSample or endSample is undefined");
|
|
120
|
-
}
|
|
121
|
-
log(
|
|
122
|
-
`Yielding fragment #${trackInfoForFrag.index} for track=${fragTrak.id}`,
|
|
123
|
-
`startTime=${startSample.cts}`,
|
|
124
|
-
`endTime=${endSample.cts + endSample.duration}`
|
|
125
|
-
);
|
|
126
|
-
yield {
|
|
127
|
-
track: fragTrak.id,
|
|
128
|
-
segment: trackInfoForFrag.index,
|
|
129
|
-
data: fragTrak.segmentStream.buffer,
|
|
130
|
-
cts: startSample.cts,
|
|
131
|
-
dts: startSample.dts,
|
|
132
|
-
duration: endSample.cts - startSample.cts + endSample.duration
|
|
133
|
-
};
|
|
134
|
-
trackInfoForFrag.index += 1;
|
|
135
|
-
fragTrak.segmentStream = null;
|
|
136
|
-
delete fragmentStartSamples[fragTrak.id];
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
finishedReading = await this.waitForMoreSamples();
|
|
141
|
-
} while (!finishedReading);
|
|
142
|
-
for (const fragTrak of this.fragmentedTracks) {
|
|
143
|
-
const trak = fragTrak.trak;
|
|
144
|
-
if (trak.nextSample === void 0) {
|
|
145
|
-
throw new Error("trak.nextSample is undefined");
|
|
146
|
-
}
|
|
147
|
-
if (trak.samples === void 0) {
|
|
148
|
-
throw new Error("trak.samples is undefined");
|
|
149
|
-
}
|
|
150
|
-
while (trak.nextSample < trak.samples.length) {
|
|
151
|
-
let result = void 0;
|
|
152
|
-
try {
|
|
153
|
-
result = this.createFragment(
|
|
154
|
-
fragTrak.id,
|
|
155
|
-
trak.nextSample,
|
|
156
|
-
fragTrak.segmentStream
|
|
157
|
-
);
|
|
158
|
-
} catch (error) {
|
|
159
|
-
console.error("Failed to createFragment", error);
|
|
160
|
-
}
|
|
161
|
-
if (result) {
|
|
162
|
-
fragTrak.segmentStream = result;
|
|
163
|
-
trak.nextSample++;
|
|
164
|
-
} else {
|
|
165
|
-
finishedReading = await this.waitForMoreSamples();
|
|
166
|
-
break;
|
|
167
|
-
}
|
|
168
|
-
const nextSample = trak.samples[trak.nextSample];
|
|
169
|
-
const emitSegment = (
|
|
170
|
-
// if rapAlignement is true, we emit a fragment when we have a rap sample coming up next
|
|
171
|
-
fragTrak.rapAlignement === true && nextSample?.is_sync || // if rapAlignement is false, we emit a fragment when we have the required number of samples
|
|
172
|
-
!fragTrak.rapAlignement && trak.nextSample % fragTrak.nb_samples === 0 || // if we have more samples than the number of samples requested, we emit the fragment
|
|
173
|
-
trak.nextSample >= trak.samples.length
|
|
174
|
-
);
|
|
175
|
-
if (emitSegment) {
|
|
176
|
-
const trackInfoForFrag = trackInfo[fragTrak.id];
|
|
177
|
-
if (!trackInfoForFrag) {
|
|
178
|
-
throw new Error("trackInfoForFrag is undefined");
|
|
179
|
-
}
|
|
180
|
-
const startSample = fragmentStartSamples[fragTrak.id];
|
|
181
|
-
const endSample = trak.samples[trak.nextSample - 1];
|
|
182
|
-
if (!startSample || !endSample) {
|
|
183
|
-
throw new Error("startSample or endSample is undefined");
|
|
184
|
-
}
|
|
185
|
-
log(
|
|
186
|
-
`Yielding fragment #${trackInfoForFrag.index} for track=${fragTrak.id}`,
|
|
187
|
-
`startTime=${startSample.cts}`,
|
|
188
|
-
`endTime=${endSample.cts + endSample.duration}`
|
|
189
|
-
);
|
|
190
|
-
yield {
|
|
191
|
-
track: fragTrak.id,
|
|
192
|
-
segment: trackInfoForFrag.index,
|
|
193
|
-
data: fragTrak.segmentStream.buffer,
|
|
194
|
-
cts: startSample.cts,
|
|
195
|
-
dts: startSample.dts,
|
|
196
|
-
duration: endSample.cts - startSample.cts + endSample.duration
|
|
197
|
-
};
|
|
198
|
-
trackInfoForFrag.index += 1;
|
|
199
|
-
fragTrak.segmentStream = null;
|
|
200
|
-
delete fragmentStartSamples[fragTrak.id];
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
waitForMoreSamples() {
|
|
206
|
-
if (this._hasSeenLastSamples) {
|
|
207
|
-
return Promise.resolve(true);
|
|
208
|
-
}
|
|
209
|
-
return new Promise((resolve) => {
|
|
210
|
-
this.waitingForSamples.push(resolve);
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
processSamples(last) {
|
|
214
|
-
this._hasSeenLastSamples = last;
|
|
215
|
-
for (const observer of this.waitingForSamples) {
|
|
216
|
-
observer(last);
|
|
217
|
-
}
|
|
218
|
-
this.waitingForSamples = [];
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
export {
|
|
222
|
-
MP4File
|
|
223
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
const memoize = (_target, _propertyKey, descriptor) => {
|
|
2
|
-
const get = descriptor.get;
|
|
3
|
-
if (!get) return;
|
|
4
|
-
const memoized = /* @__PURE__ */ new WeakMap();
|
|
5
|
-
descriptor.get = function() {
|
|
6
|
-
if (!memoized.has(this)) {
|
|
7
|
-
memoized.set(this, get.call(this));
|
|
8
|
-
}
|
|
9
|
-
return memoized.get(this);
|
|
10
|
-
};
|
|
11
|
-
};
|
|
12
|
-
export {
|
|
13
|
-
memoize
|
|
14
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { Task } from "@lit/task";
|
|
1
2
|
import { html } from "lit";
|
|
2
|
-
import { createRef, ref } from "lit/directives/ref.js";
|
|
3
3
|
import { property, customElement } from "lit/decorators.js";
|
|
4
|
+
import { createRef, ref } from "lit/directives/ref.js";
|
|
4
5
|
import { EFMedia } from "./EFMedia.js";
|
|
5
|
-
import { Task } from "@lit/task";
|
|
6
6
|
var __defProp = Object.defineProperty;
|
|
7
7
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
8
8
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
File without changes
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { consume } from "@lit/context";
|
|
2
|
-
import { state } from "lit/decorators/state.js";
|
|
3
2
|
import { Task } from "@lit/task";
|
|
4
3
|
import { property } from "lit/decorators/property.js";
|
|
4
|
+
import { state } from "lit/decorators/state.js";
|
|
5
5
|
import { apiHostContext } from "../gui/apiHostContext.js";
|
|
6
6
|
var __defProp = Object.defineProperty;
|
|
7
7
|
var __decorateClass = (decorators, target, key, kind) => {
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { consume } from "@lit/context";
|
|
1
2
|
import { css, LitElement, html } from "lit";
|
|
2
3
|
import { customElement } from "lit/decorators.js";
|
|
3
|
-
import { consume } from "@lit/context";
|
|
4
4
|
import { efContext } from "./efContext.js";
|
|
5
5
|
var __defProp = Object.defineProperty;
|
|
6
6
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|