canvas-recorder-lib 0.5.0 → 0.6.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/BREAKING-CHANGES.md +18 -0
- package/README.md +112 -20
- package/dev/audio-builder.ts +4 -2
- package/dev/canvas-recorder.css +59 -0
- package/dev/canvas-recorder.ts +679 -51
- package/dev/delay-files.ts +1 -1
- package/dev/font-utils.ts +8 -1
- package/dev/format-editor.ts +734 -0
- package/dev/format-string.ts +110 -0
- package/dev/local-file-row.ts +107 -0
- package/dev/multi-text-dialog.ts +360 -0
- package/dev/multi-text-panel.ts +11 -0
- package/dev/player-body.ts +86 -6
- package/dev/rect-snap.ts +9 -9
- package/dev/slide-panel.ts +1 -1
- package/dev/split-dialog.ts +13 -2
- package/dev/static-image-panel.ts +35 -5
- package/dev/timeline-display.ts +50 -5
- package/dev/transcripts.ts +5 -3
- package/dev/video-clip-panel.ts +201 -15
- package/dist/dev/audio-builder.d.ts +1 -1
- package/dist/dev/audio-builder.d.ts.map +1 -1
- package/dist/dev/audio-builder.js +3 -2
- package/dist/dev/audio-builder.js.map +1 -1
- package/dist/dev/canvas-recorder.css +59 -0
- package/dist/dev/canvas-recorder.js +612 -50
- package/dist/dev/canvas-recorder.js.map +1 -1
- package/dist/dev/delay-files.js +1 -1
- package/dist/dev/delay-files.js.map +1 -1
- package/dist/dev/font-utils.d.ts.map +1 -1
- package/dist/dev/font-utils.js +9 -1
- package/dist/dev/font-utils.js.map +1 -1
- package/dist/dev/format-editor.d.ts +75 -0
- package/dist/dev/format-editor.d.ts.map +1 -0
- package/dist/dev/format-editor.js +642 -0
- package/dist/dev/format-editor.js.map +1 -0
- package/dist/dev/format-string.d.ts +62 -0
- package/dist/dev/format-string.d.ts.map +1 -0
- package/dist/dev/format-string.js +86 -0
- package/dist/dev/format-string.js.map +1 -0
- package/dist/dev/local-file-row.d.ts +22 -0
- package/dist/dev/local-file-row.d.ts.map +1 -0
- package/dist/dev/local-file-row.js +84 -0
- package/dist/dev/local-file-row.js.map +1 -0
- package/dist/dev/multi-text-dialog.d.ts +30 -0
- package/dist/dev/multi-text-dialog.d.ts.map +1 -0
- package/dist/dev/multi-text-dialog.js +297 -0
- package/dist/dev/multi-text-dialog.js.map +1 -0
- package/dist/dev/multi-text-panel.d.ts +2 -0
- package/dist/dev/multi-text-panel.d.ts.map +1 -1
- package/dist/dev/multi-text-panel.js +4 -0
- package/dist/dev/multi-text-panel.js.map +1 -1
- package/dist/dev/player-body.d.ts +1 -1
- package/dist/dev/player-body.d.ts.map +1 -1
- package/dist/dev/player-body.js +86 -6
- package/dist/dev/player-body.js.map +1 -1
- package/dist/dev/rect-snap.d.ts +1 -1
- package/dist/dev/rect-snap.js +7 -7
- package/dist/dev/rect-snap.js.map +1 -1
- package/dist/dev/slide-panel.d.ts +1 -1
- package/dist/dev/slide-panel.d.ts.map +1 -1
- package/dist/dev/slide-panel.js +1 -1
- package/dist/dev/slide-panel.js.map +1 -1
- package/dist/dev/split-dialog.d.ts.map +1 -1
- package/dist/dev/split-dialog.js +14 -2
- package/dist/dev/split-dialog.js.map +1 -1
- package/dist/dev/static-image-panel.d.ts +2 -0
- package/dist/dev/static-image-panel.d.ts.map +1 -1
- package/dist/dev/static-image-panel.js +29 -5
- package/dist/dev/static-image-panel.js.map +1 -1
- package/dist/dev/timeline-display.d.ts +23 -2
- package/dist/dev/timeline-display.d.ts.map +1 -1
- package/dist/dev/timeline-display.js +47 -5
- package/dist/dev/timeline-display.js.map +1 -1
- package/dist/dev/transcripts.d.ts.map +1 -1
- package/dist/dev/transcripts.js +5 -3
- package/dist/dev/transcripts.js.map +1 -1
- package/dist/dev/video-clip-panel.d.ts +8 -0
- package/dist/dev/video-clip-panel.d.ts.map +1 -1
- package/dist/dev/video-clip-panel.js +175 -9
- package/dist/dev/video-clip-panel.js.map +1 -1
- package/dist/lib/index.d.ts +3 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +3 -0
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/main-control.d.ts +50 -4
- package/dist/lib/main-control.d.ts.map +1 -1
- package/dist/lib/main-control.js +94 -12
- package/dist/lib/main-control.js.map +1 -1
- package/dist/src/binary-search.js +1 -1
- package/dist/src/binary-search.js.map +1 -1
- package/dist/src/corner-rounder.d.ts +17 -0
- package/dist/src/corner-rounder.d.ts.map +1 -0
- package/dist/src/corner-rounder.js +89 -0
- package/dist/src/corner-rounder.js.map +1 -0
- package/dist/src/cross-fade.d.ts +1 -1
- package/dist/src/cross-fade.d.ts.map +1 -1
- package/dist/src/cross-fade.js +3 -3
- package/dist/src/cross-fade.js.map +1 -1
- package/dist/src/fancy-text.d.ts +116 -0
- package/dist/src/fancy-text.d.ts.map +1 -0
- package/dist/src/fancy-text.js +211 -0
- package/dist/src/fancy-text.js.map +1 -0
- package/dist/src/glib/letters-base.d.ts +1 -1
- package/dist/src/glib/letters-base.d.ts.map +1 -1
- package/dist/src/glib/letters-base.js +4 -3
- package/dist/src/glib/letters-base.js.map +1 -1
- package/dist/src/glib/line-font.d.ts +2 -2
- package/dist/src/glib/line-font.d.ts.map +1 -1
- package/dist/src/glib/line-font.js +2 -2
- package/dist/src/glib/line-font.js.map +1 -1
- package/dist/src/glib/paragraph-layout.d.ts +2 -2
- package/dist/src/glib/paragraph-layout.d.ts.map +1 -1
- package/dist/src/glib/paragraph-layout.js +1 -1
- package/dist/src/glib/paragraph-layout.js.map +1 -1
- package/dist/src/glib/path-shape-splitter.d.ts +1 -1
- package/dist/src/glib/path-shape-splitter.d.ts.map +1 -1
- package/dist/src/glib/path-shape-splitter.js +1 -1
- package/dist/src/glib/path-shape-splitter.js.map +1 -1
- package/dist/src/glib/path-shape.js +2 -2
- package/dist/src/glib/path-shape.js.map +1 -1
- package/dist/src/interpolate.d.ts +2 -2
- package/dist/src/interpolate.d.ts.map +1 -1
- package/dist/src/interpolate.js +1 -1
- package/dist/src/interpolate.js.map +1 -1
- package/dist/src/lattice.d.ts +1 -1
- package/dist/src/lattice.d.ts.map +1 -1
- package/dist/src/local-files.d.ts +129 -0
- package/dist/src/local-files.d.ts.map +1 -0
- package/dist/src/local-files.js +327 -0
- package/dist/src/local-files.js.map +1 -0
- package/dist/src/morph-animation.d.ts +1 -1
- package/dist/src/morph-animation.d.ts.map +1 -1
- package/dist/src/morph-animation.js +2 -2
- package/dist/src/morph-animation.js.map +1 -1
- package/dist/src/peano-fourier/fourier-shared.d.ts +1 -1
- package/dist/src/peano-fourier/fourier-shared.d.ts.map +1 -1
- package/dist/src/peano-fourier/fourier-shared.js +17 -4
- package/dist/src/peano-fourier/fourier-shared.js.map +1 -1
- package/dist/src/schedule-helper.d.ts +4 -4
- package/dist/src/schedule-helper.d.ts.map +1 -1
- package/dist/src/schedule-helper.js +2 -2
- package/dist/src/schedule-helper.js.map +1 -1
- package/dist/src/showable.d.ts +36 -4
- package/dist/src/showable.d.ts.map +1 -1
- package/dist/src/showable.js +37 -1
- package/dist/src/showable.js.map +1 -1
- package/dist/src/slide-components/arrow.d.ts +4 -4
- package/dist/src/slide-components/arrow.d.ts.map +1 -1
- package/dist/src/slide-components/arrow.js +2 -2
- package/dist/src/slide-components/arrow.js.map +1 -1
- package/dist/src/slide-components/cross-fade-transition.d.ts +3 -3
- package/dist/src/slide-components/cross-fade-transition.d.ts.map +1 -1
- package/dist/src/slide-components/cross-fade-transition.js +3 -3
- package/dist/src/slide-components/cross-fade-transition.js.map +1 -1
- package/dist/src/slide-components/duration-agnostic.d.ts +3 -3
- package/dist/src/slide-components/duration-agnostic.d.ts.map +1 -1
- package/dist/src/slide-components/duration-agnostic.js +1 -1
- package/dist/src/slide-components/duration-agnostic.js.map +1 -1
- package/dist/src/slide-components/fixed-duration.d.ts +1 -1
- package/dist/src/slide-components/fixed-duration.d.ts.map +1 -1
- package/dist/src/slide-components/fixed-duration.js +1 -1
- package/dist/src/slide-components/fixed-duration.js.map +1 -1
- package/dist/src/slide-components/fourier.d.ts +6 -6
- package/dist/src/slide-components/fourier.d.ts.map +1 -1
- package/dist/src/slide-components/fourier.js +6 -6
- package/dist/src/slide-components/fourier.js.map +1 -1
- package/dist/src/slide-components/frame-counter.d.ts +2 -2
- package/dist/src/slide-components/frame-counter.d.ts.map +1 -1
- package/dist/src/slide-components/frame-counter.js +1 -1
- package/dist/src/slide-components/frame-counter.js.map +1 -1
- package/dist/src/slide-components/function-graph.d.ts +2 -2
- package/dist/src/slide-components/function-graph.d.ts.map +1 -1
- package/dist/src/slide-components/function-graph.js +3 -3
- package/dist/src/slide-components/function-graph.js.map +1 -1
- package/dist/src/slide-components/halftone-shadow.d.ts +4 -4
- package/dist/src/slide-components/halftone-shadow.d.ts.map +1 -1
- package/dist/src/slide-components/halftone-shadow.js +2 -2
- package/dist/src/slide-components/halftone-shadow.js.map +1 -1
- package/dist/src/slide-components/handwriting-effect.d.ts +5 -5
- package/dist/src/slide-components/handwriting-effect.d.ts.map +1 -1
- package/dist/src/slide-components/handwriting-effect.js +5 -5
- package/dist/src/slide-components/handwriting-effect.js.map +1 -1
- package/dist/src/slide-components/hold.d.ts +3 -3
- package/dist/src/slide-components/hold.d.ts.map +1 -1
- package/dist/src/slide-components/hold.js +3 -3
- package/dist/src/slide-components/hold.js.map +1 -1
- package/dist/src/slide-components/image.d.ts +3 -3
- package/dist/src/slide-components/image.d.ts.map +1 -1
- package/dist/src/slide-components/image.js +3 -3
- package/dist/src/slide-components/image.js.map +1 -1
- package/dist/src/slide-components/in-parallel.d.ts +3 -3
- package/dist/src/slide-components/in-parallel.d.ts.map +1 -1
- package/dist/src/slide-components/in-parallel.js +2 -2
- package/dist/src/slide-components/in-parallel.js.map +1 -1
- package/dist/src/slide-components/in-series.d.ts +4 -4
- package/dist/src/slide-components/in-series.d.ts.map +1 -1
- package/dist/src/slide-components/in-series.js +5 -1
- package/dist/src/slide-components/in-series.js.map +1 -1
- package/dist/src/slide-components/live-duration.d.ts +1 -1
- package/dist/src/slide-components/live-duration.d.ts.map +1 -1
- package/dist/src/slide-components/live-duration.js +1 -1
- package/dist/src/slide-components/live-duration.js.map +1 -1
- package/dist/src/slide-components/multi-text.d.ts +76 -15
- package/dist/src/slide-components/multi-text.d.ts.map +1 -1
- package/dist/src/slide-components/multi-text.js +170 -25
- package/dist/src/slide-components/multi-text.js.map +1 -1
- package/dist/src/slide-components/rectangle.d.ts +3 -3
- package/dist/src/slide-components/rectangle.d.ts.map +1 -1
- package/dist/src/slide-components/rectangle.js +1 -1
- package/dist/src/slide-components/rectangle.js.map +1 -1
- package/dist/src/slide-components/registry.d.ts +1 -1
- package/dist/src/slide-components/registry.d.ts.map +1 -1
- package/dist/src/slide-components/registry.js +18 -18
- package/dist/src/slide-components/registry.js.map +1 -1
- package/dist/src/slide-components/serialize.d.ts +1 -1
- package/dist/src/slide-components/serialize.d.ts.map +1 -1
- package/dist/src/slide-components/serialize.js +2 -2
- package/dist/src/slide-components/serialize.js.map +1 -1
- package/dist/src/slide-components/show-error.js +2 -2
- package/dist/src/slide-components/show-error.js.map +1 -1
- package/dist/src/slide-components/simple-text.d.ts +4 -4
- package/dist/src/slide-components/simple-text.d.ts.map +1 -1
- package/dist/src/slide-components/simple-text.js +4 -4
- package/dist/src/slide-components/simple-text.js.map +1 -1
- package/dist/src/slide-components/slide-component.d.ts +5 -5
- package/dist/src/slide-components/slide-component.d.ts.map +1 -1
- package/dist/src/slide-components/slide-component.js +4 -4
- package/dist/src/slide-components/slide-component.js.map +1 -1
- package/dist/src/slide-components/slide-left.d.ts +3 -3
- package/dist/src/slide-components/slide-left.d.ts.map +1 -1
- package/dist/src/slide-components/slide-left.js +3 -3
- package/dist/src/slide-components/slide-left.js.map +1 -1
- package/dist/src/slide-components/split-video-clip.d.ts +2 -2
- package/dist/src/slide-components/split-video-clip.d.ts.map +1 -1
- package/dist/src/slide-components/split-video-clip.js +3 -3
- package/dist/src/slide-components/split-video-clip.js.map +1 -1
- package/dist/src/slide-components/text-effect.d.ts +2 -2
- package/dist/src/slide-components/text-effect.d.ts.map +1 -1
- package/dist/src/slide-components/traditional-text.d.ts +4 -4
- package/dist/src/slide-components/traditional-text.d.ts.map +1 -1
- package/dist/src/slide-components/traditional-text.js +3 -3
- package/dist/src/slide-components/traditional-text.js.map +1 -1
- package/dist/src/slide-components/video-clip.d.ts +17 -5
- package/dist/src/slide-components/video-clip.d.ts.map +1 -1
- package/dist/src/slide-components/video-clip.js +52 -11
- package/dist/src/slide-components/video-clip.js.map +1 -1
- package/dist/src/slide-components/video-info.d.ts +11 -11
- package/dist/src/slide-components/video-info.d.ts.map +1 -1
- package/dist/src/slide-components/video-info.js +32 -21
- package/dist/src/slide-components/video-info.js.map +1 -1
- package/dist/src/slow-image-sources.d.ts +7 -1
- package/dist/src/slow-image-sources.d.ts.map +1 -1
- package/dist/src/slow-image-sources.js +36 -5
- package/dist/src/slow-image-sources.js.map +1 -1
- package/dist/src/snapshot.d.ts +2 -2
- package/dist/src/snapshot.d.ts.map +1 -1
- package/dist/src/snapshot.js +4 -4
- package/dist/src/snapshot.js.map +1 -1
- package/dist/src/stroke-colors.d.ts +1 -1
- package/dist/src/stroke-colors.d.ts.map +1 -1
- package/dist/src/stroke-colors.js +4 -4
- package/dist/src/stroke-colors.js.map +1 -1
- package/dist/src/utility.d.ts +3 -4
- package/dist/src/utility.d.ts.map +1 -1
- package/dist/src/utility.js +4 -4
- package/dist/src/utility.js.map +1 -1
- package/lib/index.ts +3 -0
- package/lib/main-control.ts +119 -12
- package/package.json +7 -5
- package/src/binary-search.ts +2 -2
- package/src/corner-rounder.ts +128 -0
- package/src/cross-fade.ts +3 -3
- package/src/fancy-text.ts +255 -0
- package/src/glib/letters-base.ts +4 -3
- package/src/glib/line-font.ts +2 -2
- package/src/glib/paragraph-layout.ts +2 -2
- package/src/glib/path-shape-splitter.ts +1 -1
- package/src/glib/path-shape.ts +2 -2
- package/src/interpolate.ts +3 -3
- package/src/lattice.ts +1 -1
- package/src/local-files.ts +389 -0
- package/src/morph-animation.ts +2 -2
- package/src/peano-fourier/fourier-shared.ts +17 -4
- package/src/schedule-helper.ts +4 -4
- package/src/showable.ts +54 -4
- package/src/slide-components/arrow.ts +4 -4
- package/src/slide-components/cross-fade-transition.ts +4 -4
- package/src/slide-components/duration-agnostic.ts +3 -3
- package/src/slide-components/fixed-duration.ts +1 -1
- package/src/slide-components/fourier.ts +9 -9
- package/src/slide-components/frame-counter.ts +2 -2
- package/src/slide-components/function-graph.ts +4 -4
- package/src/slide-components/halftone-shadow.ts +4 -4
- package/src/slide-components/handwriting-effect.ts +7 -7
- package/src/slide-components/hold.ts +4 -4
- package/src/slide-components/image.ts +5 -5
- package/src/slide-components/in-parallel.ts +4 -4
- package/src/slide-components/in-series.ts +7 -4
- package/src/slide-components/live-duration.ts +1 -1
- package/src/slide-components/multi-text.ts +195 -30
- package/src/slide-components/rectangle.ts +3 -3
- package/src/slide-components/registry.ts +19 -19
- package/src/slide-components/serialize.ts +2 -2
- package/src/slide-components/show-error.ts +2 -2
- package/src/slide-components/simple-text.ts +7 -7
- package/src/slide-components/slide-component.ts +7 -7
- package/src/slide-components/slide-left.ts +4 -4
- package/src/slide-components/split-video-clip.ts +4 -4
- package/src/slide-components/text-effect.ts +2 -2
- package/src/slide-components/traditional-text.ts +5 -5
- package/src/slide-components/video-clip.ts +64 -13
- package/src/slide-components/video-info.ts +33 -21
- package/src/slow-image-sources.ts +38 -6
- package/src/snapshot.ts +4 -4
- package/src/stroke-colors.ts +4 -4
- package/src/utility.ts +5 -5
package/dev/player-body.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Originally generated from canvas-recorder's canvas-recorder.html. This is the master copy now.
|
|
2
2
|
|
|
3
3
|
/** The contents of the player's `<body>`. {@link canvasRecorder.start} puts this in the page. */
|
|
4
4
|
export const playerBodyHtml = `
|
|
@@ -16,6 +16,29 @@ export const playerBodyHtml = `
|
|
|
16
16
|
<option value="2.00">200%</option>
|
|
17
17
|
</select>
|
|
18
18
|
</label>
|
|
19
|
+
<span
|
|
20
|
+
id="videoSizeControls"
|
|
21
|
+
style="white-space: nowrap"
|
|
22
|
+
title="The size of the video. Pixels: the saved file. Units: the coordinates everything is drawn in. Remembered for this video."
|
|
23
|
+
>Size:
|
|
24
|
+
<input type="number" id="videoPixelWidth" min="2" step="2" style="width: 4.5em" />
|
|
25
|
+
×
|
|
26
|
+
<input type="number" id="videoPixelHeight" min="2" step="2" style="width: 4.5em" />
|
|
27
|
+
px,
|
|
28
|
+
<input type="number" id="videoUnitWidth" min="0" step="any" style="width: 3.5em" />
|
|
29
|
+
×
|
|
30
|
+
<input type="number" id="videoUnitHeight" min="0" step="any" style="width: 3.5em" />
|
|
31
|
+
units
|
|
32
|
+
<span id="videoSizeWarning" style="color: #a06000"></span>
|
|
33
|
+
</span>
|
|
34
|
+
<button
|
|
35
|
+
type="button"
|
|
36
|
+
id="localFilesBtn"
|
|
37
|
+
hidden
|
|
38
|
+
title="Some of this video's files are on your computer, and the browser needs your OK before it reads them again."
|
|
39
|
+
>
|
|
40
|
+
🔓 Allow local files
|
|
41
|
+
</button>
|
|
19
42
|
<button type="button" id="loadJsonTestBtn">📂 Import</button>
|
|
20
43
|
<!-- Each status is outside its label: clicking inside a label
|
|
21
44
|
toggles the checkbox, and a status can hold buttons. -->
|
|
@@ -100,7 +123,12 @@ export const playerBodyHtml = `
|
|
|
100
123
|
/>Repeat</label
|
|
101
124
|
>) </span
|
|
102
125
|
>
|
|
103
|
-
<input
|
|
126
|
+
<input
|
|
127
|
+
type="number"
|
|
128
|
+
id="playPositionSeconds"
|
|
129
|
+
value="0"
|
|
130
|
+
title="The play position, in seconds. Option-← and Option-→ step one frame."
|
|
131
|
+
/>
|
|
104
132
|
<input type="range" id="playPositionRange" value="0" step="any" />
|
|
105
133
|
</div>
|
|
106
134
|
</fieldset>
|
|
@@ -177,10 +205,16 @@ export const playerBodyHtml = `
|
|
|
177
205
|
<button id="recordJustSound">Record Just Sound</button>
|
|
178
206
|
<div id="info"><i>status goes here</i>...</div>
|
|
179
207
|
</div>
|
|
180
|
-
<
|
|
181
|
-
Hot keys:
|
|
182
|
-
|
|
183
|
-
|
|
208
|
+
<div style="margin: 1em 0">
|
|
209
|
+
Hot keys:
|
|
210
|
+
<ul style="margin: 0">
|
|
211
|
+
<li>⌥Space to play or pause.</li>
|
|
212
|
+
<li>⌥B to go back 5 seconds and play.</li>
|
|
213
|
+
<li>⌥0 to jump to the start of the current section.</li>
|
|
214
|
+
<li>⌥← and ⌥→ to step one frame back or forward.</li>
|
|
215
|
+
</ul>
|
|
216
|
+
Alt instead of ⌥ on a PC.
|
|
217
|
+
</div>
|
|
184
218
|
<br />
|
|
185
219
|
<h1>Debug Log</h1>
|
|
186
220
|
<button id="debugLogClearBtn" type="button">Clear</button>
|
|
@@ -343,6 +377,44 @@ export const playerBodyHtml = `
|
|
|
343
377
|
/>
|
|
344
378
|
</label>
|
|
345
379
|
</div>
|
|
380
|
+
<div style="margin-bottom: 0.6em">
|
|
381
|
+
<label
|
|
382
|
+
>Size:
|
|
383
|
+
<input
|
|
384
|
+
type="number"
|
|
385
|
+
id="saveWidth"
|
|
386
|
+
min="2"
|
|
387
|
+
step="2"
|
|
388
|
+
style="width: 6em"
|
|
389
|
+
/>
|
|
390
|
+
</label>
|
|
391
|
+
×
|
|
392
|
+
<label
|
|
393
|
+
><input
|
|
394
|
+
type="number"
|
|
395
|
+
id="saveHeight"
|
|
396
|
+
min="2"
|
|
397
|
+
step="2"
|
|
398
|
+
style="width: 6em"
|
|
399
|
+
/>
|
|
400
|
+
px</label
|
|
401
|
+
>
|
|
402
|
+
|
|
403
|
+
<label
|
|
404
|
+
title="Change the other number to match, keeping the video's shape. Uncheck to stretch or squish the picture."
|
|
405
|
+
><input type="checkbox" id="saveKeepAspect" checked /> Keep aspect
|
|
406
|
+
ratio</label
|
|
407
|
+
>
|
|
408
|
+
|
|
409
|
+
<button
|
|
410
|
+
type="button"
|
|
411
|
+
id="saveVideoSizeBtn"
|
|
412
|
+
title="Use the video's own size."
|
|
413
|
+
>
|
|
414
|
+
Video size
|
|
415
|
+
</button>
|
|
416
|
+
<div id="saveSizeNote" style="font-size: 0.85em; min-height: 1.2em"></div>
|
|
417
|
+
</div>
|
|
346
418
|
<table style="margin-bottom: 0.75em; border-collapse: collapse">
|
|
347
419
|
<tr>
|
|
348
420
|
<td>Start:</td>
|
|
@@ -373,6 +445,14 @@ export const playerBodyHtml = `
|
|
|
373
445
|
></td>
|
|
374
446
|
</tr>
|
|
375
447
|
</table>
|
|
448
|
+
<div
|
|
449
|
+
id="saveLocalFilesRow"
|
|
450
|
+
hidden
|
|
451
|
+
style="margin-bottom: 0.6em; color: #a06000"
|
|
452
|
+
>
|
|
453
|
+
<span id="saveLocalFilesNote"></span>
|
|
454
|
+
<button type="button" id="saveLocalFilesBtn">🔓 Allow</button>
|
|
455
|
+
</div>
|
|
376
456
|
<div>
|
|
377
457
|
<button type="button" id="saveOkBtn">OK — Choose File</button>
|
|
378
458
|
|
package/dev/rect-snap.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { ReadOnlyRect } from "phil-lib/misc";
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
canvasHeightUnits,
|
|
4
|
+
canvasWidthUnits,
|
|
5
5
|
} from "../src/slide-components/video-info.ts";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* One button that moves or stretches a rectangle to the canvas.
|
|
9
9
|
*
|
|
10
|
-
* The canvas is taken to be the
|
|
10
|
+
* The canvas is taken to be the whole drawing area (see canvasRecorder.width), which is true
|
|
11
11
|
* unless it sits inside a transformed parent like a Slide.
|
|
12
12
|
*/
|
|
13
13
|
export type RectSnap = {
|
|
@@ -28,12 +28,12 @@ export const ALIGN_HORIZONTALLY: readonly RectSnap[] = [
|
|
|
28
28
|
{
|
|
29
29
|
text: "⇆",
|
|
30
30
|
title: "Center horizontally on the canvas",
|
|
31
|
-
place: (r) => ({ ...r, x: (
|
|
31
|
+
place: (r) => ({ ...r, x: (canvasWidthUnits() - r.width) / 2 }),
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
text: "⇥",
|
|
35
35
|
title: "Move the right edge to the right of the canvas",
|
|
36
|
-
place: (r) => ({ ...r, x:
|
|
36
|
+
place: (r) => ({ ...r, x: canvasWidthUnits() - r.width }),
|
|
37
37
|
},
|
|
38
38
|
];
|
|
39
39
|
|
|
@@ -47,12 +47,12 @@ export const ALIGN_VERTICALLY: readonly RectSnap[] = [
|
|
|
47
47
|
{
|
|
48
48
|
text: "⇵",
|
|
49
49
|
title: "Center vertically on the canvas",
|
|
50
|
-
place: (r) => ({ ...r, y: (
|
|
50
|
+
place: (r) => ({ ...r, y: (canvasHeightUnits() - r.height) / 2 }),
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
53
|
text: "⤓",
|
|
54
54
|
title: "Move the bottom edge to the bottom of the canvas",
|
|
55
|
-
place: (r) => ({ ...r, y:
|
|
55
|
+
place: (r) => ({ ...r, y: canvasHeightUnits() - r.height }),
|
|
56
56
|
},
|
|
57
57
|
];
|
|
58
58
|
|
|
@@ -61,12 +61,12 @@ export const STRETCH_TO_CANVAS: readonly RectSnap[] = [
|
|
|
61
61
|
{
|
|
62
62
|
text: "↔",
|
|
63
63
|
title: "Stretch across the full width of the canvas",
|
|
64
|
-
place: (r) => ({ ...r, x: 0, width:
|
|
64
|
+
place: (r) => ({ ...r, x: 0, width: canvasWidthUnits() }),
|
|
65
65
|
},
|
|
66
66
|
{
|
|
67
67
|
text: "↕",
|
|
68
68
|
title: "Stretch across the full height of the canvas",
|
|
69
|
-
place: (r) => ({ ...r, y: 0, height:
|
|
69
|
+
place: (r) => ({ ...r, y: 0, height: canvasHeightUnits() }),
|
|
70
70
|
},
|
|
71
71
|
];
|
|
72
72
|
|
package/dev/slide-panel.ts
CHANGED
package/dev/split-dialog.ts
CHANGED
|
@@ -395,9 +395,17 @@ export function askHowToSplitSound(options: {
|
|
|
395
395
|
// MARK: Behavior
|
|
396
396
|
const inside = (atMs: number) => atMs > 0 && atMs < lengthMs;
|
|
397
397
|
|
|
398
|
-
/**
|
|
398
|
+
/**
|
|
399
|
+
* `atMs`, moved to the nearest quiet moment between words if it's in the middle of one.
|
|
400
|
+
*
|
|
401
|
+
* Anywhere between one word's `cutAfterMs` and the next word's `cutBeforeMs` is already quiet,
|
|
402
|
+
* so a split there stays where it is. Snapping out of a long pause moved a split a whole second.
|
|
403
|
+
*/
|
|
399
404
|
function snapped(atMs: number): number {
|
|
400
405
|
if (!snapInput.checked || !words?.length) return atMs;
|
|
406
|
+
const fileMs = startMsIntoClip + atMs;
|
|
407
|
+
const inWord = words.some((w) => w.cutBeforeMs < fileMs && fileMs < w.cutAfterMs);
|
|
408
|
+
if (!inWord) return atMs;
|
|
401
409
|
let best = atMs;
|
|
402
410
|
let bestDistance = Infinity;
|
|
403
411
|
for (const word of words) {
|
|
@@ -448,8 +456,11 @@ export function askHowToSplitSound(options: {
|
|
|
448
456
|
return;
|
|
449
457
|
}
|
|
450
458
|
const moved = Math.abs(atMs - typed) > 0.05;
|
|
459
|
+
const direction = atMs < typed ? "earlier" : "later";
|
|
451
460
|
whereNote.textContent =
|
|
452
|
-
(moved
|
|
461
|
+
(moved
|
|
462
|
+
? `Snapped to ${Math.round(atMs)} ms, ${Math.round(Math.abs(atMs - typed))} ms ${direction}.`
|
|
463
|
+
: "") + aroundWords(atMs);
|
|
453
464
|
whereNote.style.color = whereNote.textContent.includes("⚠") ? "#a06000" : "#555";
|
|
454
465
|
|
|
455
466
|
const kept = keep();
|
|
@@ -5,16 +5,20 @@ import {
|
|
|
5
5
|
centeredOnCanvas,
|
|
6
6
|
maxFit,
|
|
7
7
|
minCover,
|
|
8
|
-
|
|
8
|
+
pixelsPerUnit,
|
|
9
9
|
preservePixels,
|
|
10
10
|
sameCenter,
|
|
11
11
|
shrinkToAspect,
|
|
12
12
|
} from "../src/slide-components/video-info.ts";
|
|
13
13
|
import { SingleImage } from "../src/slow-image-sources.ts";
|
|
14
14
|
import { ALIGN_HORIZONTALLY, ALIGN_VERTICALLY, buildSnapRow } from "./rect-snap.ts";
|
|
15
|
+
import { buildLocalFileRow } from "./local-file-row.ts";
|
|
16
|
+
import { IMAGE_FILE_TYPES, onLocalFilesChange } from "../src/local-files.ts";
|
|
15
17
|
|
|
16
18
|
/** What the panel needs from the Visual Editor. It never reaches into canvas-recorder.ts directly. */
|
|
17
19
|
export type StaticImagePanelHooks = {
|
|
20
|
+
/** The URL was changed by a button here. Save, and rebuild the schedule editor so the URL field shows it. */
|
|
21
|
+
readonly urlChanged: () => void;
|
|
18
22
|
/** A Dest Rect keyframe's value was replaced. Sync its number fields and on-canvas handles, and save. */
|
|
19
23
|
readonly rectKeyframeChanged: (keyframe: Keyframe<ReadOnlyRect>) => void;
|
|
20
24
|
/** The Dest Rect keyframe in ✎ edit mode, if there is one. */
|
|
@@ -51,6 +55,23 @@ export function buildStaticImagePanel(
|
|
|
51
55
|
legend.textContent = "Image File";
|
|
52
56
|
panel.append(legend);
|
|
53
57
|
|
|
58
|
+
panel.append(
|
|
59
|
+
buildLocalFileRow({
|
|
60
|
+
types: IMAGE_FILE_TYPES,
|
|
61
|
+
pickerId: "images",
|
|
62
|
+
startIn: "pictures",
|
|
63
|
+
currentUrl: () => component.urlSchedule.at(0),
|
|
64
|
+
choose(url) {
|
|
65
|
+
if (component.urlSchedule.schedule.length > 1) {
|
|
66
|
+
alert("URL has several keyframes. Type the file's URL into the one you want.\n\n" + url);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
component.urlSchedule.set(url);
|
|
70
|
+
hooks.urlChanged();
|
|
71
|
+
},
|
|
72
|
+
}),
|
|
73
|
+
);
|
|
74
|
+
|
|
54
75
|
const line = (parent: HTMLElement, cssText = "") => {
|
|
55
76
|
const div = document.createElement("div");
|
|
56
77
|
div.style.cssText = cssText;
|
|
@@ -75,7 +96,7 @@ export function buildStaticImagePanel(
|
|
|
75
96
|
const rectButtons = [
|
|
76
97
|
{
|
|
77
98
|
text: "Fit canvas",
|
|
78
|
-
title: "As large as possible while the whole image stays on the
|
|
99
|
+
title: "As large as possible while the whole image stays on the canvas. Centered.",
|
|
79
100
|
make: (size: Size) => centeredOnCanvas(maxFit(size.width, size.height)),
|
|
80
101
|
},
|
|
81
102
|
{
|
|
@@ -85,7 +106,7 @@ export function buildStaticImagePanel(
|
|
|
85
106
|
},
|
|
86
107
|
{
|
|
87
108
|
text: "Native pixels",
|
|
88
|
-
title: `One image pixel per output pixel at ${
|
|
109
|
+
title: `One image pixel per output pixel at ${pixelsPerUnit()} px/unit — pixel perfect. Keeps the rectangle's center.`,
|
|
89
110
|
make: (size: Size, rect: ReadOnlyRect) =>
|
|
90
111
|
sameCenter(preservePixels(size.width, size.height), rect),
|
|
91
112
|
},
|
|
@@ -156,7 +177,7 @@ export function buildStaticImagePanel(
|
|
|
156
177
|
// native resolution. Above 1 the image is being upscaled.
|
|
157
178
|
const ratios = component.destRectSchedule.schedule.map(({ value }) => {
|
|
158
179
|
const drawn = shrinkToAspect(value, size.width / size.height);
|
|
159
|
-
return (drawn.width *
|
|
180
|
+
return (drawn.width * pixelsPerUnit()) / size.width;
|
|
160
181
|
});
|
|
161
182
|
const lo = Math.min(...ratios);
|
|
162
183
|
const hi = Math.max(...ratios);
|
|
@@ -196,7 +217,7 @@ export function buildStaticImagePanel(
|
|
|
196
217
|
const url = component.urlSchedule.at(
|
|
197
218
|
typeof target === "string" ? 0 : target.time,
|
|
198
219
|
);
|
|
199
|
-
if (url === (image?.url ?? "")) {
|
|
220
|
+
if (url === (image?.url ?? "") && !image?.worthRetrying) {
|
|
200
221
|
// Same file. Only the Dest Rect may have changed.
|
|
201
222
|
draw();
|
|
202
223
|
return;
|
|
@@ -242,6 +263,15 @@ export function buildStaticImagePanel(
|
|
|
242
263
|
});
|
|
243
264
|
}
|
|
244
265
|
|
|
266
|
+
// Permission granted, or a file picked again: a file that failed may open now.
|
|
267
|
+
const stopListening = onLocalFilesChange(() => {
|
|
268
|
+
if (!panel.isConnected) {
|
|
269
|
+
stopListening();
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
refresh();
|
|
273
|
+
});
|
|
274
|
+
|
|
245
275
|
refresh();
|
|
246
276
|
return {
|
|
247
277
|
element: panel,
|
package/dev/timeline-display.ts
CHANGED
|
@@ -138,11 +138,33 @@ export class TimelineDisplay {
|
|
|
138
138
|
|
|
139
139
|
// ── public API ─────────────────────────────────────────────────────────────
|
|
140
140
|
|
|
141
|
-
/**
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
141
|
+
/** The chapter last passed to {@link setChapter}. */
|
|
142
|
+
private _chapter: object | undefined;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Call whenever the chapter, or its length, may have changed.
|
|
146
|
+
*
|
|
147
|
+
* A different chapter shows all of itself.
|
|
148
|
+
* The same chapter keeps the user's zoom and pan, so an edit like ✂ Split doesn't undo them.
|
|
149
|
+
* The exception: a view that showed the whole chapter keeps showing the whole chapter.
|
|
150
|
+
* @param chapter The chapter, by identity.
|
|
151
|
+
* @param durationMs Its length now.
|
|
152
|
+
*/
|
|
153
|
+
setChapter(chapter: object, durationMs: number): void {
|
|
154
|
+
const newDurationMs = Math.max(durationMs, 1);
|
|
155
|
+
const showingAll =
|
|
156
|
+
this._viewStartMs <= 0 && this._viewEndMs >= this._durationMs;
|
|
157
|
+
if (chapter !== this._chapter || showingAll) {
|
|
158
|
+
this._viewStartMs = 0;
|
|
159
|
+
this._viewEndMs = newDurationMs;
|
|
160
|
+
} else if (this._viewStartMs >= newDurationMs) {
|
|
161
|
+
// The chapter got shorter than where the view starts. Keep the zoom; show its end.
|
|
162
|
+
const span = this._viewEndMs - this._viewStartMs;
|
|
163
|
+
this._viewStartMs = Math.max(0, newDurationMs - span);
|
|
164
|
+
this._viewEndMs = this._viewStartMs + span;
|
|
165
|
+
}
|
|
166
|
+
this._chapter = chapter;
|
|
167
|
+
this._durationMs = newDurationMs;
|
|
146
168
|
this._draw();
|
|
147
169
|
}
|
|
148
170
|
|
|
@@ -180,6 +202,24 @@ export class TimelineDisplay {
|
|
|
180
202
|
this._draw();
|
|
181
203
|
}
|
|
182
204
|
|
|
205
|
+
/**
|
|
206
|
+
* An edit just moved the play head, like ✂ Split keeping only the second piece.
|
|
207
|
+
*
|
|
208
|
+
* If that took it off screen, bring it back the same way playback does: jump so it's at the
|
|
209
|
+
* left edge, keeping the zoom. If it was already off screen, the user put it there, so the
|
|
210
|
+
* view stays where it is.
|
|
211
|
+
* @param localMs The play head's new time, from the start of the chapter.
|
|
212
|
+
*/
|
|
213
|
+
movePlayMs(localMs: number): void {
|
|
214
|
+
const wasVisible = this._playheadVisible();
|
|
215
|
+
this._playLocalMs = localMs;
|
|
216
|
+
if (wasVisible && !this._interacting && !this._playheadVisible()) {
|
|
217
|
+
this._jumpToPlayhead();
|
|
218
|
+
}
|
|
219
|
+
this._wasPlayheadVisible = this._playheadVisible();
|
|
220
|
+
this._draw();
|
|
221
|
+
}
|
|
222
|
+
|
|
183
223
|
/**
|
|
184
224
|
* The user just panned or zoomed. If that took the play head off screen,
|
|
185
225
|
* that was their choice: don't follow it until it comes back into view.
|
|
@@ -210,6 +250,11 @@ export class TimelineDisplay {
|
|
|
210
250
|
if (this._interacting || this._playheadVisible()) return;
|
|
211
251
|
const justStarted = !this._wasFollowing;
|
|
212
252
|
if (!this._wasPlayheadVisible && !justStarted) return;
|
|
253
|
+
this._jumpToPlayhead();
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
/** Put the play head at the left edge, keeping the zoom. Near the end, show the end instead. */
|
|
257
|
+
private _jumpToPlayhead(): void {
|
|
213
258
|
const span = this._viewEndMs - this._viewStartMs;
|
|
214
259
|
const start = Math.max(
|
|
215
260
|
0,
|
package/dev/transcripts.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { debugLog } from "../src/debug-log.ts";
|
|
2
|
+
import { fetchMedia } from "../src/local-files.ts";
|
|
2
3
|
import {
|
|
3
4
|
Device,
|
|
4
5
|
MODELS,
|
|
@@ -221,7 +222,7 @@ export async function makeTranscript(
|
|
|
221
222
|
|
|
222
223
|
/** The file at `url` as 16 kHz mono, the way the models want it. */
|
|
223
224
|
async function decode(url: string): Promise<Float32Array> {
|
|
224
|
-
const response = await
|
|
225
|
+
const response = await fetchMedia(url);
|
|
225
226
|
if (!response.ok) throw new Error(`${response.status} ${response.statusText}`);
|
|
226
227
|
// decodeAudioData resamples to its context's rate, which does the 16 kHz part.
|
|
227
228
|
const context = new OfflineAudioContext(1, 1, SAMPLE_RATE);
|
|
@@ -305,13 +306,14 @@ type CacheRecord = Transcript & { readonly key: string; readonly url: string };
|
|
|
305
306
|
async function cacheKey(url: string): Promise<string> {
|
|
306
307
|
const absolute = new URL(url, location.href).href;
|
|
307
308
|
const prefix = `${PIPELINE_VERSION}|${MODELS.whisper}|${absolute}|`;
|
|
308
|
-
|
|
309
|
+
// For a local file, fetchMedia() answers with its size and modification time.
|
|
310
|
+
const head = await fetchMedia(url, { method: "HEAD", cache: "no-cache" });
|
|
309
311
|
const etag = head.headers.get("etag");
|
|
310
312
|
const modified = head.headers.get("last-modified");
|
|
311
313
|
const length = head.headers.get("content-length");
|
|
312
314
|
if (etag) return prefix + etag;
|
|
313
315
|
if (modified && length) return `${prefix}${modified} ${length}`;
|
|
314
|
-
const bytes = await (await
|
|
316
|
+
const bytes = await (await fetchMedia(url)).arrayBuffer();
|
|
315
317
|
const digest = new Uint8Array(await crypto.subtle.digest("SHA-256", bytes));
|
|
316
318
|
return prefix + Array.from(digest, (b) => b.toString(16).padStart(2, "0")).join("");
|
|
317
319
|
}
|