canvas-recorder-lib 0.8.1 → 0.8.4
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/README.md +10 -2
- package/dev/canvas-recorder.css +20 -6
- package/dev/canvas-recorder.ts +389 -54
- package/dev/color-picker.ts +13 -0
- package/dev/component-picker.ts +60 -11
- package/dev/delay-files.ts +3 -1
- package/dev/font-widgets.ts +2 -2
- package/dev/format-editor.ts +3 -1
- package/dev/fourier-panel.ts +7 -3
- package/dev/handwriting-panel.ts +7 -7
- package/dev/multi-text-dialog.ts +28 -15
- package/dev/player-body.ts +78 -33
- package/dev/schedule-helpers.ts +10 -3
- package/dev/static-image-panel.ts +4 -4
- package/dev/subtitles.ts +170 -0
- package/dev/synced-file.ts +34 -0
- package/dev/timeline-display.ts +1 -1
- package/dev/transcribe-core.ts +7 -4
- package/dev/transcript-align.ts +24 -18
- package/dev/transcript-editor.ts +1187 -0
- package/dev/transcript-export.ts +90 -0
- package/dev/transcript-view.ts +8 -5
- package/dev/transcripts.ts +140 -15
- package/dev/video-clip-panel.ts +4 -4
- package/dist/dev/canvas-recorder.css +20 -6
- package/dist/dev/canvas-recorder.js +314 -48
- package/dist/dev/canvas-recorder.js.map +1 -1
- package/dist/dev/color-picker.d.ts.map +1 -1
- package/dist/dev/color-picker.js +15 -0
- package/dist/dev/color-picker.js.map +1 -1
- package/dist/dev/component-picker.d.ts +2 -1
- package/dist/dev/component-picker.d.ts.map +1 -1
- package/dist/dev/component-picker.js +56 -11
- package/dist/dev/component-picker.js.map +1 -1
- package/dist/dev/delay-files.d.ts.map +1 -1
- package/dist/dev/delay-files.js +3 -1
- package/dist/dev/delay-files.js.map +1 -1
- package/dist/dev/font-widgets.d.ts +2 -2
- package/dist/dev/font-widgets.d.ts.map +1 -1
- package/dist/dev/font-widgets.js.map +1 -1
- package/dist/dev/format-editor.d.ts.map +1 -1
- package/dist/dev/format-editor.js +3 -1
- package/dist/dev/format-editor.js.map +1 -1
- package/dist/dev/fourier-panel.d.ts.map +1 -1
- package/dist/dev/fourier-panel.js +4 -3
- package/dist/dev/fourier-panel.js.map +1 -1
- package/dist/dev/handwriting-panel.d.ts +4 -4
- package/dist/dev/handwriting-panel.d.ts.map +1 -1
- package/dist/dev/handwriting-panel.js.map +1 -1
- package/dist/dev/multi-text-dialog.d.ts.map +1 -1
- package/dist/dev/multi-text-dialog.js +23 -12
- package/dist/dev/multi-text-dialog.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 +78 -33
- package/dist/dev/player-body.js.map +1 -1
- package/dist/dev/schedule-helpers.d.ts.map +1 -1
- package/dist/dev/schedule-helpers.js +4 -2
- package/dist/dev/schedule-helpers.js.map +1 -1
- package/dist/dev/static-image-panel.d.ts +3 -3
- package/dist/dev/static-image-panel.d.ts.map +1 -1
- package/dist/dev/subtitles.d.ts +36 -0
- package/dist/dev/subtitles.d.ts.map +1 -0
- package/dist/dev/subtitles.js +135 -0
- package/dist/dev/subtitles.js.map +1 -0
- package/dist/dev/synced-file.d.ts +14 -0
- package/dist/dev/synced-file.d.ts.map +1 -1
- package/dist/dev/synced-file.js +22 -0
- package/dist/dev/synced-file.js.map +1 -1
- package/dist/dev/timeline-display.d.ts +5 -0
- package/dist/dev/timeline-display.d.ts.map +1 -1
- package/dist/dev/timeline-display.js +1 -1
- package/dist/dev/timeline-display.js.map +1 -1
- package/dist/dev/transcribe-core.d.ts.map +1 -1
- package/dist/dev/transcribe-core.js +7 -4
- package/dist/dev/transcribe-core.js.map +1 -1
- package/dist/dev/transcript-align.d.ts +6 -4
- package/dist/dev/transcript-align.d.ts.map +1 -1
- package/dist/dev/transcript-align.js +18 -13
- package/dist/dev/transcript-align.js.map +1 -1
- package/dist/dev/transcript-editor.d.ts +36 -0
- package/dist/dev/transcript-editor.d.ts.map +1 -0
- package/dist/dev/transcript-editor.js +948 -0
- package/dist/dev/transcript-editor.js.map +1 -0
- package/dist/dev/transcript-export.d.ts +21 -0
- package/dist/dev/transcript-export.d.ts.map +1 -1
- package/dist/dev/transcript-export.js +65 -0
- package/dist/dev/transcript-export.js.map +1 -1
- package/dist/dev/transcript-view.d.ts +2 -0
- package/dist/dev/transcript-view.d.ts.map +1 -1
- package/dist/dev/transcript-view.js +1 -1
- package/dist/dev/transcript-view.js.map +1 -1
- package/dist/dev/transcripts.d.ts +18 -1
- package/dist/dev/transcripts.d.ts.map +1 -1
- package/dist/dev/transcripts.js +102 -12
- package/dist/dev/transcripts.js.map +1 -1
- package/dist/dev/video-clip-panel.d.ts +3 -3
- package/dist/dev/video-clip-panel.d.ts.map +1 -1
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +1 -0
- package/dist/lib/index.js.map +1 -1
- package/dist/src/glib/line-font.d.ts +6 -0
- package/dist/src/glib/line-font.d.ts.map +1 -1
- package/dist/src/glib/line-font.js +9 -0
- package/dist/src/glib/line-font.js.map +1 -1
- package/dist/src/glib/path-shape.d.ts +23 -0
- package/dist/src/glib/path-shape.d.ts.map +1 -1
- package/dist/src/glib/path-shape.js +66 -221
- package/dist/src/glib/path-shape.js.map +1 -1
- package/dist/src/glib/svg-arc.d.ts +41 -0
- package/dist/src/glib/svg-arc.d.ts.map +1 -0
- package/dist/src/glib/svg-arc.js +114 -0
- package/dist/src/glib/svg-arc.js.map +1 -0
- package/dist/src/glib/svg-path-parser.d.ts +60 -0
- package/dist/src/glib/svg-path-parser.d.ts.map +1 -0
- package/dist/src/glib/svg-path-parser.js +258 -0
- package/dist/src/glib/svg-path-parser.js.map +1 -0
- package/dist/src/glib/transforms.d.ts +9 -0
- package/dist/src/glib/transforms.d.ts.map +1 -1
- package/dist/src/glib/transforms.js +7 -4
- package/dist/src/glib/transforms.js.map +1 -1
- package/dist/src/interpolate.d.ts +17 -10
- package/dist/src/interpolate.d.ts.map +1 -1
- package/dist/src/interpolate.js +1 -17
- package/dist/src/interpolate.js.map +1 -1
- package/dist/src/morph-animation.js +1 -1
- package/dist/src/morph-animation.js.map +1 -1
- package/dist/src/peano-fourier/fourier-shared.d.ts.map +1 -1
- package/dist/src/peano-fourier/fourier-shared.js +4 -2
- package/dist/src/peano-fourier/fourier-shared.js.map +1 -1
- package/dist/src/schedule-helper.d.ts +50 -28
- package/dist/src/schedule-helper.d.ts.map +1 -1
- package/dist/src/schedule-helper.js +22 -0
- package/dist/src/schedule-helper.js.map +1 -1
- package/dist/src/showable.d.ts +57 -10
- package/dist/src/showable.d.ts.map +1 -1
- package/dist/src/showable.js +19 -0
- 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/cross-fade-transition.d.ts +2 -1
- package/dist/src/slide-components/cross-fade-transition.d.ts.map +1 -1
- package/dist/src/slide-components/cross-fade-transition.js +2 -1
- package/dist/src/slide-components/cross-fade-transition.js.map +1 -1
- package/dist/src/slide-components/duration-agnostic.d.ts +3 -2
- package/dist/src/slide-components/duration-agnostic.d.ts.map +1 -1
- package/dist/src/slide-components/duration-agnostic.js +4 -2
- package/dist/src/slide-components/duration-agnostic.js.map +1 -1
- package/dist/src/slide-components/fixed-duration.d.ts +3 -1
- package/dist/src/slide-components/fixed-duration.d.ts.map +1 -1
- package/dist/src/slide-components/fixed-duration.js +4 -2
- package/dist/src/slide-components/fixed-duration.js.map +1 -1
- package/dist/src/slide-components/fourier.d.ts +19 -12
- package/dist/src/slide-components/fourier.d.ts.map +1 -1
- package/dist/src/slide-components/fourier.js +77 -16
- package/dist/src/slide-components/fourier.js.map +1 -1
- package/dist/src/slide-components/function-graph.d.ts +4 -3
- package/dist/src/slide-components/function-graph.d.ts.map +1 -1
- package/dist/src/slide-components/function-graph.js +6 -2
- package/dist/src/slide-components/function-graph.js.map +1 -1
- package/dist/src/slide-components/halftone-shadow.d.ts +8 -7
- package/dist/src/slide-components/halftone-shadow.d.ts.map +1 -1
- package/dist/src/slide-components/halftone-shadow.js +14 -10
- package/dist/src/slide-components/halftone-shadow.js.map +1 -1
- package/dist/src/slide-components/handwriting-effect.d.ts +8 -6
- package/dist/src/slide-components/handwriting-effect.d.ts.map +1 -1
- package/dist/src/slide-components/handwriting-effect.js +4 -2
- package/dist/src/slide-components/handwriting-effect.js.map +1 -1
- package/dist/src/slide-components/hold.d.ts +4 -2
- package/dist/src/slide-components/hold.d.ts.map +1 -1
- package/dist/src/slide-components/hold.js +4 -2
- package/dist/src/slide-components/hold.js.map +1 -1
- package/dist/src/slide-components/image.d.ts +7 -7
- package/dist/src/slide-components/image.d.ts.map +1 -1
- package/dist/src/slide-components/image.js +4 -2
- package/dist/src/slide-components/image.js.map +1 -1
- package/dist/src/slide-components/in-parallel.d.ts +6 -3
- package/dist/src/slide-components/in-parallel.d.ts.map +1 -1
- package/dist/src/slide-components/in-parallel.js +12 -2
- package/dist/src/slide-components/in-parallel.js.map +1 -1
- package/dist/src/slide-components/in-series.d.ts +2 -1
- package/dist/src/slide-components/in-series.d.ts.map +1 -1
- package/dist/src/slide-components/in-series.js +2 -1
- package/dist/src/slide-components/in-series.js.map +1 -1
- package/dist/src/slide-components/live-duration.d.ts +3 -1
- package/dist/src/slide-components/live-duration.d.ts.map +1 -1
- package/dist/src/slide-components/live-duration.js +4 -2
- package/dist/src/slide-components/live-duration.js.map +1 -1
- package/dist/src/slide-components/multi-text.d.ts +39 -26
- package/dist/src/slide-components/multi-text.d.ts.map +1 -1
- package/dist/src/slide-components/multi-text.js +44 -29
- package/dist/src/slide-components/multi-text.js.map +1 -1
- package/dist/src/slide-components/rectangle.d.ts +5 -4
- package/dist/src/slide-components/rectangle.d.ts.map +1 -1
- package/dist/src/slide-components/rectangle.js +2 -1
- package/dist/src/slide-components/rectangle.js.map +1 -1
- package/dist/src/slide-components/registry.d.ts +5 -0
- package/dist/src/slide-components/registry.d.ts.map +1 -1
- package/dist/src/slide-components/registry.js +28 -27
- package/dist/src/slide-components/registry.js.map +1 -1
- package/dist/src/slide-components/show-error.d.ts.map +1 -1
- package/dist/src/slide-components/show-error.js +12 -4
- package/dist/src/slide-components/show-error.js.map +1 -1
- package/dist/src/slide-components/simple-text.d.ts +11 -10
- package/dist/src/slide-components/simple-text.d.ts.map +1 -1
- package/dist/src/slide-components/simple-text.js +5 -3
- package/dist/src/slide-components/simple-text.js.map +1 -1
- package/dist/src/slide-components/slide-component.d.ts +14 -13
- package/dist/src/slide-components/slide-component.d.ts.map +1 -1
- package/dist/src/slide-components/slide-component.js +2 -1
- package/dist/src/slide-components/slide-component.js.map +1 -1
- package/dist/src/slide-components/slide-left.d.ts +2 -1
- package/dist/src/slide-components/slide-left.d.ts.map +1 -1
- package/dist/src/slide-components/slide-left.js +2 -1
- package/dist/src/slide-components/slide-left.js.map +1 -1
- package/dist/src/slide-components/text-effect.d.ts +9 -1
- package/dist/src/slide-components/text-effect.d.ts.map +1 -1
- package/dist/src/slide-components/text-effect.js.map +1 -1
- package/dist/src/slide-components/traditional-text.d.ts +8 -8
- package/dist/src/slide-components/traditional-text.d.ts.map +1 -1
- package/dist/src/slide-components/video-clip.d.ts +4 -3
- package/dist/src/slide-components/video-clip.d.ts.map +1 -1
- package/dist/src/slide-components/video-clip.js +2 -1
- package/dist/src/slide-components/video-clip.js.map +1 -1
- package/lib/index.ts +1 -0
- package/package.json +2 -2
- package/src/glib/line-font.ts +9 -0
- package/src/glib/path-shape.ts +101 -245
- package/src/glib/svg-arc.ts +141 -0
- package/src/glib/svg-path-parser.ts +308 -0
- package/src/glib/transforms.ts +7 -4
- package/src/interpolate.ts +18 -27
- package/src/morph-animation.ts +1 -1
- package/src/peano-fourier/fourier-shared.ts +4 -2
- package/src/schedule-helper.ts +50 -28
- package/src/showable.ts +79 -10
- package/src/slide-components/arrow.ts +4 -4
- package/src/slide-components/cross-fade-transition.ts +9 -2
- package/src/slide-components/duration-agnostic.ts +4 -3
- package/src/slide-components/fixed-duration.ts +4 -2
- package/src/slide-components/fourier.ts +98 -29
- package/src/slide-components/function-graph.ts +7 -3
- package/src/slide-components/halftone-shadow.ts +21 -16
- package/src/slide-components/handwriting-effect.ts +8 -6
- package/src/slide-components/hold.ts +18 -4
- package/src/slide-components/image.ts +9 -7
- package/src/slide-components/in-parallel.ts +16 -1
- package/src/slide-components/in-series.ts +3 -1
- package/src/slide-components/live-duration.ts +4 -2
- package/src/slide-components/multi-text.ts +71 -44
- package/src/slide-components/rectangle.ts +6 -4
- package/src/slide-components/registry.ts +33 -27
- package/src/slide-components/show-error.ts +13 -4
- package/src/slide-components/simple-text.ts +22 -12
- package/src/slide-components/slide-component.ts +15 -13
- package/src/slide-components/slide-left.ts +9 -2
- package/src/slide-components/text-effect.ts +9 -0
- package/src/slide-components/traditional-text.ts +8 -8
- package/src/slide-components/video-clip.ts +5 -3
package/dev/canvas-recorder.ts
CHANGED
|
@@ -19,10 +19,13 @@ import {
|
|
|
19
19
|
Mp4OutputFormat,
|
|
20
20
|
AudioBufferSource,
|
|
21
21
|
QUALITY_HIGH,
|
|
22
|
+
TextSubtitleSource,
|
|
22
23
|
} from "mediabunny";
|
|
23
24
|
import {
|
|
25
|
+
choiceLabel,
|
|
24
26
|
EditorPanel,
|
|
25
27
|
EditorPanelAPI,
|
|
28
|
+
propertyLabel,
|
|
26
29
|
RootComponentEditor,
|
|
27
30
|
SerializedScalar,
|
|
28
31
|
SerializedSchedule,
|
|
@@ -38,9 +41,10 @@ import {
|
|
|
38
41
|
interpolateNumbers,
|
|
39
42
|
interpolatePoints,
|
|
40
43
|
interpolateRects,
|
|
41
|
-
|
|
44
|
+
TimedKeyframe,
|
|
42
45
|
} from "../src/interpolate.ts";
|
|
43
46
|
import { Lattice, LatticeValue } from "../src/lattice.ts";
|
|
47
|
+
import { checkPanAndZoom } from "../src/glib/transforms.ts";
|
|
44
48
|
import { ArrowValue, interpolateArrow } from "../src/schedule-helper.ts";
|
|
45
49
|
import {
|
|
46
50
|
applyJsonEntry,
|
|
@@ -63,7 +67,7 @@ import {
|
|
|
63
67
|
} from "../src/snapshot.ts";
|
|
64
68
|
import { downloadBlob, philDebug } from "../src/utility.ts";
|
|
65
69
|
import { debugLog, getNewDebugLogEntries } from "../src/debug-log.ts";
|
|
66
|
-
import { SAMPLE_RATE, Soundtrack } from "./soundtrack.ts";
|
|
70
|
+
import { collectSoundClips, SAMPLE_RATE, Soundtrack } from "./soundtrack.ts";
|
|
67
71
|
import { openVoicePanel, type VoicePanel } from "./voice/voice-panel.ts";
|
|
68
72
|
import type { RecordedClip, VoiceRecorder } from "./voice/voice-recorder.ts";
|
|
69
73
|
import { openColorPickerDialog } from "./color-picker.ts";
|
|
@@ -93,13 +97,18 @@ import {
|
|
|
93
97
|
tidyMs,
|
|
94
98
|
} from "./sound-clips.ts";
|
|
95
99
|
import { askHowToSplit, askHowToSplitSound } from "./split-dialog.ts";
|
|
96
|
-
import {
|
|
100
|
+
import {
|
|
101
|
+
onSyncStatusChange,
|
|
102
|
+
SyncedFile,
|
|
103
|
+
type SyncedFileOptions,
|
|
104
|
+
} from "./synced-file.ts";
|
|
97
105
|
import {
|
|
98
106
|
TimelineDisplay,
|
|
99
107
|
type TimelineBlock,
|
|
100
108
|
type TimelineWord,
|
|
101
109
|
} from "./timeline-display.ts";
|
|
102
110
|
import {
|
|
111
|
+
editTranscript,
|
|
103
112
|
forgetTranscriptFailures,
|
|
104
113
|
forgetTranscripts,
|
|
105
114
|
makeTranscript,
|
|
@@ -111,8 +120,16 @@ import {
|
|
|
111
120
|
transcriptsEnabled,
|
|
112
121
|
transcriptStatus,
|
|
113
122
|
transcriptsSummary,
|
|
123
|
+
transcriptVersion,
|
|
114
124
|
} from "./transcripts.ts";
|
|
115
|
-
import {
|
|
125
|
+
import {
|
|
126
|
+
transcriptFileName,
|
|
127
|
+
transcriptJson,
|
|
128
|
+
transcriptsFileText,
|
|
129
|
+
type VideoTranscript,
|
|
130
|
+
} from "./transcript-export.ts";
|
|
131
|
+
import { openTranscriptEditor } from "./transcript-editor.ts";
|
|
132
|
+
import { subtitleWords, webVtt } from "./subtitles.ts";
|
|
116
133
|
import { wordFlag } from "./transcript-align.ts";
|
|
117
134
|
import type { Device } from "./transcribe-core.ts";
|
|
118
135
|
import { canvasRecorder, type VideoSize } from "../lib/main-control.ts";
|
|
@@ -577,7 +594,7 @@ function showFrame(timeInMs: number, live: boolean) {
|
|
|
577
594
|
// Two separate things, though they usually agree:
|
|
578
595
|
//
|
|
579
596
|
// * The **root**: the component the Visual Editor works on, picked in the
|
|
580
|
-
// chapter <select>.
|
|
597
|
+
// chapter <select>. TimedKeyframe times, the timeline at the bottom, and every
|
|
581
598
|
// "now" the editors show are measured from the root's start. See
|
|
582
599
|
// rootStartMs and playheadInRootMs().
|
|
583
600
|
// * The **play limits**: where playback wraps or stops, and the ends of the
|
|
@@ -607,7 +624,7 @@ let sectionStartTime = 0;
|
|
|
607
624
|
let sectionEndTime = 0;
|
|
608
625
|
|
|
609
626
|
/**
|
|
610
|
-
* When the Visual Editor's root starts, in video time.
|
|
627
|
+
* When the Visual Editor's root starts, in video time. TimedKeyframe times, the
|
|
611
628
|
* timeline, and every "now" the editors show are measured from here.
|
|
612
629
|
*/
|
|
613
630
|
let rootStartMs = 0;
|
|
@@ -1128,6 +1145,33 @@ addEventListener("keydown", (event) => {
|
|
|
1128
1145
|
}
|
|
1129
1146
|
});
|
|
1130
1147
|
|
|
1148
|
+
// The math's self-test, once per page load. It used to run as transforms.ts loaded, which
|
|
1149
|
+
// kept PathShape and everything that uses it out of Node.
|
|
1150
|
+
checkPanAndZoom();
|
|
1151
|
+
|
|
1152
|
+
// MARK: Wheel over a number
|
|
1153
|
+
|
|
1154
|
+
/**
|
|
1155
|
+
* Chrome changes a focused number field when the wheel, or a two finger scroll, passes over
|
|
1156
|
+
* it. Here that's nearly always an accident: scrolling the properties to find the next
|
|
1157
|
+
* one. And Cmd+Z can't undo it. So the field gives up the focus first, and the wheel
|
|
1158
|
+
* scrolls as usual. Typing and the field's arrows still work.
|
|
1159
|
+
*/
|
|
1160
|
+
document.addEventListener(
|
|
1161
|
+
"wheel",
|
|
1162
|
+
(event) => {
|
|
1163
|
+
const target = event.target;
|
|
1164
|
+
if (
|
|
1165
|
+
target instanceof HTMLInputElement &&
|
|
1166
|
+
target.type === "number" &&
|
|
1167
|
+
target === document.activeElement
|
|
1168
|
+
) {
|
|
1169
|
+
target.blur();
|
|
1170
|
+
}
|
|
1171
|
+
},
|
|
1172
|
+
{ passive: true, capture: true },
|
|
1173
|
+
);
|
|
1174
|
+
|
|
1131
1175
|
/**
|
|
1132
1176
|
* This is the status of the save. It has no purpose during live / realtime operation
|
|
1133
1177
|
* so it initialize it to blank.
|
|
@@ -1329,12 +1373,14 @@ function escapeHtml(text: string): string {
|
|
|
1329
1373
|
* Save dialog can change it, just for this file. Nothing else sees the change: the picture
|
|
1330
1374
|
* is still drawn in canvasRecorder's units, and simply stretched to this size.
|
|
1331
1375
|
* @param pixelHeight The saved file's height. See `pixelWidth`.
|
|
1376
|
+
* @param subtitles Add a subtitle track, made from the transcripts. See dev/subtitles.ts.
|
|
1332
1377
|
*/
|
|
1333
1378
|
async function startRecording(
|
|
1334
1379
|
saveStartMs = 0,
|
|
1335
1380
|
saveEndMs = toShow.duration,
|
|
1336
1381
|
pixelWidth = canvasRecorder.pixelWidth,
|
|
1337
1382
|
pixelHeight = canvasRecorder.pixelHeight,
|
|
1383
|
+
subtitles = false,
|
|
1338
1384
|
) {
|
|
1339
1385
|
stopAudio();
|
|
1340
1386
|
startRecordingButton.disabled = true;
|
|
@@ -1421,6 +1467,23 @@ async function startRecording(
|
|
|
1421
1467
|
});
|
|
1422
1468
|
output.addAudioTrack(audioSource);
|
|
1423
1469
|
|
|
1470
|
+
// The words, from the transcripts as they are now. The cues are added at the end, like
|
|
1471
|
+
// the sound, when it's known how much was recorded. A track with no cues isn't written.
|
|
1472
|
+
const spokenWords = subtitles
|
|
1473
|
+
? subtitleWords(
|
|
1474
|
+
collectSoundClips(toShow),
|
|
1475
|
+
(source) => readyTranscript(source)?.words,
|
|
1476
|
+
)
|
|
1477
|
+
: [];
|
|
1478
|
+
let subtitleSource: TextSubtitleSource | undefined;
|
|
1479
|
+
if (spokenWords.length) {
|
|
1480
|
+
subtitleSource = new TextSubtitleSource("webvtt");
|
|
1481
|
+
output.addSubtitleTrack(subtitleSource, {
|
|
1482
|
+
languageCode: "eng",
|
|
1483
|
+
name: "Subtitles",
|
|
1484
|
+
});
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1424
1487
|
const startTime = performance.now();
|
|
1425
1488
|
|
|
1426
1489
|
await output.start();
|
|
@@ -1496,6 +1559,15 @@ async function startRecording(
|
|
|
1496
1559
|
await audioSource.add(trimmedAudio);
|
|
1497
1560
|
}
|
|
1498
1561
|
|
|
1562
|
+
if (subtitleSource) {
|
|
1563
|
+
const text = webVtt(
|
|
1564
|
+
spokenWords,
|
|
1565
|
+
audioStartMs,
|
|
1566
|
+
audioStartMs + actualAudioMs,
|
|
1567
|
+
);
|
|
1568
|
+
if (text) await subtitleSource.add(text);
|
|
1569
|
+
}
|
|
1570
|
+
|
|
1499
1571
|
infoDiv.innerHTML = "Frames complete. Finalizing video.";
|
|
1500
1572
|
cancelRecordingButton.disabled = true;
|
|
1501
1573
|
|
|
@@ -1682,6 +1754,29 @@ function updateSaveDialogInfo(): void {
|
|
|
1682
1754
|
saveInfoFrames.textContent = framesBetween(startMs, endMs).toLocaleString();
|
|
1683
1755
|
saveInfoFrames.style.color = invalid ? "red" : "";
|
|
1684
1756
|
updateSaveSizeNote();
|
|
1757
|
+
updateSaveSubtitlesNote(startMs, endMs);
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
const saveSubtitlesCheckbox = getById("saveSubtitles", HTMLInputElement);
|
|
1761
|
+
const saveSubtitlesNote = getById("saveSubtitlesNote", HTMLSpanElement);
|
|
1762
|
+
|
|
1763
|
+
/** How many words the subtitles will have, and which sound files have no transcript yet. */
|
|
1764
|
+
function updateSaveSubtitlesNote(startMs: number, endMs: number): void {
|
|
1765
|
+
const placed = collectSoundClips(toShow);
|
|
1766
|
+
const missing = new Set(
|
|
1767
|
+
placed
|
|
1768
|
+
.map((clip) => clip.source)
|
|
1769
|
+
.filter((source) => !readyTranscript(source)),
|
|
1770
|
+
).size;
|
|
1771
|
+
const count = subtitleWords(
|
|
1772
|
+
placed,
|
|
1773
|
+
(source) => readyTranscript(source)?.words,
|
|
1774
|
+
).filter((word) => word.startMs >= startMs && word.startMs < endMs).length;
|
|
1775
|
+
const words = `${count.toLocaleString()} ${count === 1 ? "word" : "words"}`;
|
|
1776
|
+
saveSubtitlesNote.textContent = missing
|
|
1777
|
+
? `${words}. ${missing} sound ${missing === 1 ? "file has" : "files have"} no transcript yet, so ${missing === 1 ? "it isn't" : "they aren't"} included.`
|
|
1778
|
+
: words;
|
|
1779
|
+
saveSubtitlesNote.style.color = missing ? "#a06000" : "#555";
|
|
1685
1780
|
}
|
|
1686
1781
|
|
|
1687
1782
|
function setSaveRange(startMs: number, endMs: number): void {
|
|
@@ -1784,7 +1879,7 @@ saveOkBtn.addEventListener("click", async () => {
|
|
|
1784
1879
|
// Quick: no prompts, just IndexedDB. The click still counts for the file picker afterward.
|
|
1785
1880
|
if (!(await saveDialogLocalFilesReady())) return;
|
|
1786
1881
|
saveDialog.close();
|
|
1787
|
-
startRecording(startMs, endMs, width, height);
|
|
1882
|
+
startRecording(startMs, endMs, width, height, saveSubtitlesCheckbox.checked);
|
|
1788
1883
|
});
|
|
1789
1884
|
|
|
1790
1885
|
startRecordingButton.addEventListener("click", () => {
|
|
@@ -2044,13 +2139,24 @@ philDebug.VisualEditor = {
|
|
|
2044
2139
|
get rootComponent(): Showable | undefined {
|
|
2045
2140
|
return currentRoot();
|
|
2046
2141
|
},
|
|
2142
|
+
/** What the component list shows as selected: the root, when no child is. */
|
|
2047
2143
|
get selectedComponent(): Showable | null {
|
|
2048
|
-
return selectedSlideChild;
|
|
2144
|
+
return selectedSlideChild ?? currentRoot() ?? null;
|
|
2049
2145
|
},
|
|
2050
2146
|
/** Current time in ms relative to the start of the Visual Editor's root. */
|
|
2051
2147
|
get localTimeMs(): number {
|
|
2052
2148
|
return playheadInRootMs();
|
|
2053
2149
|
},
|
|
2150
|
+
/**
|
|
2151
|
+
* After changing components from the console: show the changes. The same as
|
|
2152
|
+
* {@link VisualEditorAPI.refreshGUI}.
|
|
2153
|
+
* @param howMuch "properties" (the default) after changing values, and "structure" after
|
|
2154
|
+
* adding or removing components. Both save. "sound" rebuilds the sound from its clips, and
|
|
2155
|
+
* doesn't save.
|
|
2156
|
+
*/
|
|
2157
|
+
refreshGUI(howMuch: "sound" | "properties" | "structure" = "properties") {
|
|
2158
|
+
visualEditorAPI.refreshGUI(howMuch);
|
|
2159
|
+
},
|
|
2054
2160
|
};
|
|
2055
2161
|
|
|
2056
2162
|
const scheduleHistoryControls = getById("scheduleHistoryControls", HTMLElement);
|
|
@@ -2065,7 +2171,7 @@ const historyCancelBtn = getById("historyCancelBtn", HTMLButtonElement);
|
|
|
2065
2171
|
const historyDialogHint = getById("historyDialogHint", HTMLElement);
|
|
2066
2172
|
|
|
2067
2173
|
// MARK: Rect marker drag state
|
|
2068
|
-
type RectKf =
|
|
2174
|
+
type RectKf = TimedKeyframe<ReadOnlyRect>;
|
|
2069
2175
|
type RectHandle = "tl" | "tr" | "bl" | "br" | "center";
|
|
2070
2176
|
|
|
2071
2177
|
/** The single rect keyframe currently in "edit" mode (drag handles shown on canvas). At most one at a time. */
|
|
@@ -2104,7 +2210,7 @@ const DEFAULT_LATTICE: LatticeValue = {
|
|
|
2104
2210
|
cellHeight: 1,
|
|
2105
2211
|
};
|
|
2106
2212
|
|
|
2107
|
-
type LatticeKf =
|
|
2213
|
+
type LatticeKf = TimedKeyframe<LatticeValue>;
|
|
2108
2214
|
/** The rect handles, plus one more that drags the bottom-right corner of the top-left cell. */
|
|
2109
2215
|
type LatticeHandle = RectHandle | "cell";
|
|
2110
2216
|
|
|
@@ -2126,7 +2232,7 @@ let draggingLattice: {
|
|
|
2126
2232
|
} | null = null;
|
|
2127
2233
|
|
|
2128
2234
|
// MARK: Point marker drag state
|
|
2129
|
-
type PointKf =
|
|
2235
|
+
type PointKf = TimedKeyframe<{ x: number; y: number }>;
|
|
2130
2236
|
|
|
2131
2237
|
/** The single point keyframe currently in "edit" mode. At most one at a time. */
|
|
2132
2238
|
let editingPointKf: PointKf | null = null;
|
|
@@ -2148,7 +2254,10 @@ let draggingPoint: PointKf | null = null;
|
|
|
2148
2254
|
* something other than that input changes the value -- e.g. dragging a
|
|
2149
2255
|
* Multi Text's frame changes its Width and Height.
|
|
2150
2256
|
*/
|
|
2151
|
-
const numberSyncCallbacks = new Map<
|
|
2257
|
+
const numberSyncCallbacks = new Map<
|
|
2258
|
+
TimedKeyframe<number>,
|
|
2259
|
+
(n: number) => void
|
|
2260
|
+
>();
|
|
2152
2261
|
|
|
2153
2262
|
/**
|
|
2154
2263
|
* 👁 / ✎ for each Multi Text's frame, remembered across rebuilds of the
|
|
@@ -2158,7 +2267,7 @@ const numberSyncCallbacks = new Map<Keyframe<number>, (n: number) => void>();
|
|
|
2158
2267
|
const textFrameCanvasStates = new WeakMap<MultiTextComponent, CanvasState>();
|
|
2159
2268
|
|
|
2160
2269
|
// MARK: Arrow marker drag state
|
|
2161
|
-
type ArrowKf =
|
|
2270
|
+
type ArrowKf = TimedKeyframe<ArrowValue>;
|
|
2162
2271
|
type ArrowHandle = "flat" | "pointy" | "center";
|
|
2163
2272
|
|
|
2164
2273
|
/** The single arrow keyframe currently in "edit" mode. */
|
|
@@ -2608,6 +2717,7 @@ transcriptsCheckbox.addEventListener("change", () => {
|
|
|
2608
2717
|
onTranscriptsChange(() => {
|
|
2609
2718
|
transcriptsStatusSpan.textContent = transcriptsSummary();
|
|
2610
2719
|
timelineDisplay.redraw();
|
|
2720
|
+
requestTranscriptsSync();
|
|
2611
2721
|
});
|
|
2612
2722
|
|
|
2613
2723
|
// The transcript as text. It rebuilds itself when the clips or transcripts
|
|
@@ -2862,7 +2972,7 @@ function timelineWords(
|
|
|
2862
2972
|
clipStart: number,
|
|
2863
2973
|
): { words: readonly TimelineWord[]; snaps: readonly number[] } {
|
|
2864
2974
|
const fromMs = clip.startMsIntoClip ?? 0;
|
|
2865
|
-
const key = `${clipStart}|${fromMs}|${soundClipLengthMs(clip)}|${transcript
|
|
2975
|
+
const key = `${clipStart}|${fromMs}|${soundClipLengthMs(clip)}|${transcriptVersion(transcript)}`;
|
|
2866
2976
|
const memo = timelineWordsMemo.get(clip);
|
|
2867
2977
|
if (memo?.key === key) return memo;
|
|
2868
2978
|
// File time to chapter time.
|
|
@@ -3206,18 +3316,18 @@ function restorePlace(place: SavedPlace): void {
|
|
|
3206
3316
|
*/
|
|
3207
3317
|
function saveState() {
|
|
3208
3318
|
sessionStorage.setItem(
|
|
3209
|
-
"place",
|
|
3319
|
+
sessionKey("place"),
|
|
3210
3320
|
JSON.stringify(placeToRestore ?? currentPlace()),
|
|
3211
3321
|
);
|
|
3212
3322
|
sessionStorage.setItem(
|
|
3213
|
-
"playPositionLocal",
|
|
3323
|
+
sessionKey("playPositionLocal"),
|
|
3214
3324
|
playPositionLocal.checked ? "1" : "0",
|
|
3215
3325
|
);
|
|
3216
|
-
sessionStorage.setItem("zoomSelect", zoomSelect.value);
|
|
3217
|
-
sessionStorage.setItem("panX", panX.toString());
|
|
3218
|
-
sessionStorage.setItem("panY", panY.toString());
|
|
3326
|
+
sessionStorage.setItem(sessionKey("zoomSelect"), zoomSelect.value);
|
|
3327
|
+
sessionStorage.setItem(sessionKey("panX"), panX.toString());
|
|
3328
|
+
sessionStorage.setItem(sessionKey("panY"), panY.toString());
|
|
3219
3329
|
sessionStorage.setItem(
|
|
3220
|
-
"quality",
|
|
3330
|
+
sessionKey("quality"),
|
|
3221
3331
|
querySelector('input[name="quality"]:checked', HTMLInputElement).value,
|
|
3222
3332
|
);
|
|
3223
3333
|
|
|
@@ -3248,6 +3358,26 @@ type ScheduleInfo = NonNullable<Showable["schedules"]>[number];
|
|
|
3248
3358
|
|
|
3249
3359
|
const toShowKey = startRequest.name;
|
|
3250
3360
|
|
|
3361
|
+
/**
|
|
3362
|
+
* This video's own sessionStorage key for `name`. Two videos opened in one tab don't share
|
|
3363
|
+
* a place, a zoom or an unload backup. The pane sizes are the window's layout, so they stay
|
|
3364
|
+
* shared, under plain names.
|
|
3365
|
+
*/
|
|
3366
|
+
function sessionKey(name: (typeof PER_VIDEO_SESSION_KEYS)[number]): string {
|
|
3367
|
+
return `${name}|${toShowKey}`;
|
|
3368
|
+
}
|
|
3369
|
+
|
|
3370
|
+
/** Everything {@link sessionKey} names. Before 0.8.4 they were plain names, shared by every video. */
|
|
3371
|
+
const PER_VIDEO_SESSION_KEYS = [
|
|
3372
|
+
"place",
|
|
3373
|
+
"playPositionLocal",
|
|
3374
|
+
"zoomSelect",
|
|
3375
|
+
"panX",
|
|
3376
|
+
"panY",
|
|
3377
|
+
"quality",
|
|
3378
|
+
"pendingScheduleSave",
|
|
3379
|
+
] as const;
|
|
3380
|
+
|
|
3251
3381
|
/** Marker written when the user deliberately chooses TypeScript defaults. */
|
|
3252
3382
|
type MarkerHistoryEntry = {
|
|
3253
3383
|
timestamp: number;
|
|
@@ -3561,6 +3691,121 @@ const diffSync = new SyncedFile({
|
|
|
3561
3691
|
...keyedSyncStorage(`__diff-save__|${toShowKey}`, false),
|
|
3562
3692
|
});
|
|
3563
3693
|
|
|
3694
|
+
/**
|
|
3695
|
+
* Every transcript the video uses, mirrored to a JSON file, so they can be read and checked
|
|
3696
|
+
* outside the editor: by you, by grep, or by Claude. It's only a copy. The transcripts
|
|
3697
|
+
* themselves, with the Transcript Editor's changes, live in IndexedDB.
|
|
3698
|
+
*/
|
|
3699
|
+
const transcriptsSync = new SyncedFile({
|
|
3700
|
+
checkbox: getById("transcriptsSyncCheckbox", HTMLInputElement),
|
|
3701
|
+
status: getById("transcriptsSyncStatus", HTMLSpanElement),
|
|
3702
|
+
picker: {
|
|
3703
|
+
id: "transcripts-save",
|
|
3704
|
+
types: JSON_FILE_TYPES,
|
|
3705
|
+
defaultName: () => `${toShowKey || "video"}-transcripts.json`,
|
|
3706
|
+
},
|
|
3707
|
+
render: () => transcriptsFileText(toShowKey, videoTranscripts()),
|
|
3708
|
+
...keyedSyncStorage(`__transcripts-save__|${toShowKey}`, false),
|
|
3709
|
+
});
|
|
3710
|
+
|
|
3711
|
+
/**
|
|
3712
|
+
* Each sound file the whole video uses, once, in order of first use. Asking about a file
|
|
3713
|
+
* starts its transcript, so this only runs while the transcripts file is being synced.
|
|
3714
|
+
*/
|
|
3715
|
+
function videoTranscripts(): VideoTranscript[] {
|
|
3716
|
+
const usesBySource = new Map<string, VideoTranscript["uses"][number][]>();
|
|
3717
|
+
const placed = collectSoundClips(toShow).sort(
|
|
3718
|
+
(a, b) => a.startMs - b.startMs,
|
|
3719
|
+
);
|
|
3720
|
+
for (const clip of placed) {
|
|
3721
|
+
let uses = usesBySource.get(clip.source);
|
|
3722
|
+
if (!uses) usesBySource.set(clip.source, (uses = []));
|
|
3723
|
+
uses.push({
|
|
3724
|
+
startsInVideoMs: clip.startMs,
|
|
3725
|
+
playsFileFromMs: clip.trimMs,
|
|
3726
|
+
playsFileToMs: Number.isFinite(clip.lengthMs)
|
|
3727
|
+
? clip.trimMs + clip.lengthMs
|
|
3728
|
+
: null,
|
|
3729
|
+
});
|
|
3730
|
+
}
|
|
3731
|
+
return [...usesBySource].map(([source, uses]) => {
|
|
3732
|
+
const status = transcriptStatus(source);
|
|
3733
|
+
return {
|
|
3734
|
+
source,
|
|
3735
|
+
transcript: status?.kind === "ready" ? status.transcript : undefined,
|
|
3736
|
+
status: !status
|
|
3737
|
+
? "transcripts are off"
|
|
3738
|
+
: (statusText(status) ?? status.kind),
|
|
3739
|
+
uses,
|
|
3740
|
+
};
|
|
3741
|
+
});
|
|
3742
|
+
}
|
|
3743
|
+
|
|
3744
|
+
/** What the transcripts file was last asked to show. See {@link requestTranscriptsSync}. */
|
|
3745
|
+
let transcriptsSyncSignature = "";
|
|
3746
|
+
|
|
3747
|
+
/**
|
|
3748
|
+
* Bring the transcripts file up to date, if anything in it could have changed: a transcript,
|
|
3749
|
+
* or which part of which file the video plays. Cheap when nothing did, so call it often.
|
|
3750
|
+
*/
|
|
3751
|
+
function requestTranscriptsSync(): void {
|
|
3752
|
+
if (!transcriptsSync.handle) return;
|
|
3753
|
+
const placed = collectSoundClips(toShow);
|
|
3754
|
+
const signature = JSON.stringify(
|
|
3755
|
+
placed.map((clip) => {
|
|
3756
|
+
const transcript = readyTranscript(clip.source);
|
|
3757
|
+
return [
|
|
3758
|
+
clip.source,
|
|
3759
|
+
clip.startMs,
|
|
3760
|
+
clip.trimMs,
|
|
3761
|
+
clip.lengthMs,
|
|
3762
|
+
transcript ? transcriptVersion(transcript) : 0,
|
|
3763
|
+
];
|
|
3764
|
+
}),
|
|
3765
|
+
);
|
|
3766
|
+
if (signature === transcriptsSyncSignature) return;
|
|
3767
|
+
transcriptsSyncSignature = signature;
|
|
3768
|
+
transcriptsSync.request();
|
|
3769
|
+
}
|
|
3770
|
+
|
|
3771
|
+
// MARK: 💾 Files
|
|
3772
|
+
|
|
3773
|
+
const filesBtn = getById("filesBtn", HTMLButtonElement);
|
|
3774
|
+
const filesDialog = getById("filesDialog", HTMLDialogElement);
|
|
3775
|
+
filesBtn.addEventListener("click", () => filesDialog.showModal());
|
|
3776
|
+
getById("filesDialogCloseBtn", HTMLButtonElement).addEventListener(
|
|
3777
|
+
"click",
|
|
3778
|
+
() => filesDialog.close(),
|
|
3779
|
+
);
|
|
3780
|
+
|
|
3781
|
+
/**
|
|
3782
|
+
* The button stands for every synced file: red when one needs a click, orange while one is
|
|
3783
|
+
* waiting for the next save. Its tooltip lists them.
|
|
3784
|
+
*/
|
|
3785
|
+
function drawFilesButton(): void {
|
|
3786
|
+
const syncs = [
|
|
3787
|
+
["Sync to file", jsonSync],
|
|
3788
|
+
["Sync defaults", defaultsSync],
|
|
3789
|
+
["Sync diffs", diffSync],
|
|
3790
|
+
["Sync transcripts", transcriptsSync],
|
|
3791
|
+
] as const;
|
|
3792
|
+
const summaries = syncs.map(([, sync]) => sync.summary);
|
|
3793
|
+
const action = summaries.includes("action");
|
|
3794
|
+
const pending = summaries.includes("pending");
|
|
3795
|
+
filesBtn.textContent = `💾 Files${action ? " ⚠" : pending ? " *" : ""}`;
|
|
3796
|
+
filesBtn.style.background = action ? "#e53935" : pending ? "#ffb74d" : "";
|
|
3797
|
+
filesBtn.style.color = action ? "white" : "";
|
|
3798
|
+
filesBtn.title = [
|
|
3799
|
+
action
|
|
3800
|
+
? "Something needs a click. Open this to see what."
|
|
3801
|
+
: "Import, Save Copy As, and the files on disk that follow your work.",
|
|
3802
|
+
"",
|
|
3803
|
+
...syncs.map(([name, sync]) => `${name}: ${sync.statusText}`),
|
|
3804
|
+
].join("\n");
|
|
3805
|
+
}
|
|
3806
|
+
onSyncStatusChange(drawFilesButton);
|
|
3807
|
+
drawFilesButton();
|
|
3808
|
+
|
|
3564
3809
|
/** The code-defined starting point, in the same format as {@link buildJsonSnapshot}. */
|
|
3565
3810
|
function buildDefaultsSnapshot(): VideoSnapshot {
|
|
3566
3811
|
return {
|
|
@@ -4244,7 +4489,7 @@ async function initFromDB(unloadBackup?: string | null): Promise<void> {
|
|
|
4244
4489
|
_loadSource = source;
|
|
4245
4490
|
_baselineTreeJson = currentTreeJson();
|
|
4246
4491
|
// The unload backup is in the database now, or older than it. See the end of "Load previous state".
|
|
4247
|
-
sessionStorage.removeItem("pendingScheduleSave");
|
|
4492
|
+
sessionStorage.removeItem(sessionKey("pendingScheduleSave"));
|
|
4248
4493
|
|
|
4249
4494
|
canvas.style.visibility = "";
|
|
4250
4495
|
canvasLoading.style.display = "none";
|
|
@@ -4287,6 +4532,7 @@ async function saveVideoState(force = false): Promise<void> {
|
|
|
4287
4532
|
} finally {
|
|
4288
4533
|
jsonSync.request();
|
|
4289
4534
|
diffSync.request();
|
|
4535
|
+
requestTranscriptsSync();
|
|
4290
4536
|
}
|
|
4291
4537
|
}
|
|
4292
4538
|
|
|
@@ -4395,7 +4641,10 @@ function saveOnUnload() {
|
|
|
4395
4641
|
// preview, not the state being backed up.
|
|
4396
4642
|
if (dirty && !previewing) void saveVideoState();
|
|
4397
4643
|
try {
|
|
4398
|
-
sessionStorage.setItem(
|
|
4644
|
+
sessionStorage.setItem(
|
|
4645
|
+
sessionKey("pendingScheduleSave"),
|
|
4646
|
+
JSON.stringify([backup]),
|
|
4647
|
+
);
|
|
4399
4648
|
} catch (e) {
|
|
4400
4649
|
// One whole tree can exceed the ~5MB sessionStorage quota on a big video. The
|
|
4401
4650
|
// IndexedDB write above already happened, so losing this backstop is survivable.
|
|
@@ -4921,7 +5170,7 @@ function buildScheduleSection(
|
|
|
4921
5170
|
}
|
|
4922
5171
|
|
|
4923
5172
|
const legend = document.createElement("legend");
|
|
4924
|
-
legend.textContent = info
|
|
5173
|
+
legend.textContent = propertyLabel(info) + " ";
|
|
4925
5174
|
const addBtn = document.createElement("button");
|
|
4926
5175
|
addBtn.type = "button";
|
|
4927
5176
|
addBtn.textContent = "+ Add";
|
|
@@ -5063,6 +5312,15 @@ function buildScheduleSection(
|
|
|
5063
5312
|
const durationLabel = info.timeAxisLabel
|
|
5064
5313
|
? `Δ ${info.timeAxisLabel}`
|
|
5065
5314
|
: "Duration (ms)";
|
|
5315
|
+
/**
|
|
5316
|
+
* A text box takes any spare width. The table fills the panel, and its Value column asks
|
|
5317
|
+
* for all of it. That alone would squeeze the other columns to their narrowest, wrapping
|
|
5318
|
+
* "Go To", so `.grow-value` in canvas-recorder.css keeps the headers on one line until the
|
|
5319
|
+
* panel is really too narrow.
|
|
5320
|
+
*/
|
|
5321
|
+
const growValue =
|
|
5322
|
+
info.type === "string" && !info.useDialog && !info.choices?.length;
|
|
5323
|
+
if (growValue) table.style.width = "100%";
|
|
5066
5324
|
for (const h of [
|
|
5067
5325
|
showDurations ? durationLabel : timeLabel,
|
|
5068
5326
|
...valueHeaders,
|
|
@@ -5072,6 +5330,7 @@ function buildScheduleSection(
|
|
|
5072
5330
|
]) {
|
|
5073
5331
|
const th = document.createElement("th");
|
|
5074
5332
|
th.textContent = h;
|
|
5333
|
+
if (growValue && h === "Value") th.style.width = "100%";
|
|
5075
5334
|
headerRow.append(th);
|
|
5076
5335
|
}
|
|
5077
5336
|
|
|
@@ -5263,7 +5522,7 @@ function buildScheduleSection(
|
|
|
5263
5522
|
}
|
|
5264
5523
|
|
|
5265
5524
|
if (info.type === "color") {
|
|
5266
|
-
const colorKf = kf as
|
|
5525
|
+
const colorKf = kf as TimedKeyframe<string>;
|
|
5267
5526
|
const cell = row.insertCell();
|
|
5268
5527
|
const swatchBtn = document.createElement("button");
|
|
5269
5528
|
swatchBtn.type = "button";
|
|
@@ -5280,7 +5539,7 @@ function buildScheduleSection(
|
|
|
5280
5539
|
});
|
|
5281
5540
|
cell.append(swatchBtn);
|
|
5282
5541
|
} else if (info.type === "number") {
|
|
5283
|
-
const numKf = kf as
|
|
5542
|
+
const numKf = kf as TimedKeyframe<number>;
|
|
5284
5543
|
const input = buildNumericInput(numKf.value, (n) => {
|
|
5285
5544
|
numKf.value = n;
|
|
5286
5545
|
});
|
|
@@ -5289,7 +5548,7 @@ function buildScheduleSection(
|
|
|
5289
5548
|
});
|
|
5290
5549
|
row.insertCell().append(input);
|
|
5291
5550
|
} else if (info.type === "string") {
|
|
5292
|
-
const strKf = kf as
|
|
5551
|
+
const strKf = kf as TimedKeyframe<string>;
|
|
5293
5552
|
const cell = row.insertCell();
|
|
5294
5553
|
if (info.useDialog) {
|
|
5295
5554
|
// Font picker: read-only display + button that opens the dialog.
|
|
@@ -5335,18 +5594,21 @@ function buildScheduleSection(
|
|
|
5335
5594
|
input.value = strKf.value;
|
|
5336
5595
|
input.style.cssText =
|
|
5337
5596
|
"width:100%;box-sizing:border-box;resize:vertical";
|
|
5597
|
+
// See growValue.
|
|
5598
|
+
cell.style.width = "100%";
|
|
5338
5599
|
input.addEventListener("input", () => {
|
|
5339
5600
|
strKf.value = input.value;
|
|
5340
5601
|
});
|
|
5341
5602
|
cell.append(input);
|
|
5342
5603
|
}
|
|
5343
5604
|
} else if (info.type === "select") {
|
|
5344
|
-
const strKf = kf as
|
|
5605
|
+
const strKf = kf as TimedKeyframe<string>;
|
|
5345
5606
|
const cell = row.insertCell();
|
|
5346
5607
|
const sel = addName(document.createElement("select"));
|
|
5347
5608
|
for (const choice of info.choices) {
|
|
5348
5609
|
const opt = document.createElement("option");
|
|
5349
|
-
opt.value =
|
|
5610
|
+
opt.value = choice;
|
|
5611
|
+
opt.textContent = choiceLabel(info, choice);
|
|
5350
5612
|
sel.append(opt);
|
|
5351
5613
|
}
|
|
5352
5614
|
sel.value = strKf.value;
|
|
@@ -5716,7 +5978,14 @@ function buildScheduleSection(
|
|
|
5716
5978
|
refreshRippled();
|
|
5717
5979
|
|
|
5718
5980
|
table.append(tbody);
|
|
5719
|
-
|
|
5981
|
+
if (growValue) {
|
|
5982
|
+
const wrapper = document.createElement("div");
|
|
5983
|
+
wrapper.className = "grow-value";
|
|
5984
|
+
wrapper.append(table);
|
|
5985
|
+
section.append(wrapper);
|
|
5986
|
+
} else {
|
|
5987
|
+
section.append(table);
|
|
5988
|
+
}
|
|
5720
5989
|
section.addEventListener("input", () => {
|
|
5721
5990
|
activeRootComponentEditor?.update(selectable, info);
|
|
5722
5991
|
});
|
|
@@ -5935,7 +6204,7 @@ function updateComponentEditor(selectable: Showable) {
|
|
|
5935
6204
|
const pasteIntoBtn = document.createElement("button");
|
|
5936
6205
|
pasteIntoBtn.type = "button";
|
|
5937
6206
|
pasteIntoBtn.textContent = "📋 → 🖥️";
|
|
5938
|
-
pasteIntoBtn.title = `Paste into "${child.description}"`;
|
|
6207
|
+
pasteIntoBtn.title = `Paste into "${child.userEditableDescription ?? child.description}"`;
|
|
5939
6208
|
pasteIntoBtn.addEventListener("click", () =>
|
|
5940
6209
|
pasteInto(child, selectable),
|
|
5941
6210
|
);
|
|
@@ -5985,7 +6254,7 @@ function updateComponentEditor(selectable: Showable) {
|
|
|
5985
6254
|
const rootPasteBtn = document.createElement("button");
|
|
5986
6255
|
rootPasteBtn.type = "button";
|
|
5987
6256
|
rootPasteBtn.textContent = "📋 → 🖥️";
|
|
5988
|
-
rootPasteBtn.title = `Paste into "${selectable.description}"`;
|
|
6257
|
+
rootPasteBtn.title = `Paste into "${selectable.userEditableDescription ?? selectable.description}"`;
|
|
5989
6258
|
rootPasteBtn.addEventListener("click", () =>
|
|
5990
6259
|
pasteInto(selectable as Showable, selectable),
|
|
5991
6260
|
);
|
|
@@ -6312,6 +6581,48 @@ function buildSoundClipSection(selectable: Showable): HTMLElement {
|
|
|
6312
6581
|
);
|
|
6313
6582
|
});
|
|
6314
6583
|
|
|
6584
|
+
const editTranscriptBtn = document.createElement("button");
|
|
6585
|
+
editTranscriptBtn.type = "button";
|
|
6586
|
+
editTranscriptBtn.textContent = "✎";
|
|
6587
|
+
editTranscriptBtn.title =
|
|
6588
|
+
"Edit Transcript… Fix this file's words and their times, for the timeline, 📖 Text and the subtitles.";
|
|
6589
|
+
editTranscriptBtn.addEventListener("click", () => {
|
|
6590
|
+
if (!readyTranscript(clip.source)) {
|
|
6591
|
+
alert(
|
|
6592
|
+
transcriptsEnabled()
|
|
6593
|
+
? "This clip's transcript isn't ready yet. Its progress shows on the timeline."
|
|
6594
|
+
: "Transcripts are off. Turn on 🗣 Transcripts above the timeline.",
|
|
6595
|
+
);
|
|
6596
|
+
return;
|
|
6597
|
+
}
|
|
6598
|
+
const fromMs = clip.startMsIntoClip ?? 0;
|
|
6599
|
+
const playheadInFile = playheadInOwner() - clip.startMsIntoScene + fromMs;
|
|
6600
|
+
const lengthMs = soundClipLengthMs(clip) ?? Infinity;
|
|
6601
|
+
openTranscriptEditor({
|
|
6602
|
+
source: clip.source,
|
|
6603
|
+
words: () => readyTranscript(clip.source)?.words,
|
|
6604
|
+
setWords: (words) => editTranscript(clip.source, words),
|
|
6605
|
+
audio: () => soundtrack.getDecodedBuffer(clip.source),
|
|
6606
|
+
// Every clip in the video that plays this file, not just this one.
|
|
6607
|
+
used: collectSoundClips(toShow)
|
|
6608
|
+
.filter((placed) => placed.source === clip.source)
|
|
6609
|
+
.map((placed) => ({
|
|
6610
|
+
fromMs: placed.trimMs,
|
|
6611
|
+
toMs: placed.trimMs + placed.lengthMs,
|
|
6612
|
+
})),
|
|
6613
|
+
// The playhead, if it's in this clip, or else the clip's start.
|
|
6614
|
+
startAtMs:
|
|
6615
|
+
playheadInFile >= fromMs && playheadInFile < fromMs + lengthMs
|
|
6616
|
+
? playheadInFile
|
|
6617
|
+
: fromMs,
|
|
6618
|
+
pausePlayer() {
|
|
6619
|
+
playCheckBox.checked = false;
|
|
6620
|
+
stopAudio();
|
|
6621
|
+
},
|
|
6622
|
+
closed: () => timelineDisplay.redraw(),
|
|
6623
|
+
});
|
|
6624
|
+
});
|
|
6625
|
+
|
|
6315
6626
|
const splitBtn = document.createElement("button");
|
|
6316
6627
|
splitBtn.type = "button";
|
|
6317
6628
|
splitBtn.textContent = "✂";
|
|
@@ -6359,6 +6670,7 @@ function buildSoundClipSection(selectable: Showable): HTMLElement {
|
|
|
6359
6670
|
notesInput,
|
|
6360
6671
|
fromTranscriptBtn,
|
|
6361
6672
|
saveTranscriptBtn,
|
|
6673
|
+
editTranscriptBtn,
|
|
6362
6674
|
splitBtn,
|
|
6363
6675
|
upBtn,
|
|
6364
6676
|
downBtn,
|
|
@@ -7934,8 +8246,11 @@ function applyMarkerDrag(localX: number, localY: number, shiftKey = false) {
|
|
|
7934
8246
|
|
|
7935
8247
|
// MARK: Load previous state.
|
|
7936
8248
|
{
|
|
7937
|
-
//
|
|
7938
|
-
|
|
8249
|
+
// This video's unload backup, if the last session left one. Before 0.8.4 it was under a
|
|
8250
|
+
// plain name, for whichever video was open last. initFromDB() checks that it's this one's.
|
|
8251
|
+
const unloadBackup =
|
|
8252
|
+
sessionStorage.getItem(sessionKey("pendingScheduleSave")) ??
|
|
8253
|
+
sessionStorage.getItem("pendingScheduleSave");
|
|
7939
8254
|
// Hide the canvas until DB restoration is complete to prevent the TypeScript-
|
|
7940
8255
|
// default state from flashing briefly before the saved state is applied.
|
|
7941
8256
|
canvas.style.visibility = "hidden";
|
|
@@ -7967,6 +8282,7 @@ function applyMarkerDrag(localX: number, localY: number, shiftKey = false) {
|
|
|
7967
8282
|
jsonSync.request();
|
|
7968
8283
|
diffSync.request();
|
|
7969
8284
|
defaultsSync.request();
|
|
8285
|
+
requestTranscriptsSync();
|
|
7970
8286
|
});
|
|
7971
8287
|
|
|
7972
8288
|
// Sanity-check DB for timestamps in the future (clock skew, corrupted data).
|
|
@@ -7994,19 +8310,25 @@ function applyMarkerDrag(localX: number, localY: number, shiftKey = false) {
|
|
|
7994
8310
|
// So when you configure the web page, and you hit refresh, or the page automatically
|
|
7995
8311
|
// refreshes, you don't lose your settings.
|
|
7996
8312
|
try {
|
|
7997
|
-
if (sessionStorage.getItem("playPositionLocal") === "0") {
|
|
8313
|
+
if (sessionStorage.getItem(sessionKey("playPositionLocal")) === "0") {
|
|
7998
8314
|
const playheadMs = playheadInVideoMs();
|
|
7999
8315
|
playPositionLocal.checked = false;
|
|
8000
8316
|
loadPlayPositionSeconds(playheadMs);
|
|
8001
8317
|
}
|
|
8002
8318
|
// Applied when the saved tree is in: see initFromDB() above.
|
|
8003
|
-
placeToRestore = parseSavedPlace(
|
|
8004
|
-
|
|
8319
|
+
placeToRestore = parseSavedPlace(
|
|
8320
|
+
sessionStorage.getItem(sessionKey("place")),
|
|
8321
|
+
);
|
|
8322
|
+
if (sessionStorage.getItem(sessionKey("quality")) === "Low Power") {
|
|
8005
8323
|
getById("lowPower", HTMLInputElement).checked = true;
|
|
8006
8324
|
}
|
|
8007
|
-
const savedZoom = sessionStorage.getItem("zoomSelect");
|
|
8008
|
-
const savedPanX = parseFloatX(
|
|
8009
|
-
|
|
8325
|
+
const savedZoom = sessionStorage.getItem(sessionKey("zoomSelect"));
|
|
8326
|
+
const savedPanX = parseFloatX(
|
|
8327
|
+
sessionStorage.getItem(sessionKey("panX")) ?? "",
|
|
8328
|
+
);
|
|
8329
|
+
const savedPanY = parseFloatX(
|
|
8330
|
+
sessionStorage.getItem(sessionKey("panY")) ?? "",
|
|
8331
|
+
);
|
|
8010
8332
|
if (savedZoom !== null) {
|
|
8011
8333
|
zoomSelect.value = savedZoom;
|
|
8012
8334
|
}
|
|
@@ -8018,7 +8340,7 @@ function applyMarkerDrag(localX: number, localY: number, shiftKey = false) {
|
|
|
8018
8340
|
zoomToFit();
|
|
8019
8341
|
}
|
|
8020
8342
|
|
|
8021
|
-
// Restore splitter positions
|
|
8343
|
+
// Restore splitter positions. Shared by every video: they're the window's layout.
|
|
8022
8344
|
// Values are stored as "XX.XX%" (new format) or a bare number in pixels (old).
|
|
8023
8345
|
const topLeftH = sessionStorage.getItem("pane-height-top-left") ?? "";
|
|
8024
8346
|
const topRightH = sessionStorage.getItem("pane-height-top-right") ?? "";
|
|
@@ -8038,12 +8360,24 @@ function applyMarkerDrag(localX: number, localY: number, shiftKey = false) {
|
|
|
8038
8360
|
const fL = toFlex(leftColW);
|
|
8039
8361
|
if (fL) getById("left-col", HTMLDivElement).style.flex = fL;
|
|
8040
8362
|
} finally {
|
|
8041
|
-
|
|
8042
|
-
//
|
|
8043
|
-
//
|
|
8044
|
-
|
|
8363
|
+
// Each value is read once, at startup. saveState() writes them again as the page goes.
|
|
8364
|
+
// Only this video's: another video in this tab keeps its own until it loads.
|
|
8365
|
+
// The plain names are from before 0.8.4, when every video shared them.
|
|
8366
|
+
for (const name of PER_VIDEO_SESSION_KEYS) {
|
|
8367
|
+
sessionStorage.removeItem(name);
|
|
8368
|
+
// Keep the unload backup until initFromDB() has saved it. If the page reloads before
|
|
8369
|
+
// then, saveOnUnload() saves nothing, so this is the only copy.
|
|
8370
|
+
if (name !== "pendingScheduleSave") {
|
|
8371
|
+
sessionStorage.removeItem(sessionKey(name));
|
|
8372
|
+
}
|
|
8373
|
+
}
|
|
8374
|
+
if (
|
|
8375
|
+
unloadBackup !== null &&
|
|
8376
|
+
sessionStorage.getItem(sessionKey("pendingScheduleSave")) === null
|
|
8377
|
+
) {
|
|
8378
|
+
// It was under the old plain name, removed just above.
|
|
8045
8379
|
try {
|
|
8046
|
-
sessionStorage.setItem("pendingScheduleSave", unloadBackup);
|
|
8380
|
+
sessionStorage.setItem(sessionKey("pendingScheduleSave"), unloadBackup);
|
|
8047
8381
|
} catch {
|
|
8048
8382
|
// It fit a moment ago.
|
|
8049
8383
|
}
|
|
@@ -8294,8 +8628,9 @@ getById("dumpDbBtn", HTMLButtonElement).addEventListener("click", async () => {
|
|
|
8294
8628
|
const pre = getById("dbDump", HTMLPreElement);
|
|
8295
8629
|
const lines: string[] = [];
|
|
8296
8630
|
|
|
8631
|
+
const entryCount = videoRecord?.entries.length ?? 0;
|
|
8297
8632
|
lines.push(
|
|
8298
|
-
`=== videos["${toShowKey}"] — ${
|
|
8633
|
+
`=== videos["${toShowKey}"] — ${entryCount} ${entryCount === 1 ? "entry" : "entries"} ===`,
|
|
8299
8634
|
);
|
|
8300
8635
|
const latest = videoRecord?.entries.at(-1);
|
|
8301
8636
|
lines.push(latest ? JSON.stringify(latest, null, 2) : "(none)");
|
|
@@ -8404,7 +8739,7 @@ async function fetchJsonSnapshot(): Promise<FetchJsonResult> {
|
|
|
8404
8739
|
*
|
|
8405
8740
|
* A stored entry now covers the entire video, but the Load dialog has always acted on
|
|
8406
8741
|
* whatever the chapter selector points at. Locating `target` inside the snapshot keeps that
|
|
8407
|
-
*
|
|
8742
|
+
* behavior: picking an older entry while a single slide is selected reverts that slide and
|
|
8408
8743
|
* leaves its siblings alone. Selecting the root applies everything.
|
|
8409
8744
|
*/
|
|
8410
8745
|
function applyScopedToTarget(
|
|
@@ -8567,25 +8902,25 @@ function initResizeHandle(handle: HTMLElement, topPane: HTMLElement): void {
|
|
|
8567
8902
|
}
|
|
8568
8903
|
|
|
8569
8904
|
initResizeHandle(
|
|
8570
|
-
getById("
|
|
8905
|
+
getById("h-resize-left", HTMLDivElement),
|
|
8571
8906
|
getById("top-left", HTMLDivElement),
|
|
8572
8907
|
);
|
|
8573
8908
|
initResizeHandle(
|
|
8574
|
-
getById("
|
|
8909
|
+
getById("h-resize-right", HTMLDivElement),
|
|
8575
8910
|
getById("top-right", HTMLDivElement),
|
|
8576
8911
|
);
|
|
8577
8912
|
|
|
8578
8913
|
{
|
|
8579
|
-
const
|
|
8914
|
+
const vHandle = getById("v-resize", HTMLDivElement);
|
|
8580
8915
|
const leftCol = getById("left-col", HTMLDivElement);
|
|
8581
8916
|
const MIN_COL = 80;
|
|
8582
8917
|
const vStorageKey = "pane-width-left-col";
|
|
8583
8918
|
|
|
8584
|
-
|
|
8919
|
+
vHandle.addEventListener("mousedown", (startEvent) => {
|
|
8585
8920
|
startEvent.preventDefault();
|
|
8586
|
-
|
|
8921
|
+
vHandle.classList.add("dragging");
|
|
8587
8922
|
const totalW = document.body.getBoundingClientRect().width;
|
|
8588
|
-
const handleW =
|
|
8923
|
+
const handleW = vHandle.getBoundingClientRect().width;
|
|
8589
8924
|
const startClientX = startEvent.clientX;
|
|
8590
8925
|
const startColW = leftCol.getBoundingClientRect().width;
|
|
8591
8926
|
|
|
@@ -8602,7 +8937,7 @@ initResizeHandle(
|
|
|
8602
8937
|
};
|
|
8603
8938
|
|
|
8604
8939
|
const onUp = () => {
|
|
8605
|
-
|
|
8940
|
+
vHandle.classList.remove("dragging");
|
|
8606
8941
|
document.removeEventListener("mousemove", onMove);
|
|
8607
8942
|
document.removeEventListener("mouseup", onUp);
|
|
8608
8943
|
// flex is "0 0 X%" — store just the percentage part
|