@omnimedia/omnitool 1.1.0-33 → 1.1.0-35
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/parts/schedulers.ts +3 -2
- package/s/timeline/parts/compositor/samplers/webcodecs.ts +7 -7
- 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/parts/schedulers.js +3 -2
- package/x/timeline/parts/compositor/parts/schedulers.js.map +1 -1
- package/x/timeline/parts/compositor/samplers/webcodecs.js +7 -7
- package/x/timeline/parts/compositor/samplers/webcodecs.js.map +1 -1
package/package.json
CHANGED
|
@@ -83,8 +83,9 @@ export const fixedStep = async (
|
|
|
83
83
|
opts: FixedStepOptions,
|
|
84
84
|
onFrame: (t: number, index: number) => Promise<void> | void
|
|
85
85
|
) => {
|
|
86
|
-
const dt =
|
|
87
|
-
const
|
|
86
|
+
const dt = 1000 / opts.fps
|
|
87
|
+
const durationInSeconds = opts.duration / 1000
|
|
88
|
+
const total = Math.ceil(durationInSeconds * opts.fps)
|
|
88
89
|
|
|
89
90
|
for (let i = 0; i < total; i++) {
|
|
90
91
|
if (opts.abort?.aborted) break
|
|
@@ -4,7 +4,7 @@ import {WebcodecsSampler} from "../parts/tree-builder.js"
|
|
|
4
4
|
import {VideoCursor} from "../../../utils/video-cursor.js"
|
|
5
5
|
import {AudioStream} from "../../../utils/audio-stream.js"
|
|
6
6
|
|
|
7
|
-
const toUs = (
|
|
7
|
+
const toUs = (ms: number) => Math.round(ms * 1_000)
|
|
8
8
|
|
|
9
9
|
export function makeWebCodecsSampler(
|
|
10
10
|
driver: Driver,
|
|
@@ -25,12 +25,12 @@ export function makeWebCodecsSampler(
|
|
|
25
25
|
return {
|
|
26
26
|
async video(item, matrix) {
|
|
27
27
|
const cursor = await getCursorForVideo(item)
|
|
28
|
-
const baseUs = toUs(item.start
|
|
28
|
+
const baseUs = toUs(item.start)
|
|
29
29
|
return {
|
|
30
30
|
duration: item.duration,
|
|
31
31
|
visuals: {
|
|
32
|
-
sampleAt: async (
|
|
33
|
-
const frame = await cursor.atOrNear(baseUs + toUs(
|
|
32
|
+
sampleAt: async (ms: number) => {
|
|
33
|
+
const frame = await cursor.atOrNear(baseUs + toUs(ms))
|
|
34
34
|
return frame ? [{kind: "image", frame, matrix}] : []
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -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
|
},
|