@omnimedia/omnitool 1.1.0-34 → 1.1.0-36
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/package.json +1 -1
- package/s/timeline/parts/compositor/samplers/webcodecs.ts +3 -3
- package/s/timeline/parts/filmstrip.ts +15 -10
- package/x/demo/demo.bundle.min.js +17 -17
- package/x/demo/demo.bundle.min.js.map +3 -3
- package/x/index.html +2 -2
- package/x/timeline/parts/compositor/samplers/webcodecs.js +3 -3
- package/x/timeline/parts/compositor/samplers/webcodecs.js.map +1 -1
- package/x/timeline/parts/filmstrip.js +12 -7
- package/x/timeline/parts/filmstrip.js.map +1 -1
package/package.json
CHANGED
|
@@ -42,9 +42,9 @@ export function makeWebCodecsSampler(
|
|
|
42
42
|
audio: {
|
|
43
43
|
getStream: async function*() {
|
|
44
44
|
const source = resolveMedia(item.mediaHash)
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
const audio = driver.decodeAudio({source, start
|
|
45
|
+
const start = item.start / 1000
|
|
46
|
+
const end = (item.start + item.duration) / 1000
|
|
47
|
+
const audio = driver.decodeAudio({source, start, end})
|
|
48
48
|
const audioStream = new AudioStream(audio.getReader())
|
|
49
49
|
yield* audioStream.stream()
|
|
50
50
|
},
|
|
@@ -54,9 +54,9 @@ export class Filmstrip {
|
|
|
54
54
|
return this.options.frequency
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
#computeActiveRange([start, end]: TimeRange): TimeRange {
|
|
57
|
+
#computeActiveRange([start, end]: TimeRange, margin = 1): TimeRange {
|
|
58
58
|
const tileSize = end - start
|
|
59
|
-
return [start - tileSize, end + tileSize]
|
|
59
|
+
return [start - tileSize * margin, end + tileSize * margin]
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
async #generateTiles() {
|
|
@@ -106,15 +106,20 @@ export class Filmstrip {
|
|
|
106
106
|
* @param visibleRange - The current timeline viewport as a [start, end] tuple in seconds.
|
|
107
107
|
*/
|
|
108
108
|
set range(visibleRange: TimeRange) {
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
109
|
+
const [visStart, visEnd] = visibleRange
|
|
110
|
+
const visibleSize = visEnd - visStart
|
|
111
|
+
const [actStart, actEnd] = this.#activeRange
|
|
112
|
+
|
|
113
|
+
// trigger when we're 1x visible width away from margin edges
|
|
114
|
+
const leftTrigger = actStart + visibleSize
|
|
115
|
+
const rightTrigger = actEnd - visibleSize
|
|
116
|
+
|
|
117
|
+
const nearLeftEdge = visStart < leftTrigger
|
|
118
|
+
const nearRightEdge = visEnd > rightTrigger
|
|
119
|
+
|
|
120
|
+
if (!nearLeftEdge && !nearRightEdge) return
|
|
116
121
|
|
|
117
|
-
this.#activeRange =
|
|
122
|
+
this.#activeRange = this.#computeActiveRange(visibleRange, 2)
|
|
118
123
|
this.#update()
|
|
119
124
|
}
|
|
120
125
|
|