slidetake 0.3.3 → 0.4.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/README.md +11 -11
- package/dist/index.html +1918 -311
- package/dist/slidetake.js +551 -330
- package/package.json +1 -1
package/dist/index.html
CHANGED
|
@@ -119,6 +119,10 @@
|
|
|
119
119
|
.brand .mark .word > span{color:var(--accent);}
|
|
120
120
|
/* Slidetake's two-tone name in its own decks' titles, as in the header */
|
|
121
121
|
.node .body .st-take{color:var(--accent);}
|
|
122
|
+
.node .body .st-name{white-space:nowrap;color:var(--text);}
|
|
123
|
+
/* in bold the rest of the name (Studio) keeps the text colour too, not the accent bold text takes */
|
|
124
|
+
.node .body strong:has(> .st-name){color:var(--text);}
|
|
125
|
+
.node .body .st-name .logo{width:1em;height:1em;vertical-align:-.14em;margin-right:.2em;fill:var(--accent);}
|
|
122
126
|
/* the Record button's red, where a deck names the button; deeper on white so it reads */
|
|
123
127
|
.node .body .st-rec{color:#f87171;}
|
|
124
128
|
body[data-mode="light"] .node .body .st-rec{color:#dc2626;}
|
|
@@ -132,25 +136,39 @@
|
|
|
132
136
|
.brand .site-link:hover, .brand .site-link:focus-visible{color:var(--accent);}
|
|
133
137
|
.brand .site-link svg{width:15px;height:15px;display:block;margin-right:5px;}
|
|
134
138
|
.hdr-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;}
|
|
139
|
+
/* Buttons come in four kinds, and only these:
|
|
140
|
+
1. a button: a grey outline that turns accent on hover; regular (32px) or .small (24px); .icon makes it square
|
|
141
|
+
2. an accent button (.primary, and .rec in red): the one main action of a dialog or bar. Coloured text, the
|
|
142
|
+
same grey outline as any button, filling with its colour on hover
|
|
143
|
+
3. selected (.toggle.on, .seg-btn.active, .rv-chip.on, a chosen card): the accent outline on a light accent tint
|
|
144
|
+
4. bare (.close, the deck's floating bar): no outline at all */
|
|
135
145
|
.btn{
|
|
136
146
|
background:transparent;color:var(--text);
|
|
137
|
-
border:1px solid var(--node-border);border-radius:6px;
|
|
138
|
-
padding:
|
|
139
|
-
display:flex;align-items:center;gap:6px;
|
|
147
|
+
border:1px solid var(--node-border);border-radius:6px;box-sizing:border-box;
|
|
148
|
+
height:32px;padding:0 12px;font-size:12px;letter-spacing:.02em;white-space:nowrap;cursor:pointer;
|
|
149
|
+
display:inline-flex;align-items:center;justify-content:center;gap:6px;
|
|
140
150
|
transition:border-color .15s, color .15s, background .15s;
|
|
141
151
|
}
|
|
152
|
+
.btn.small{height:24px;padding:0 9px;font-size:11px;}
|
|
153
|
+
.btn.icon{width:32px;padding:0;}
|
|
154
|
+
.btn.small.icon{width:24px;}
|
|
155
|
+
.btn.icon svg{width:15px;height:15px;display:block;}
|
|
156
|
+
.btn .ico{font-size:1.1em;line-height:1;}
|
|
142
157
|
a.btn{text-decoration:none;}
|
|
143
|
-
.btn:hover{border-color:var(--accent);color:var(--accent);}
|
|
144
|
-
.btn
|
|
145
|
-
.btn.primary
|
|
146
|
-
.btn.
|
|
147
|
-
.
|
|
158
|
+
.btn:hover:not(:disabled){border-color:var(--accent);color:var(--accent);}
|
|
159
|
+
.btn:disabled{opacity:.4;cursor:not-allowed;}
|
|
160
|
+
.btn.primary{color:var(--accent);}
|
|
161
|
+
.btn.primary:hover:not(:disabled){background:var(--accent);border-color:var(--accent);color:var(--on-accent);}
|
|
162
|
+
.btn.rec{color:#f87171;}
|
|
163
|
+
.btn.rec:hover:not(:disabled){background:#b91c1c;border-color:#b91c1c;color:#fff;}
|
|
164
|
+
.btn.toggle{color:var(--text-muted);}
|
|
165
|
+
.btn.active, .btn.toggle.on, .seg-btn.active{border-color:var(--accent);color:var(--accent);background:color-mix(in srgb, var(--accent) 10%, transparent);}
|
|
166
|
+
.seg{display:inline-flex;height:32px;box-sizing:border-box;border:1px solid var(--node-border);border-radius:6px;overflow:hidden;}
|
|
148
167
|
.seg-btn{
|
|
149
|
-
background:transparent;border:none;color:var(--text-muted);font-family:var(--mono);
|
|
150
|
-
font-size:12px;padding:
|
|
168
|
+
background:transparent;border:none;color:var(--text-muted);font-family:var(--mono);height:100%;
|
|
169
|
+
font-size:12px;padding:0 12px;cursor:pointer;display:flex;align-items:center;transition:background .15s,color .15s;
|
|
151
170
|
}
|
|
152
171
|
.seg-btn:hover{color:var(--accent);}
|
|
153
|
-
.seg-btn.active{background:var(--node-border);color:var(--accent);}
|
|
154
172
|
|
|
155
173
|
/* ---------- main layout ---------- */
|
|
156
174
|
main{flex:1;display:flex;min-height:0;}
|
|
@@ -183,24 +201,16 @@
|
|
|
183
201
|
.modal ul.templates span{font-size:12px;color:var(--text-muted);}
|
|
184
202
|
/* the analytics choice: two cards, the chosen one in the accent */
|
|
185
203
|
.modal .choices{display:grid;gap:8px;margin:12px 0;}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
.modal .choice:hover{border-color:var(--accent
|
|
189
|
-
.modal .choice[aria-checked="true"]{border-color:var(--accent);background:color-mix(in srgb, var(--accent)
|
|
204
|
+
/* a choice card (analytics on or off; recording in the browser or with OBS): the chosen one looks selected */
|
|
205
|
+
.modal .choice{padding:10px 12px;border:1px solid var(--panel-line);border-radius:8px;background:transparent;color:var(--text);font:inherit;cursor:pointer;}
|
|
206
|
+
.modal .choice:hover{border-color:var(--accent);}
|
|
207
|
+
.modal .choice[aria-checked="true"]{border-color:var(--accent);background:color-mix(in srgb, var(--accent) 10%, transparent);}
|
|
208
|
+
.modal .choice{display:flex;flex-direction:column;gap:4px;text-align:left;}
|
|
190
209
|
.modal .choice strong{font-family:var(--display);font-size:14px;}
|
|
191
210
|
.modal .choice span{font-size:12px;line-height:1.55;color:var(--text-muted);}
|
|
192
211
|
.modal .note{font-size:12px;}
|
|
193
212
|
#editor-pane.unsaved .pane-bar{box-shadow:inset 0 -2px 0 var(--accent);}
|
|
194
|
-
#editor-pane.unsaved #btn-share, #editor-pane.unsaved #btn-save{
|
|
195
|
-
.btn.small{padding:3px 9px;font-size:11px;}
|
|
196
|
-
.btn.icon{padding:4px 9px;min-width:30px;display:inline-flex;align-items:center;justify-content:center;}
|
|
197
|
-
.btn.icon svg{width:15px;height:15px;display:block;}
|
|
198
|
-
/* in the header, icon buttons stand as tall as the layout switch and the text buttons beside them */
|
|
199
|
-
.hdr-actions .btn.icon{height:32px;min-width:32px;padding:0 8px;}
|
|
200
|
-
/* every header control is exactly 32px, whatever the font's line height, so they line up on any machine */
|
|
201
|
-
.hdr-actions > .btn, .hdr-actions > .seg{height:32px;}
|
|
202
|
-
.hdr-actions > .btn:not(.icon){padding-top:0;padding-bottom:0;}
|
|
203
|
-
.hdr-actions .seg-btn{height:100%;display:flex;align-items:center;padding-top:0;padding-bottom:0;}
|
|
213
|
+
#editor-pane.unsaved #btn-share, #editor-pane.unsaved #btn-save{color:var(--accent);}
|
|
204
214
|
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;}
|
|
205
215
|
.pane-label{
|
|
206
216
|
font-family:var(--mono);font-size:10px;letter-spacing:.12em;text-transform:uppercase;
|
|
@@ -313,6 +323,11 @@
|
|
|
313
323
|
padding:10px 12px;overflow-x:auto;margin:0 0 10px;
|
|
314
324
|
}
|
|
315
325
|
.node .body pre code{border:none;background:none;padding:0;color:var(--text);}
|
|
326
|
+
/* a long line scrolls on a slim accent bar, not the system's grey one */
|
|
327
|
+
.node .body pre{scrollbar-width:thin;scrollbar-color:color-mix(in srgb, var(--accent) 45%, transparent) transparent;}
|
|
328
|
+
.node .body pre::-webkit-scrollbar{height:5px;}
|
|
329
|
+
.node .body pre::-webkit-scrollbar-track{background:transparent;}
|
|
330
|
+
.node .body pre::-webkit-scrollbar-thumb{background:color-mix(in srgb, var(--accent) 45%, transparent);border-radius:3px;}
|
|
316
331
|
.node .body strong{color:var(--accent);}
|
|
317
332
|
.node .body a{color:var(--accent-teal);}
|
|
318
333
|
.node .body a.xlink::after{content:" ↗";font-size:10px;}
|
|
@@ -333,7 +348,10 @@
|
|
|
333
348
|
.modal h3{font-family:var(--display);font-size:13px;margin:18px 0 8px;color:var(--text);display:flex;align-items:center;gap:10px;}
|
|
334
349
|
.modal p, .modal li{font-size:13px;line-height:1.6;color:var(--text-muted);margin:0 0 6px;}
|
|
335
350
|
.modal ul{padding-left:18px;margin:0;}
|
|
336
|
-
|
|
351
|
+
/* ✕ Close: a regular button at the top right, on the title's line (with ⚙ Setup beside it on the board) */
|
|
352
|
+
.modal .panel > .close, .modal .panel-actions{position:absolute;top:20px;right:24px;}
|
|
353
|
+
.modal .panel-actions{display:flex;gap:8px;}
|
|
354
|
+
.modal h2{padding-right:96px;}
|
|
337
355
|
.modal .fields{display:grid;grid-template-columns:2fr 1fr 2fr;gap:10px;}
|
|
338
356
|
#open-form{display:flex;gap:8px;margin:12px 0 6px;}
|
|
339
357
|
#help table.keys{border-collapse:collapse;margin:6px 0 12px;font-size:13px;}
|
|
@@ -356,24 +374,34 @@
|
|
|
356
374
|
.modal textarea{width:100%;resize:vertical;line-height:1.6;}
|
|
357
375
|
.modal .row{display:flex;align-items:center;gap:10px;margin-top:12px;flex-wrap:wrap;}
|
|
358
376
|
.modal .row.end{justify-content:flex-end;margin-top:20px;}
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
#obs-status{font-family:var(--mono);font-size:12px;color:var(--text-muted);}
|
|
377
|
+
#obs-status{font-family:var(--mono);font-size:12px;color:var(--text-muted);white-space:nowrap;}
|
|
378
|
+
#obs-detail{color:var(--danger);}
|
|
362
379
|
#obs-status.ok, #rec-screen .ok{color:#10b981;}
|
|
363
380
|
#rec-screen a{color:inherit;text-decoration:underline;}
|
|
364
381
|
#obs-status.err{color:var(--danger);}
|
|
365
382
|
.modal .warn{color:var(--accent);}
|
|
383
|
+
#rv-setup .warn{color:var(--danger);}
|
|
366
384
|
@media (max-width:560px){ .modal .fields{grid-template-columns:1fr;} }
|
|
367
|
-
|
|
368
|
-
#
|
|
369
|
-
|
|
370
|
-
|
|
385
|
+
/* Studio, beside the Editor: an accent dot (red is for ● Record itself); lit, like the Editor, while open */
|
|
386
|
+
#btn-studio .rec-dot{color:var(--accent);}
|
|
387
|
+
/* phones and tablets can't record */
|
|
388
|
+
@media (pointer:coarse){ #btn-studio{display:none;} }
|
|
389
|
+
/* the bottom bar: Keys, Camera, Fullscreen, each in the accent while it is on */
|
|
371
390
|
#btn-camera{display:inline-flex;align-items:center;gap:6px;}
|
|
372
391
|
#btn-camera svg{display:block;}
|
|
373
|
-
#navbar
|
|
392
|
+
#navbar button.on{color:var(--accent);background:color-mix(in srgb, var(--accent) 14%, transparent);}
|
|
374
393
|
/* while a take runs nothing but the slides and the camera is on screen */
|
|
375
394
|
body.recording #breadcrumbs, body.recording #navbar, body.recording #minimap, body.recording #pip-msg{display:none !important;}
|
|
376
395
|
body.recording, body.recording *{cursor:none !important;}
|
|
396
|
+
/* a retake's jump back to the slide before: no transition may ease it into place */
|
|
397
|
+
body.no-anim *, body.no-anim *::before, body.no-anim *::after{transition:none !important;animation:none !important;}
|
|
398
|
+
/* recording in the browser: the deck in a 16:9 frame, the only part captured. Chrome captures an element
|
|
399
|
+
only while it is its own stacking context, hence the isolation (without it the capture is silently empty). */
|
|
400
|
+
body.rec-frame main{background:#000;}
|
|
401
|
+
body.rec-frame #stage-wrap{flex:none;margin:auto;width:min(100%, calc(100vh * 16 / 9));aspect-ratio:16/9;isolation:isolate;}
|
|
402
|
+
#review.in-browser #rv-novideo{display:none !important;}
|
|
403
|
+
/* the takes screen records in this browser, or with OBS: each mode's own controls */
|
|
404
|
+
#review.obs .for-browser, #review:not(.obs) .for-obs{display:none !important;}
|
|
377
405
|
#rec-countdown{
|
|
378
406
|
position:fixed;inset:0;z-index:70;display:none;align-items:center;justify-content:center;flex-direction:column;gap:14px;
|
|
379
407
|
background:rgba(4,7,13,.9);font-family:var(--display);color:var(--accent);
|
|
@@ -386,15 +414,85 @@
|
|
|
386
414
|
background:rgba(4,7,13,.94);font-family:var(--mono);font-size:15px;color:var(--text-muted);letter-spacing:.06em;
|
|
387
415
|
}
|
|
388
416
|
#rec-paused.show{display:flex;}
|
|
389
|
-
.modal .panel.xwide{width:min(
|
|
390
|
-
|
|
391
|
-
|
|
417
|
+
.modal .panel.xwide{width:min(1480px,100%);max-height:94vh;}
|
|
418
|
+
/* scrollbars: thin, in the accent */
|
|
419
|
+
.modal .panel, .rv-list, .modal textarea{scrollbar-width:thin;scrollbar-color:color-mix(in srgb, var(--accent) 45%, transparent) transparent;}
|
|
420
|
+
/* the player and the take list side by side, the list exactly as tall as the player (it scrolls inside that);
|
|
421
|
+
play and download under both */
|
|
422
|
+
.rv-grid{display:grid;grid-template-columns:minmax(0,7fr) minmax(280px,3fr);grid-template-areas:"video list" "bar dl";
|
|
423
|
+
column-gap:18px;margin-top:12px;}
|
|
424
|
+
.rv-grid > div:first-child{display:contents;}
|
|
425
|
+
.rv-video{grid-area:video;}
|
|
426
|
+
.rv-list{grid-area:list;contain:size;}
|
|
427
|
+
.rv-bar{grid-area:bar;display:flex;align-items:center;gap:10px;margin-top:12px;min-width:0;}
|
|
428
|
+
.rv-purge{position:relative;}
|
|
429
|
+
.rv-purge summary{list-style:none;font-family:var(--mono);}
|
|
430
|
+
.rv-purge summary::-webkit-details-marker{display:none;}
|
|
431
|
+
.rv-purge .rv-menu{position:absolute;left:0;top:calc(100% + 6px);display:flex;flex-direction:column;gap:6px;padding:8px;z-index:3;
|
|
432
|
+
background:var(--panel);border:1px solid var(--panel-line);border-radius:8px;box-shadow:0 8px 24px rgba(0,0,0,.35);white-space:nowrap;}
|
|
433
|
+
/* the take board: every slide, a box to select it for recording, its takes */
|
|
434
|
+
.rv-row.with-sel{display:grid;grid-template-columns:auto minmax(0,1fr);column-gap:10px;align-items:start;}
|
|
435
|
+
.rv-row .rv-sel{margin:3px 0 0;accent-color:var(--accent);}
|
|
436
|
+
.rv-row.selected{background:color-mix(in srgb, var(--accent) 7%, transparent);}
|
|
437
|
+
.rv-row.playing{box-shadow:inset 3px 0 0 var(--accent);}
|
|
438
|
+
.rv-chip.outdated{opacity:.6;text-decoration:line-through;}
|
|
439
|
+
.rv-none{font-size:12px;color:var(--text-muted);font-style:italic;}
|
|
440
|
+
/* Recording setup: opened from the ⚙ Setup button at the top right, shown under the title */
|
|
441
|
+
.modal .rv-setup-btn[aria-expanded="true"]{border-color:var(--accent);color:var(--accent);background:color-mix(in srgb, var(--accent) 10%, transparent);}
|
|
442
|
+
#rv-setup{margin:12px 0 12px;border:1px solid var(--panel-line);border-radius:8px;padding:10px 14px;}
|
|
443
|
+
#rv-setup > summary{display:none;}
|
|
444
|
+
#rv-setup:not([open]){display:none;}
|
|
445
|
+
#review h2.rv-brand{display:flex;align-items:center;gap:8px;color:var(--text);}
|
|
446
|
+
#review h2.rv-brand .logo{width:22px;height:22px;fill:var(--accent);flex:none;}
|
|
447
|
+
#review h2.rv-brand .word > span{color:var(--accent);}
|
|
448
|
+
.rv-using{align-self:center;max-width:34vw;font-family:var(--mono);font-size:12px;color:var(--text-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
|
|
449
|
+
#review h2{padding-right:calc(34vw + 200px);}
|
|
450
|
+
@media (max-width:900px){ .rv-using{display:none;} #review h2{padding-right:190px;} }
|
|
451
|
+
/* three sections side by side: Camera, Microphone, Video; Use OBS at the top right */
|
|
452
|
+
.rv-setup-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:12px;padding-bottom:10px;border-bottom:1px solid var(--panel-line);}
|
|
453
|
+
.rv-setup-head h4{margin:0;font-family:var(--display);font-size:13px;color:var(--text-muted);}
|
|
454
|
+
.rv-setup-cols{display:grid;grid-template-columns:repeat(3, minmax(0, 1fr));gap:18px;}
|
|
455
|
+
.rv-setup-cols section{display:flex;flex-direction:column;gap:8px;min-width:0;}
|
|
456
|
+
.rv-setup-cols h4{margin:0;font-family:var(--display);font-size:13px;color:var(--text);}
|
|
457
|
+
.rv-setup-cols select{width:100%;}
|
|
458
|
+
.rv-setup-cols #rv-fps{width:auto;}
|
|
459
|
+
.rv-setup-cols meter{width:100%;height:8px;}
|
|
460
|
+
.rv-setup-row{display:flex;flex-wrap:wrap;gap:8px;align-items:center;}
|
|
461
|
+
.rv-setup-gap{flex:1}
|
|
462
|
+
.rv-files{margin-left:auto;}
|
|
463
|
+
.rv-files .rv-menu{left:auto;right:0;}
|
|
464
|
+
.rv-obs-fields{display:grid;grid-template-columns:minmax(0,1.2fr) 60px minmax(0,1fr);gap:6px;}
|
|
465
|
+
.modal .rv-obs-fields input{width:100%;min-width:0;font-size:11.5px;padding:4px 8px;}
|
|
466
|
+
.rv-setup-foot{display:flex;flex-wrap:wrap;align-items:center;gap:8px 16px;margin-top:14px;padding-top:10px;border-top:1px solid var(--panel-line);}
|
|
467
|
+
.modal .rv-setup-foot label{flex-direction:row;align-items:center;gap:8px;margin:0;}
|
|
468
|
+
.rv-setup-foot select{width:auto;}
|
|
469
|
+
.modal .rv-setup-row label.check{gap:6px;margin:0;}
|
|
470
|
+
.rv-setup-label{font-size:12px;color:var(--text-muted);}
|
|
471
|
+
.seg.small{height:24px;}
|
|
472
|
+
.seg.small .seg-btn{font-size:11px;padding:0 10px;}
|
|
473
|
+
.rv-setup-note{margin:0;font-size:12px;color:var(--text-muted);line-height:1.5;}
|
|
474
|
+
#rv-setup > .rv-setup-note{margin-top:12px;}
|
|
475
|
+
@media (max-width:900px){ .rv-setup-cols{grid-template-columns:1fr;} }
|
|
476
|
+
.rv-final{font-family:var(--mono);font-size:12px;color:var(--text-muted);white-space:nowrap;}
|
|
477
|
+
/* under the takes: the final cut's size, and Download */
|
|
478
|
+
.rv-dl{grid-area:dl;display:flex;align-items:center;justify-content:flex-end;gap:10px;margin-top:12px;}
|
|
479
|
+
#rv-chapters{margin-right:auto;min-width:112px;}
|
|
480
|
+
/* Preview and Pause: one width, so the button doesn't change size as it switches */
|
|
481
|
+
.btn.rv-preview{min-width:104px;}
|
|
482
|
+
@media (max-width:900px){
|
|
483
|
+
.rv-grid{grid-template-columns:1fr;grid-template-areas:"video" "bar" "list" "dl";}
|
|
484
|
+
.rv-list{contain:none;max-height:50vh;margin-top:12px;}
|
|
485
|
+
}
|
|
392
486
|
.rv-video{position:relative;background:#000;border-radius:8px;overflow:hidden;aspect-ratio:16/9;}
|
|
393
487
|
.rv-video video{width:100%;height:100%;display:block;}
|
|
394
488
|
#rv-novideo{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:20px;text-align:center;}
|
|
395
489
|
#rv-novideo[hidden]{display:none;}
|
|
396
|
-
|
|
397
|
-
|
|
490
|
+
/* the preview's message, right before Preview */
|
|
491
|
+
#rv-now{flex:1;min-width:0;text-align:right;font-family:var(--mono);font-size:12px;color:var(--text-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
|
|
492
|
+
#rv-now.warn{color:var(--danger);}
|
|
493
|
+
#rv-now .btn{vertical-align:middle;margin-right:6px;}
|
|
494
|
+
#rv-render-btn, #rv-ffmpeg-copy{min-width:120px;}
|
|
495
|
+
.rv-list{overflow-y:auto;border:1px solid var(--panel-line);border-radius:8px;}
|
|
398
496
|
.rv-row{padding:9px 12px;border-bottom:1px solid var(--panel-line);}
|
|
399
497
|
.rv-row:last-child{border-bottom:none;}
|
|
400
498
|
.rv-row .t{font-size:12.5px;color:var(--text);margin-bottom:6px;display:flex;justify-content:space-between;gap:8px;}
|
|
@@ -403,14 +501,10 @@
|
|
|
403
501
|
.rv-chips{display:flex;flex-wrap:wrap;gap:6px;}
|
|
404
502
|
.rv-chip{background:transparent;border:1px solid var(--node-border);color:var(--text-muted);border-radius:20px;
|
|
405
503
|
font-family:var(--mono);font-size:11px;padding:3px 10px;cursor:pointer;}
|
|
406
|
-
.rv-chip:hover{border-color:var(--accent
|
|
504
|
+
.rv-chip:hover{border-color:var(--accent);color:var(--accent);}
|
|
407
505
|
.rv-chip.on{border-color:var(--accent);color:var(--accent);background:color-mix(in srgb, var(--accent) 10%, transparent);}
|
|
408
506
|
.rv-chip.skip.on{border-color:var(--danger);color:var(--danger);background:rgba(224,100,92,.1);}
|
|
409
|
-
.rv-out{margin-top:6px;}
|
|
410
|
-
.rv-out .two{display:grid;grid-template-columns:1fr 1fr;gap:12px;}
|
|
411
|
-
@media (max-width:900px){ .rv-out .two{grid-template-columns:1fr;} }
|
|
412
507
|
.modal select{background:var(--code-bg);border:1px solid var(--node-border);border-radius:6px;color:var(--text);font-family:var(--mono);font-size:11.5px;padding:4px 8px;}
|
|
413
|
-
#rec-sessions{margin-top:14px;}
|
|
414
508
|
|
|
415
509
|
/* ---------- reveal.js compatibility: fragments, stacks, diagrams, charts ---------- */
|
|
416
510
|
.node .fragment{opacity:0;visibility:hidden;transition:opacity .45s ease, transform .45s ease, visibility 0s .45s;}
|
|
@@ -444,7 +538,9 @@
|
|
|
444
538
|
/* ---------- media from plain markdown (see applyMedia) ---------- */
|
|
445
539
|
.node .body figure.media{margin:0;}
|
|
446
540
|
.node .body figure.media img{display:block;width:100%;height:auto;max-height:70vh;object-fit:contain;border-radius:8px;}
|
|
447
|
-
.node .body figure.media
|
|
541
|
+
.node .body figure.media.yt + *{margin-top:10px;}
|
|
542
|
+
/* one caption size on every kind of image card: the size of the text (.node .body p) */
|
|
543
|
+
.node .body figure.media figcaption{margin-top:8px;font-size:13px;color:var(--text-muted);line-height:1.45;}
|
|
448
544
|
.node .body figure.yt .frame{position:relative;width:100%;aspect-ratio:16/9;border-radius:8px;overflow:hidden;background:#000;}
|
|
449
545
|
.node .body figure.yt.portrait .frame{aspect-ratio:9/16;max-height:70vh;width:auto;margin:0 auto;}
|
|
450
546
|
.node .body figure.yt iframe{position:absolute;inset:0;width:100%;height:100%;border:0;}
|
|
@@ -457,12 +553,11 @@
|
|
|
457
553
|
.node .body .gallery{list-style:none;padding:0;margin:8px 0 0;display:grid;grid-template-columns:repeat(var(--cols,3),minmax(0,1fr));gap:14px;align-items:end;}
|
|
458
554
|
.node .body .gallery li{margin:0;}
|
|
459
555
|
.node .body .gallery figure.media img{max-height:calc(56vh / var(--rows,1));margin:0 auto;}
|
|
460
|
-
.node .body .gallery figure.media figcaption{
|
|
556
|
+
.node .body .gallery figure.media figcaption{text-align:center;}
|
|
461
557
|
/* a stepped gallery: the images stack in one place and each press brings the next */
|
|
462
558
|
.node .body .gallery.carousel{grid-template-columns:minmax(0,1fr);}
|
|
463
559
|
.node .body .gallery.carousel > li{grid-area:1/1;}
|
|
464
560
|
.node .body .gallery.carousel figure.media img{max-height:58vh;}
|
|
465
|
-
.node .body .gallery.carousel figure.media figcaption{font-size:.82em;}
|
|
466
561
|
.node .body .gallery.carousel figcaption[data-count]::before{content:attr(data-count) " ";color:var(--accent);font-weight:600;white-space:pre;}
|
|
467
562
|
.node .body .gallery.carousel:has(> li.visible) > li:not(.fragment){opacity:0;visibility:hidden;transition:opacity .45s ease, visibility 0s .45s;}
|
|
468
563
|
.node .body .gallery.carousel > li:not(.fragment){transition:opacity .45s ease;}
|
|
@@ -471,20 +566,19 @@
|
|
|
471
566
|
.node.card-bleed .body .gallery{margin:0;}
|
|
472
567
|
.node.card-bleed .body figure.media img,
|
|
473
568
|
.node.card-bleed .body .gallery.carousel figure.media img{max-height:none;border-radius:0;background:var(--code-bg);}
|
|
474
|
-
.node.card-bleed .body figure.media figcaption{margin:0;text-align:left;
|
|
569
|
+
.node.card-bleed .body figure.media figcaption{margin:0;text-align:left;}
|
|
475
570
|
/* landscape: the image spans the card; the heading sits above it, the caption below */
|
|
476
571
|
.node.img-landscape .crumb{margin:12px 18px 4px;}
|
|
477
572
|
.node.img-landscape .body > :is(h1,h2,h3,h4,h5,h6):first-child{margin:0 18px 10px;}
|
|
478
573
|
.node.img-landscape .body figure.media img{width:100%;height:var(--img-h);object-fit:contain;}
|
|
479
574
|
.node.img-landscape .body figure.media figcaption{padding:10px 18px 14px;}
|
|
480
575
|
/* portrait or near-square: the image on the right at the card's height; the heading and caption share the left */
|
|
481
|
-
div.node.img-portrait{height:540px;padding:20px calc(var(--img-w) + 26px) 22px 24px;}
|
|
482
|
-
|
|
576
|
+
div.node.img-portrait{height:540px;padding:20px calc(var(--img-w) + 26px) 22px 24px;display:flex;flex-direction:column;}
|
|
577
|
+
/* the text column takes what the breadcrumb leaves, so the caption ends inside the card */
|
|
578
|
+
.node.img-portrait .body{display:flex;flex-direction:column;flex:1;min-height:0;}
|
|
483
579
|
.node.img-portrait .crumb{margin-bottom:10px;}
|
|
484
|
-
.node.img-portrait .body > :is(h1,h2,h3,h4,h5,h6):first-child{font-size:22px;}
|
|
485
580
|
.node.img-portrait .body > .gallery, .node.img-portrait .body > figure.media{margin-top:auto;}
|
|
486
581
|
.node.img-portrait .body figure.media img{position:absolute;top:0;right:0;width:var(--img-w);height:540px;object-fit:contain;}
|
|
487
|
-
.node.img-portrait .body figure.media figcaption, .node.img-portrait .body .gallery.carousel figure.media figcaption{font-size:1.35em;line-height:1.45;color:var(--text);}
|
|
488
582
|
/* 16:9, or a full-screen card: the image fills the card, the heading and caption over it */
|
|
489
583
|
.node.img-overlay::before{content:"";position:absolute;inset:0 0 auto;height:96px;z-index:2;pointer-events:none;
|
|
490
584
|
background:linear-gradient(rgba(0,0,0,.72), rgba(0,0,0,0));border-radius:8px 8px 0 0;}
|
|
@@ -492,7 +586,8 @@
|
|
|
492
586
|
.node.img-overlay .body > :is(h1,h2,h3,h4,h5,h6):first-child{position:absolute;top:28px;left:18px;right:18px;z-index:3;margin:0;
|
|
493
587
|
color:#fff;text-shadow:0 1px 6px rgba(0,0,0,.6);}
|
|
494
588
|
.node.img-overlay .body figure.media{position:relative;}
|
|
495
|
-
.node.img-overlay .body figure.media img{width:100%;height:540px;object-fit:contain;}
|
|
589
|
+
.node.img-overlay .body figure.media img{width:100%;height:540px;object-fit:contain;background:#000;}
|
|
590
|
+
.node.img-overlay.img-cover .body figure.media img{object-fit:cover;}
|
|
496
591
|
.node.img-overlay .body figure.media figcaption{position:absolute;left:0;right:0;bottom:0;padding:36px 18px 14px;
|
|
497
592
|
color:#f4f4f5;background:linear-gradient(rgba(0,0,0,0), rgba(0,0,0,.78));}
|
|
498
593
|
.node.img-overlay .body .gallery.carousel figure.media figcaption::before{color:color-mix(in srgb, var(--accent) 55%, #fff);}
|
|
@@ -509,8 +604,8 @@
|
|
|
509
604
|
.node .diagram{background:#f8fafc;border:1px solid var(--panel-line);border-radius:8px;padding:12px;margin:0 0 10px;overflow:auto;}
|
|
510
605
|
.node .diagram svg{display:block;width:100%;height:auto;max-height:640px;}
|
|
511
606
|
.node .diagram.err{background:none;color:var(--danger);font-family:var(--mono);font-size:12px;padding:0;}
|
|
512
|
-
/* D2
|
|
513
|
-
.node .diagram.d2{background:none;border:none;padding:0;}
|
|
607
|
+
/* D2 and Graphviz are drawn in the deck's own palette, so they need no light backdrop */
|
|
608
|
+
.node .diagram.d2, .node .diagram.dot{background:none;border:none;padding:0;}
|
|
514
609
|
/* a ```svg drawing is inline: currentColor is the card's text colour, and the deck's variables switch with dark and light */
|
|
515
610
|
.node .diagram.svg{background:none;border:none;padding:0;color:var(--text);}
|
|
516
611
|
.node .diagram.svg svg{max-height:62vh;}
|
|
@@ -581,6 +676,9 @@
|
|
|
581
676
|
#credit .logo{width:18px;height:18px;fill:var(--accent);}
|
|
582
677
|
#credit .word > span{color:var(--accent);}
|
|
583
678
|
#credit:hover{opacity:.85;}
|
|
679
|
+
/* on a site's coloured header in light mode the accent is the band's own colour, so the credit takes the header's ink */
|
|
680
|
+
html:not(.dark) body.st-header-color #credit .logo{fill:currentColor;}
|
|
681
|
+
html:not(.dark) body.st-header-color #credit .word > span{color:inherit;opacity:.78;}
|
|
584
682
|
html.embed .site-links, html.embed #btn-github, html.embed #btn-analytics{display:none !important;}
|
|
585
683
|
/* a reader's page (embedded, not recording): no bottom bar, except the arrows on touch screens */
|
|
586
684
|
html.embed.no-record #navbar{display:none;}
|
|
@@ -588,7 +686,7 @@
|
|
|
588
686
|
html.embed.no-record #navbar{display:flex;}
|
|
589
687
|
html.embed.no-record #navbar > :not(.touch-only){display:none !important;}
|
|
590
688
|
}
|
|
591
|
-
html.no-record #btn-camera, html.no-record #btn-
|
|
689
|
+
html.no-record #btn-camera, html.no-record #btn-studio, html.no-record #pip, html.no-record #help tr.rec{display:none !important;}
|
|
592
690
|
/* the logo written into a heading: #  Slidetake */
|
|
593
691
|
.node .body :is(h1,h2) img[src$="favicon.svg"]{height:1em;width:auto;vertical-align:-.12em;margin-right:.25em;display:inline;}
|
|
594
692
|
#brand .st-mark{display:inline-flex;align-items:center;gap:8px;font-family:var(--display);font-weight:700;font-size:20px;color:var(--text);}
|
|
@@ -651,7 +749,7 @@
|
|
|
651
749
|
background:var(--code-bg);border:1px solid var(--panel-line);border-radius:6px;
|
|
652
750
|
padding:10px 12px;font-family:var(--mono);font-size:11.5px;color:var(--text);overflow-x:auto;
|
|
653
751
|
}
|
|
654
|
-
#help .close{position:absolute;top:
|
|
752
|
+
#help .close{position:absolute;top:22px;right:16px;}
|
|
655
753
|
kbd{
|
|
656
754
|
font-family:var(--mono);background:var(--node-bg);border:1px solid var(--node-border);
|
|
657
755
|
border-radius:4px;padding:1px 6px;font-size:11px;color:var(--accent);
|
|
@@ -697,6 +795,7 @@
|
|
|
697
795
|
<button class="btn icon" id="btn-analytics" title="Privacy & analytics" aria-label="Privacy & analytics" hidden><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2"/></svg></button>
|
|
698
796
|
<button class="btn icon" id="btn-mode" title="Light / dark (L)" aria-label="Light / dark"></button>
|
|
699
797
|
<button class="btn" id="btn-edit-toggle" title="Editor: write, open, share (E)">✎ Editor</button>
|
|
798
|
+
<button class="btn" id="btn-studio" title="Slidetake Studio: record, review, download (R)"><span class="rec-dot" aria-hidden="true">●</span> Studio</button>
|
|
700
799
|
</div>
|
|
701
800
|
</header>
|
|
702
801
|
|
|
@@ -709,13 +808,11 @@
|
|
|
709
808
|
</div>
|
|
710
809
|
<div id="breadcrumbs"></div>
|
|
711
810
|
<div id="navbar">
|
|
712
|
-
<button id="btn-keys" title="Keyboard shortcuts (K)">⌨<span class="lbl"> Keys</span></button>
|
|
811
|
+
<button id="btn-keys" title="Keyboard shortcuts (K)" aria-pressed="false">⌨<span class="lbl"> Keys</span></button>
|
|
713
812
|
<button id="nav-prev" class="touch-only" title="Previous (←)" aria-label="Previous">←</button>
|
|
714
813
|
<button id="nav-next" class="touch-only" title="Next (→)" aria-label="Next">→</button>
|
|
715
|
-
<div class="divider"></div>
|
|
716
814
|
<button id="btn-camera" title="Camera (C)" aria-pressed="false"></button>
|
|
717
|
-
<button id="btn-
|
|
718
|
-
<button id="btn-present" title="Fullscreen (F)">⛶<span class="lbl"> Fullscreen</span></button>
|
|
815
|
+
<button id="btn-present" title="Fullscreen (F)" aria-pressed="false">⛶<span class="lbl"> Fullscreen</span></button>
|
|
719
816
|
</div>
|
|
720
817
|
<div id="progress" aria-hidden="true"></div>
|
|
721
818
|
<div id="minimap"><div class="mm-label" id="mm-label">map</div><svg id="mm-svg" width="180" height="130"></svg></div>
|
|
@@ -743,7 +840,7 @@
|
|
|
743
840
|
|
|
744
841
|
<div id="help">
|
|
745
842
|
<div class="panel">
|
|
746
|
-
<button class="close" id="help-close"
|
|
843
|
+
<button class="btn close" id="help-close">✕ Close</button>
|
|
747
844
|
<h2>Keys</h2>
|
|
748
845
|
<table class="keys">
|
|
749
846
|
<tr><td><kbd>→</kbd> <kbd>←</kbd> <kbd>Space</kbd></td><td>next / previous step</td></tr>
|
|
@@ -754,7 +851,7 @@
|
|
|
754
851
|
<tr><td><kbd>+</kbd> <kbd>−</kbd></td><td>bigger / smaller slides</td></tr>
|
|
755
852
|
<tr><td><kbd>E</kbd></td><td>editor: write, open, share</td></tr>
|
|
756
853
|
<tr><td><kbd>L</kbd></td><td>light / dark</td></tr>
|
|
757
|
-
<tr class="rec"><td><kbd>C</kbd> <kbd>V</kbd> <kbd>R</kbd></td><td>camera, camera layouts, record</td></tr>
|
|
854
|
+
<tr class="rec"><td><kbd>C</kbd> <kbd>V</kbd> <kbd>R</kbd></td><td>camera, camera layouts, Studio (record)</td></tr>
|
|
758
855
|
<tr><td><kbd>K</kbd> <kbd>?</kbd></td><td>this card; again or <kbd>Esc</kbd> closes it</td></tr>
|
|
759
856
|
</table>
|
|
760
857
|
<p>Drag to pan, scroll or pinch to zoom, click a card to fly to it.</p>
|
|
@@ -764,7 +861,7 @@
|
|
|
764
861
|
|
|
765
862
|
<div id="analytics-dialog" class="modal" role="dialog" aria-labelledby="analytics-title">
|
|
766
863
|
<div class="panel">
|
|
767
|
-
<button class="close" data-close
|
|
864
|
+
<button class="btn close" data-close>✕ Close</button>
|
|
768
865
|
<h2 id="analytics-title">Privacy & analytics</h2>
|
|
769
866
|
<p>Your decks, copies and recordings never leave this browser. This is only about counting visits to slidetake.com.</p>
|
|
770
867
|
<div class="choices" role="radiogroup" aria-label="Privacy & analytics">
|
|
@@ -783,7 +880,7 @@
|
|
|
783
880
|
|
|
784
881
|
<div id="new-dialog" class="modal" role="dialog" aria-labelledby="new-title">
|
|
785
882
|
<div class="panel">
|
|
786
|
-
<button class="close" data-close
|
|
883
|
+
<button class="btn close" data-close>✕ Close</button>
|
|
787
884
|
<h2 id="new-title">Start a new deck</h2>
|
|
788
885
|
<p>Pick a template. It opens as it is; start typing and it becomes your own copy at <code>/edit</code>.</p>
|
|
789
886
|
<ul class="templates">
|
|
@@ -798,7 +895,7 @@
|
|
|
798
895
|
|
|
799
896
|
<div id="open-dialog" class="modal" role="dialog" aria-labelledby="open-title">
|
|
800
897
|
<div class="panel">
|
|
801
|
-
<button class="close" data-close
|
|
898
|
+
<button class="btn close" data-close>✕ Close</button>
|
|
802
899
|
<h2 id="open-title">Load a deck from a link</h2>
|
|
803
900
|
<p>Paste a link to a markdown file: a GitHub file or folder, a gist, or any URL that allows other sites to read it.</p>
|
|
804
901
|
<form id="open-form" class="row">
|
|
@@ -817,48 +914,102 @@
|
|
|
817
914
|
</div>
|
|
818
915
|
</div>
|
|
819
916
|
|
|
820
|
-
<div id="rec-dialog" class="modal" role="dialog" aria-labelledby="rec-title">
|
|
821
|
-
<div class="panel">
|
|
822
|
-
<button class="close" data-close aria-label="Close">✕</button>
|
|
823
|
-
<h2 id="rec-title">Record a take</h2>
|
|
824
|
-
<p id="rec-deck-info"></p>
|
|
825
|
-
<p id="rec-screen"></p>
|
|
826
|
-
<h3>OBS</h3>
|
|
827
|
-
<div class="fields">
|
|
828
|
-
<label>Host<input type="text" id="obs-host" value="localhost" spellcheck="false"></label>
|
|
829
|
-
<label>Port<input type="text" id="obs-port" value="4455" inputmode="numeric"></label>
|
|
830
|
-
<label>Password<input type="password" id="obs-pass" autocomplete="off"></label>
|
|
831
|
-
</div>
|
|
832
|
-
<label class="check"><input type="checkbox" id="obs-remember"> Remember these on this computer</label>
|
|
833
|
-
<div class="row"><button class="btn" id="obs-connect">Connect</button><span id="obs-status">Not connected</span></div>
|
|
834
|
-
<p>In OBS: Tools → WebSocket Server Settings → enable it; the port and password are shown there. Point OBS at this browser window plus your microphone. No scenes are needed: the deck switches the camera itself.</p>
|
|
835
|
-
<h3>During the take</h3>
|
|
836
|
-
<ul>
|
|
837
|
-
<li><kbd>→</kbd> / clicker next: the next step. One more press after the last step ends the take and stops OBS.</li>
|
|
838
|
-
<li><kbd>←</kbd> / clicker back: <strong>take this slide again</strong>. Every attempt is kept; you pick the best one afterwards.</li>
|
|
839
|
-
<li><kbd>B</kbd> / clicker blank: pause and resume the recording.</li>
|
|
840
|
-
<li><kbd>Esc</kbd>: stop the take early.</li>
|
|
841
|
-
</ul>
|
|
842
|
-
<label style="margin-top:14px">Layout for this take
|
|
843
|
-
<select id="rec-layout">
|
|
844
|
-
<option value="path">Path: short, one-direction moves (recommended)</option>
|
|
845
|
-
<option value="focus">Focus: no travel, slides fade in</option>
|
|
846
|
-
<option value="current">Keep the current layout</option>
|
|
847
|
-
</select>
|
|
848
|
-
</label>
|
|
849
|
-
<div id="rec-sessions"></div>
|
|
850
|
-
<div class="row end">
|
|
851
|
-
<button class="btn" id="rec-rehearse">Rehearse (no recording)</button>
|
|
852
|
-
<button class="btn primary" id="rec-start" disabled>● Start recording</button>
|
|
853
|
-
</div>
|
|
854
|
-
</div>
|
|
855
|
-
</div>
|
|
856
|
-
|
|
857
917
|
<div id="review" class="modal" role="dialog" aria-labelledby="rv-title">
|
|
858
918
|
<div class="panel xwide">
|
|
859
|
-
<
|
|
860
|
-
|
|
861
|
-
|
|
919
|
+
<div class="panel-actions">
|
|
920
|
+
<span class="rv-using" id="rv-using"></span>
|
|
921
|
+
<button class="btn rv-setup-btn" id="rv-setup-btn" aria-expanded="false" aria-controls="rv-setup">⚙ Setup</button>
|
|
922
|
+
<button class="btn close" data-close>✕ Close</button>
|
|
923
|
+
</div>
|
|
924
|
+
<h2 id="rv-title" class="rv-brand"><svg class="logo" viewBox="0 0 64 64" aria-hidden="true"><path d="M 10 8 H 38 C 41.3 8 44 10.7 44 14 V 18 H 22 C 16.5 18 12 22.5 12 28 V 36 H 10 C 6.7 36 4 33.3 4 30 V 14 C 4 10.7 6.7 8 10 8 Z" opacity="0.4"/><path fill-rule="evenodd" d="M 22 22 H 54 C 57.3 22 60 24.7 60 28 V 50 C 60 53.3 57.3 56 54 56 H 22 C 18.7 56 16 53.3 16 50 V 28 C 16 24.7 18.7 22 22 22 Z M 26 34 C 28.2 34 30 32.2 30 30 C 30 27.8 28.2 26 26 26 C 23.8 26 22 27.8 22 30 C 22 32.2 23.8 34 26 34 Z M 38 40 C 36.9 40 36 40.9 36 42 V 48 C 36 49.1 36.9 50 38 50 H 50 C 51.1 50 52 49.1 52 48 V 42 C 52 40.9 51.1 40 50 40 H 38 Z"/></svg><span class="word">Slide<span>take</span></span> Studio</h2>
|
|
925
|
+
<details id="rv-setup">
|
|
926
|
+
<summary>Recording setup</summary>
|
|
927
|
+
<div class="rv-setup-head">
|
|
928
|
+
<h4 class="for-browser">Easy mode: record in <span class="browser-name">this browser</span></h4><h4 class="for-obs">Pro mode: record with OBS</h4>
|
|
929
|
+
<button class="btn small for-browser" id="rv-use-obs" title="Record with OBS instead of in this browser">Use pro mode (OBS)</button>
|
|
930
|
+
<button class="btn small for-obs" id="rv-use-browser" title="Record in this browser instead of with OBS"><span>Use easy mode (<span class="browser-name">this browser</span>)</span></button>
|
|
931
|
+
</div>
|
|
932
|
+
<div class="rv-setup-cols">
|
|
933
|
+
<section class="for-obs">
|
|
934
|
+
<h4>OBS</h4>
|
|
935
|
+
<div class="rv-obs-fields">
|
|
936
|
+
<input type="text" id="obs-host" value="localhost" spellcheck="false" aria-label="Host" title="Host">
|
|
937
|
+
<input type="text" id="obs-port" value="4455" inputmode="numeric" aria-label="Port" title="Port">
|
|
938
|
+
<input type="password" id="obs-pass" autocomplete="off" placeholder="Password" aria-label="Password">
|
|
939
|
+
</div>
|
|
940
|
+
<div class="rv-setup-row">
|
|
941
|
+
<button class="btn small" id="obs-connect">Connect</button>
|
|
942
|
+
<label class="check rv-setup-label"><input type="checkbox" id="obs-remember"> Remember</label>
|
|
943
|
+
<span class="rv-setup-gap"></span>
|
|
944
|
+
<span id="obs-status">Not connected</span>
|
|
945
|
+
</div>
|
|
946
|
+
<p class="rv-setup-note" id="obs-detail" hidden></p>
|
|
947
|
+
<p class="rv-setup-note">In OBS: Tools → WebSocket Server Settings → enable it (the port and password are there). Point OBS at this browser window plus your microphone; no scenes needed.</p>
|
|
948
|
+
</section>
|
|
949
|
+
<section>
|
|
950
|
+
<h4>Camera</h4>
|
|
951
|
+
<select id="rec-cam" aria-label="Camera"></select>
|
|
952
|
+
<p class="rv-setup-note">Turns on by itself when recording starts. Choose No camera for slides only.</p>
|
|
953
|
+
</section>
|
|
954
|
+
<section class="for-browser">
|
|
955
|
+
<h4>Microphone</h4>
|
|
956
|
+
<select id="rec-mic" aria-label="Microphone"></select>
|
|
957
|
+
<meter id="rec-meter" min="0" max="1" low="0.1" high="0.8" optimum="0.5" value="0" aria-label="Mic level"></meter>
|
|
958
|
+
<div class="rv-setup-row">
|
|
959
|
+
<span class="rv-setup-label">Sound</span>
|
|
960
|
+
<div class="seg small" role="radiogroup" aria-label="Sound">
|
|
961
|
+
<button class="seg-btn" data-sound="raw" role="radio" title="No processing: best for a good mic in a quiet room">Raw</button>
|
|
962
|
+
<button class="seg-btn" data-sound="voice" role="radio" title="Chrome's noise suppression: takes out fans, hum and other steady noise">Voice</button>
|
|
963
|
+
</div>
|
|
964
|
+
<span class="rv-setup-gap"></span>
|
|
965
|
+
<button class="btn small toggle rv-loud" id="rv-loud" aria-pressed="true" title="Raises the video towards YouTube's volume (-14 LUFS), stopping before the loudest peak would clip"><span class="ico" aria-hidden="true">🔊</span> Volume boost</button>
|
|
966
|
+
<button class="btn small toggle" id="rv-limiter" aria-pressed="false" title="Catches the few peaks (a click, a plosive) that would pass -1.5 dB, so Volume boost can reach -14 LUFS">Peak limiter</button>
|
|
967
|
+
</div>
|
|
968
|
+
</section>
|
|
969
|
+
<section class="for-browser">
|
|
970
|
+
<h4>Video</h4>
|
|
971
|
+
<select id="rec-quality" aria-label="Quality"></select>
|
|
972
|
+
<p class="rv-setup-note" id="rec-browser-check"></p>
|
|
973
|
+
</section>
|
|
974
|
+
<section class="for-obs">
|
|
975
|
+
<h4>Video</h4>
|
|
976
|
+
<select id="rv-mode" aria-label="How ffmpeg cuts">
|
|
977
|
+
<option value="accurate">Frame-accurate (x264)</option>
|
|
978
|
+
<option value="mac">Frame-accurate, Mac hardware encoder (faster)</option>
|
|
979
|
+
<option value="copy">No re-encode (only when nothing is cut out)</option>
|
|
980
|
+
</select>
|
|
981
|
+
<div class="rv-setup-row">
|
|
982
|
+
<select id="rv-fps" aria-label="Frame rate" title="Recording frame rate: cut points snap to its frames">
|
|
983
|
+
<option value="24">24 fps</option><option value="25">25 fps</option><option value="30">30 fps</option>
|
|
984
|
+
<option value="50">50 fps</option><option value="60">60 fps</option>
|
|
985
|
+
<option value="23.976">23.976 fps</option><option value="29.97">29.97 fps</option><option value="59.94">59.94 fps</option>
|
|
986
|
+
</select>
|
|
987
|
+
<span class="rv-setup-gap"></span>
|
|
988
|
+
<button class="btn small toggle rv-loud" id="rv-loud-obs" aria-pressed="true" title="Adds loudnorm to the ffmpeg command: YouTube's volume (-14 LUFS), peaks held below -1 dB"><span class="ico" aria-hidden="true">🔊</span> Volume boost</button>
|
|
989
|
+
</div>
|
|
990
|
+
<p class="rv-setup-note" id="rec-screen"></p>
|
|
991
|
+
</section>
|
|
992
|
+
</div>
|
|
993
|
+
<div class="rv-setup-foot">
|
|
994
|
+
<label class="rv-setup-label">Layout
|
|
995
|
+
<select id="rec-layout">
|
|
996
|
+
<option value="path">Path: short, one-direction moves</option>
|
|
997
|
+
<option value="focus">Focus: no travel, slides fade in</option>
|
|
998
|
+
<option value="current">Keep the current layout</option>
|
|
999
|
+
</select>
|
|
1000
|
+
</label>
|
|
1001
|
+
<span class="rv-setup-note">During a take: → next · ← take this slide again · B pause · Esc stop</span>
|
|
1002
|
+
<div class="rv-setup-row rv-files for-browser">
|
|
1003
|
+
<span class="rv-setup-label">Files</span>
|
|
1004
|
+
<button class="btn small" id="rv-folder-change" title="Where Download saves videos">Download folder…</button>
|
|
1005
|
+
<details class="rv-purge">
|
|
1006
|
+
<summary class="btn small" title="Delete takes from this browser">🗑 Purge takes</summary>
|
|
1007
|
+
<div class="rv-menu"><button class="btn small" id="rv-clean-unused">Unused takes</button><button class="btn small" id="rv-clean">All takes</button><button class="btn small" id="rv-clean-every" title="Every take Slidetake keeps in this browser, of every deck">Every deck's takes…</button></div>
|
|
1008
|
+
</details>
|
|
1009
|
+
</div>
|
|
1010
|
+
</div>
|
|
1011
|
+
<p class="rv-setup-note for-browser">When Chrome asks, share <strong>this tab</strong>. Only the slides and your camera are recorded, in a 16:9 frame; nothing else on the screen is.</p>
|
|
1012
|
+
</details>
|
|
862
1013
|
<div class="rv-grid">
|
|
863
1014
|
<div>
|
|
864
1015
|
<div class="rv-video">
|
|
@@ -871,39 +1022,19 @@
|
|
|
871
1022
|
<p>Pick the file OBS saved<span id="rv-file"></span> (.mov, .mp4 or .mkv) to preview takes. Or choose your OBS recordings folder once, and later takes load by themselves.</p>
|
|
872
1023
|
</div>
|
|
873
1024
|
</div>
|
|
874
|
-
<div class="
|
|
1025
|
+
<div class="rv-bar">
|
|
1026
|
+
<button class="btn rec" id="rv-rec" title="Records the whole deck, or only the ticked slides (shift-click ticks a range)">● Record</button>
|
|
1027
|
+
<span id="rv-now"></span>
|
|
1028
|
+
<button class="btn rv-preview" id="rv-play-final" title="Plays the picked takes back to back">▶ Preview</button>
|
|
1029
|
+
</div>
|
|
875
1030
|
</div>
|
|
876
1031
|
<div class="rv-list" id="rv-list"></div>
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
<
|
|
881
|
-
|
|
882
|
-
<option value="mac">Frame-accurate, Mac hardware encoder (faster)</option>
|
|
883
|
-
<option value="copy">No re-encode (only when nothing is cut out)</option>
|
|
884
|
-
</select>
|
|
885
|
-
<select id="rv-fps" title="Recording frame rate: cut points snap to its frames">
|
|
886
|
-
<option value="24">24 fps</option><option value="25">25 fps</option><option value="30">30 fps</option>
|
|
887
|
-
<option value="50">50 fps</option><option value="60">60 fps</option>
|
|
888
|
-
<option value="23.976">23.976 fps</option><option value="29.97">29.97 fps</option><option value="59.94">59.94 fps</option>
|
|
889
|
-
</select>
|
|
890
|
-
<button class="btn small" data-copy="rv-ffmpeg">Copy</button>
|
|
891
|
-
</h3>
|
|
892
|
-
<textarea id="rv-ffmpeg" rows="4" readonly spellcheck="false"></textarea>
|
|
893
|
-
<h3>YouTube</h3>
|
|
894
|
-
<div class="two">
|
|
895
|
-
<label>Title<input type="text" id="rv-yt-title"></label>
|
|
896
|
-
<label>Slides link (goes in the description)<input type="text" id="rv-link" placeholder="https://…/slides/…/" spellcheck="false"></label>
|
|
1032
|
+
<div class="rv-dl">
|
|
1033
|
+
<button class="btn" id="rv-chapters" title="Copies the chapters, to paste into the YouTube description">⧉ Chapters</button>
|
|
1034
|
+
<span class="rv-final" id="rv-final"></span>
|
|
1035
|
+
<button class="btn for-browser" id="rv-render-btn" title="Saves the video: the picked takes joined into one file">↓ Download</button>
|
|
1036
|
+
<button class="btn for-obs" id="rv-ffmpeg-copy" title="Copies the ffmpeg command that cuts the picked takes from the OBS file">⧉ ffmpeg</button>
|
|
897
1037
|
</div>
|
|
898
|
-
<h3>Description <button class="btn small" data-copy="rv-yt-desc">Copy</button></h3>
|
|
899
|
-
<textarea id="rv-yt-desc" rows="10" spellcheck="false"></textarea>
|
|
900
|
-
<p id="rv-chapters-note"></p>
|
|
901
|
-
<h3>Tags <button class="btn small" data-copy="rv-yt-tags">Copy</button></h3>
|
|
902
|
-
<input type="text" id="rv-yt-tags" spellcheck="false" style="width:100%">
|
|
903
|
-
</div>
|
|
904
|
-
<div class="row end">
|
|
905
|
-
<button class="btn" id="rv-download">↓ Download script + publish pack</button>
|
|
906
|
-
<button class="btn primary" data-close>Done</button>
|
|
907
1038
|
</div>
|
|
908
1039
|
</div>
|
|
909
1040
|
</div>
|
|
@@ -917,16 +1048,16 @@
|
|
|
917
1048
|
"use strict";
|
|
918
1049
|
(() => {
|
|
919
1050
|
// src/sample.md
|
|
920
|
-
var sample_default = '---\ntitle: Slidetake \u2014 write in markdown, record without timeline editing\nbrand: slidetake\npip: bottom-right\n---\n\n<!-- camera: on, full, on -->\n\n#  Slide<span class="st-take">take</span>\n\n**Write in markdown. Present on a spatial canvas. Record without timeline editing.**\n\
|
|
1051
|
+
var sample_default = '---\ntitle: Slidetake \u2014 write in markdown with AI, record without timeline editing\nbrand: slidetake\npip: bottom-right\n---\n\n<!-- camera: on, full, on -->\n\n#  Slide<span class="st-take">take</span>\n\n**Write in markdown, with AI. Present on a spatial canvas. Record without timeline editing.**\n\nAny AI writes the deck for you: it\'s plain markdown. For developers and technical educators who explain things on video. You\'re inside a Slidetake deck right now. Press \u2192 to walk it, **O** for the map.\n\n## \u23F1\uFE0F Hours, not days\n\nA video that takes two or three days to script, record and edit takes a couple of hours: an AI writes the deck, you record it slide by slide, and pick the best take of each in Studio. What comes out is ready to upload.\n\n## \u2702\uFE0F Record without timeline editing\n\n**Every slide is a take.** Stumbled on a slide? Press \u2190 and say it again: every attempt is kept, and recording carries on. The slide is the timeline marker, so a fumbled line costs one press, not an editing session.\n\n### Record right here, nothing to install\n\nPress **\u25CF Studio**, then **<span class="st-rec">\u25CF Record</span>**, and the deck records itself, in Chrome, Edge or another Chromium browser: your slides and camera in one 16:9 frame, at 1080p. Or let **[OBS Studio](https://obsproject.com)** record while the deck drives it, from any browser. No scenes to switch, no recording to watch.\n\n### Pick the best take\n\nChoose the best take of each slide in **\u25CF Studio**. It joins them into the final video in seconds (or writes the **[ffmpeg](https://ffmpeg.org)** cut for OBS), at YouTube\'s loudness, with the **chapters** to paste.\n\n## \u{1F5FA}\uFE0F A map, not a stack\n\n<!-- view: overview -->\n\nYour headings are the hierarchy: zoom out for the whole system, zoom in for one part. This slide just showed you the map.\n\n### Headings become cards\n\n`#` is the first card, `##` branches from it, `###` goes a level deeper. No layout to draw.\n\n### A path your viewer can follow\n\n\u2192 always walks the same order, and **path** lays it out as a staircase, so the audience never loses its place.\n\n## \u{1F3A5} The camera is part of the deck\n\n<!-- camera: on, full, on -->\n\nA comment in a slide moves you: corner, full screen, or off. Turn on **Camera** and watch this slide do it.\n\n## \u270D\uFE0F Plain markdown in\n\n**Pure text, so an AI iterates fast.** Ask for a change and the whole deck is rewritten in seconds: no layouts to drag, no files to export.\n\nMarkdown you already know: headings, lists, tables, code, steps, diagrams (Graphviz, D2, SVG), charts, images and YouTube links. [See them all in the showcase \u2192](/showcase)\n\n### A few comments do the rest\n\nMarkdown has no word for "reveal one at a time" or "move the camera", so a handful of HTML comments say it. They stay invisible anywhere else markdown is read:\n\n```md\n<!-- steps --> \u2190 one press each\n<!-- camera: full, on --> \u2190 move the camera\n<!-- view: overview --> \u2190 the map first\n<!-- view: full --> \u2190 a big image\n```\n\n## \u{1F3A8} Your colours\n\nOne line, `accent: "#3b82f6"`, gives a deck its own colour, shaded for dark and light. On your website, decks wear your site\'s palette.\n\n`brand:` and `logo:` put your name and logo in the corner of every slide, so every frame of the video carries them.\n\n## \u{1F310} Run it anywhere\n\nThree places, one deck format: a markdown file.\n\n### slidetake.com: write, record, share\n\nWrite a deck in the **\u270E Editor**, or view one straight from a link: a GitHub file, a gist or any markdown URL. Record it and cut the video in **\u25CF Studio**, in the same tab. **Share** a link with the deck inside it. Nothing to install.\n\n### Your computer: all that, plus AI\n\nThe same app on your own files, offline:\n\n```sh\nnpx slidetake deck.md\n```\n\nImages next to the markdown load as they are. Save in any editor and the deck reloads where you are; type in the browser and it saves to the file. So an AI agent can write `deck.md` while you watch it take shape.\n\n### Your website: a viewer for your readers\n\n`slidetake.js` puts decks inside your own pages, in your site\'s colours: a clean viewer, nothing else to set up. Record the same markdown here or with `npx slidetake`.\n\n## <span class="st-heart" aria-hidden="true"></span> Open source\n\nOpen source, Apache 2.0: [github.com/slidetake/slidetake](https://github.com/slidetake/slidetake). Nothing to sign up for, and your decks stay yours: [Privacy](/privacy).\n\nNext, every feature and what it saves you: **[Features \u2192](/features)**\n';
|
|
921
1052
|
|
|
922
1053
|
// src/docs.md
|
|
923
|
-
var docs_default = "---\ntitle: Slidetake Docs\nbrand: slidetake\npip: none\n---\n\n#  Slide<span class=\"st-take\">take</span> Docs\n\nEverything in order: **get started \u2192 write \u2192 present \u2192 record \u2192 share**. Press \u2192 to walk it, \u2193 \u2191 to go into a step and back out, **O** for the map.\n\n## 1\uFE0F\u20E3 Get started\n\nThree places to use Slidetake, one deck format for all of them: a markdown file. And any AI can write the deck.\n\n| Where | Best for |\n|---|---|\n| **slidetake.com** | writing in the Editor, viewing any deck from a link, sharing |\n| **Your computer** | the same on your own files and images, offline, with an AI agent writing alongside |\n| **Your website** | decks your users view, and the page you record from |\n\n### On slidetake.com\n\nOpen a deck straight from a link: a GitHub file, a gist or any markdown URL. Or press **\u270E Editor** and type: the first keystroke makes it [your copy](#your-copy), kept in this browser.\n\n| Link | Opens |\n|---|---|\n| `/gh/owner/repo/path/deck.md` | a GitHub file, default branch |\n| `/gh/owner/repo@branch/deck.md` | another branch or tag |\n| `/gist/<id>` | a gist's first markdown file |\n| `/?src=https://\u2026/deck.md` | anything else |\n| `/new` | a template: blank, talk or recording |\n\n### On your computer\n\nKeep the deck and its images together in a folder, and run one command there:\n\n```sh\nnpx slidetake deck.md\n```\n\nIt opens on `http://localhost:4300` with the files next to the deck served beside it, so `` just works. Save the file in any editor and the deck reloads where you are; type in the browser's editor and it saves to the file. Nothing leaves your machine. Needs Node 20 or later.\n\n`npx slidetake` in a folder opens its `index.md`, `deck.md`, `slides.md` or `README.md`. `--open` opens the browser; `--port 5000` picks the port.\n\n### On your website\n\n`slidetake.js` turns a deck on any page into a Slidetake deck. Describe the deck, then load the script:\n\n```html\n<script>\nwindow.SLIDETAKE = {\n markdown: \"# My deck\\n\\n## A section\",\n settings: {title: \"My deck\"},\n base: location.href, // where relative images resolve\n trail: [{label: \"My site\", url: \"/\"}],\n themeKey: \"my-site-theme\", // optional: your site's light/dark key\n colors: {accent: \"#2563eb\"} // optional: your colours\n};\n<\/script>\n<script src=\"https://cdn.jsdelivr.net/npm/slidetake/dist/slidetake.js\"><\/script>\n```\n\nUsers get a viewer with no recording controls; `?obs` on the page's address brings them back for you. The hugo-continuum theme writes this for slide pages with `engine: slidetake`, so a Hugo site previews decks locally with `hugo server`.\n\n### With AI\n\nThe deck is plain markdown, so any AI can write one. Point it at the format, [slidetake.com/llms.txt](/llms.txt), and say what the talk is about.\n\n- **With an agent that edits files** (Claude Code and the like): *\"Write a Slidetake deck about X in talk/deck.md, following slidetake.com/llms.txt\"*, then `npx slidetake talk/deck.md`. Ask for changes and the open deck reloads as the file is saved.\n- **In a chat** (Claude, no tools): ask for the deck as one markdown block, then on slidetake.com press **\u270E Editor**, select all and paste. It's your copy at once; **Share** gives a link with the deck inside it.\n- **Images:** an agent places them next to the file; in a chat, use full image URLs, or `base:` pointing at where they live.\n\n## 2\uFE0F\u20E3 Write a deck\n\nA deck is an ordinary markdown file. **Every heading becomes a card**, and a heading branches off the nearest shallower heading above it.\n\n```md\n# Product \u2190 the first card\nIntro text.\n\n## Pricing \u2190 branches from Product\n### Enterprise \u2190 branches from Pricing\n## Roadmap {#plan} \u2190 branches from Product, id \"plan\"\n\nSee the [roadmap](#plan).\n```\n\n### Cards\n\n- Text before the first heading becomes a card of its own.\n- Headings inside fenced code blocks are ignored.\n- A card's id is its heading slugified (`## Moving around` \u2192 `moving-around`), or set one with `{#id}` at the end of the heading.\n- A link to `#id` flies to that card.\n- Cards widen for wide tables, columns, diagrams and embeds; anything wider still is scaled to fit.\n\n### What a card can hold\n\nPlain markdown, and the layout follows from what's on the card. [See every one in the showcase \u2192](/showcase)\n\n| Write | Get |\n|---|---|\n| `<!-- steps -->` | what follows, one press each (a list item by item), to the end of the card or a `<!-- steps: off -->` |\n| ` ```dot `, ` ```d2 ` | a Graphviz or D2 diagram |\n| ` ```echarts ` with JSON options | a chart, in the deck's colours for dark and light |\n| ` ```svg ` | an SVG drawing, inline: `currentColor` is the text colour and `var(--text)`, `var(--text-muted)`, `var(--accent)` switch with dark and light; scripts, styles and links are removed |\n| `` | an SVG image, as drawn |\n| an image alone | an image card: a phone shot sits beside the heading and caption, a landscape one spans the card between them, a 16:9 one fills it |\n| an image and text | a split card: the image sits on the side written first |\n| a list of images, diagrams or charts | a gallery; with `<!-- steps -->` a carousel, one per press |\n| two or more images, diagrams or charts in a row after `<!-- steps -->` | a carousel, one per press |\n| images in one paragraph | a grid, up to four a row |\n| `<!-- view: full -->` in a card | a 16:9 card for a big image, without the camera unless the card asks for it |\n| a YouTube link alone on a line | the video: the next press plays it, leaving pauses it |\n\nThe first and last cards animate in on their own. The alt text of an image is its caption.\n\n### Deck settings\n\nAn optional block at the top of the file:\n\n```yaml\n---\ntitle: My talk \u2190 the page title, and the video's\nduration: 10m \u2190 talk length, for the timer\naccent: \"#3b82f6\" \u2190 the deck's colour (Slidetake's own is green)\nbrand: example.com/talks \u2190 text in the top-right corner\nlogo: https://\u2026/logo.png \u2190 image beside it\nbase: https://\u2026/deck-folder/ \u2190 where relative images live, for a file opened from elsewhere\n---\n```\n\n`accent` is one colour; Slidetake makes it bright for dark mode and deep enough to read on white for light mode, and uses it for text accents, lines, charts and diagrams. Camera and recording settings are in [step 4](#4-record-a-video).\n\n### Decks from elsewhere\n\n**reveal.js** decks open as they are: `---` starts a slide and `--` a vertical one beneath it. Fragments (`fade-up`, `grow`, \u2026), `r-stack`, `<!-- .element: \u2026 -->`, `<section>` slides, `data-autoslide`, `data-gsap` entrances and `title-scramble` all work.\n\n**Older `+++` decks**, with `id`, `parent`, `x`, `y` frontmatter, still load.\n\n## 3\uFE0F\u20E3 Present\n\nClick a card to fly to it. Drag to pan; scroll or pinch to zoom. On a touch screen, the bottom bar adds \u2190 \u2192 buttons.\n\n| Key | Does |\n|---|---|\n| \u2192 \u2190 Space | next / previous step, in document order |\n| \u2193 \u2191 | first child / parent |\n| O | the whole map; **O** again or Esc goes back |\n| F | fullscreen; **F** again or Esc leaves |\n| K or ? | these keys; again closes them |\n| 1 2 3 4 | focus, path, radial, tree |\n| + \u2212 | bigger / smaller slides (remembered) |\n| E \xB7 L | editor \xB7 light / dark |\n| C \xB7 V \xB7 R | camera \xB7 camera layouts \xB7 record |\n\n### Layouts\n\n**Focus** doesn't travel at all: the next slide fades in where the last one was.\n\n**Path**, the default, is made for presenting and video: a staircase in presenting order. Each section is a row, and the next one starts just below where the last ended, so every move is a short step right or down.\n\n**Radial** rings out from the first card, and **tree** is a top-down chart.\n\nThe layout you pick is remembered in this browser, for every deck.\n\n### On screen\n\nText keeps one size within a section and only changes when the section does; charts and diagrams are fitted on their own.\n\n`<!-- view: overview -->` on a slide pulls back to the whole map for a beat before flying in: a good start to a chapter.\n\n### Progress and timer\n\nIn fullscreen the cursor and controls hide after two seconds without the mouse moving, and a thin bar along the bottom fills with every press.\n\nWith `duration: 10m` (or `90s`, `1h`, `12:30`), a lighter layer of the same colour grows behind it with the clock: if it shows past the solid fill, you're behind; if it reaches the end, the bar pulses. The timer is for you, so recordings show progress only, unless the deck says `timer: always`. `progress: off` hides the bar.\n\n## 4\uFE0F\u20E3 Record a video\n\nRecording takes **[OBS Studio](https://obsproject.com)** (free and open source). OBS records at full quality; Slidetake drives it, slide by slide, so there's no timeline to edit afterwards.\n\n### Set up OBS\n\n1. In OBS, turn on Tools \u2192 WebSocket Server Settings.\n2. In Slidetake, press **\u25CF Record** and enter OBS's host, port and password. Tick *Remember* to skip this next time.\n3. Use a 16:9 screen (YouTube is 16:9): the Record dialog checks yours. If it isn't, move the window to one that is, physical or virtual (say 1920\xD71080), and press **F** there.\n\n`?obs=localhost:4455` (or `?obs=host:port:password`) in the address fills this in and connects as the page opens.\n\nFrom https://slidetake.com, OBS must be on the same computer: browsers block secure pages from reaching plain `ws://` addresses elsewhere. For OBS on another machine, use `npx slidetake`, which serves over http.\n\n### Add your camera\n\n**C** (or **Camera**) turns your webcam on in its box, and OBS records you and the slides together. The camera is off every time the page opens; until it's on, the deck's camera settings are ignored, so readers get slides using the whole screen.\n\n```yaml\n---\npip: bottom-right \u2190 camera corner, or none\npip_size: 24% \u2190 camera box width\npip_shape: rect \u2190 rect (16:9) or circle\npip_mirror: yes \u2190 mirror the webcam\ncamera: 24%, 40%, full, off \u2190 layouts V cycles through\n---\n```\n\nSlides are always placed clear of the brand and the camera box.\n\n### Move the camera per slide\n\nA comment in a slide changes the camera from that slide on:\n\n```md\n## Intro\n<!-- camera: full --> \u2190 camera fills the screen\n\n## Pricing\n<!-- camera: 18% flip --> \u2190 small, on the other side\n```\n\nWords you can combine: `on`, `off`, `full`, a size like `30%`, a corner, `flip`, `circle` / `rect`, `mirror` / `unmirror`. List them with commas to step through them on one slide: `full, on` opens on you, and the next \u2192 shrinks the camera to its corner and shows the slide.\n\n**V** steps through the deck's `camera:` list by hand.\n\n### Take by take\n\n**\u25CF Record** (or **R**) connects to OBS, counts down and starts recording. From then on the deck drives everything: camera layouts, reveals and slides follow \u2192 (a Bluetooth clicker works).\n\n- **\u2190** takes the current slide again, keeping every attempt\n- **B** pauses and resumes\n- one press past the last step stops OBS\n\nClicks, dragging and the map are locked so the take only moves forward.\n\n### Review, cut and publish\n\nThen the review opens: every slide with its takes (the last one picked), previews from the OBS file, a ready-to-run **[ffmpeg](https://ffmpeg.org)** command for the picked takes (frame-exact), and the YouTube title, description with **chapters** and links, and tags. Sessions are kept in this browser, so a take can be reviewed again later from \u25CF Record.\n\nThe description comes from the deck's top block:\n\n| Key | Used for |\n|---|---|\n| `title` | the video title |\n| `summary` | the description's first paragraph |\n| `related` | a list of `[Title](url)` links |\n| `tags` | tags (any other list ending in `_tags` is added too) |\n| `permalink` or `site` | the link back to the deck |\n\n## 5\uFE0F\u20E3 Share and keep\n\nEvery deck you open is **read-only**: Slidetake's own decks, templates, files on the web and shared links. Viewing one never changes anything.\n\n### Your copy\n\n**Type in a deck**, and it becomes your copy, at `/edit`. It lives in this browser, remembers where it came from, and is there whenever you come back: **Your copy \u2192** in the editor takes you to it.\n\n- There's one copy at a time; the editor bar says whose it is, and marks **edited** while it has changes you haven't saved or shared.\n- **Reset to original** throws your edits away.\n- Starting a new copy asks first if the old one has edits you haven't kept.\n\n### Save and share\n\n**Save** downloads the markdown. **Share** copies a link: the short link while your copy still matches an online original, otherwise a `/share#deflate:\u2026` link with the whole deck compressed inside it. That part of a link never reaches a server. **Open** loads a markdown file from your computer into your copy.\n\n### Address options\n\n| Option | Does |\n|---|---|\n| `?edit=1` | opens the editor |\n| `?layout=focus` (path, radial, tree) | picks the layout; path is the default |\n| `?mode=light` | light theme |\n| `?duration=10m` | talk length for the timer |\n| `#card-id` | opens at a card |\n\n## \u{1F512} Your data\n\nNo accounts, and no decks kept: your copy and settings stay in this browser, and decks inside links never reach a server. `npx slidetake` keeps everything on your machine. What slidetake.com does collect (Google Analytics, which the **Privacy & analytics** button in the header turns off), and which services a deck can reach, is all on the [privacy page](/privacy).\n\nSlidetake is open source: [github.com/slidetake/slidetake](https://github.com/slidetake/slidetake).\n";
|
|
1054
|
+
var docs_default = "---\ntitle: Slidetake Docs\nbrand: slidetake\npip: none\n---\n\n#  Slide<span class=\"st-take\">take</span> Docs\n\nEverything in order: **get started \u2192 write \u2192 present \u2192 record \u2192 share**. Press \u2192 to walk it, \u2193 \u2191 to go into a step and back out, **O** for the map.\n\n## 1\uFE0F\u20E3 Get started\n\nThree places to use Slidetake, one deck format for all of them: a markdown file. And any AI can write the deck.\n\n| Where | Best for |\n|---|---|\n| **slidetake.com** | writing in the Editor, viewing any deck from a link, sharing |\n| **Your computer** | the same on your own files and images, offline, with an AI agent writing alongside |\n| **Your website** | decks your readers view |\n\n### On slidetake.com\n\nOpen a deck straight from a link: a GitHub file, a gist or any markdown URL. Or press **\u270E Editor** and type: the first keystroke makes it [your copy](#your-copy), kept in this browser.\n\n| Link | Opens |\n|---|---|\n| `/gh/owner/repo/path/deck.md` | a GitHub file, default branch |\n| `/gh/owner/repo@branch/deck.md` | another branch or tag |\n| `/gist/<id>` | a gist's first markdown file |\n| `/?src=https://\u2026/deck.md` | anything else |\n| `/new` | a template: blank, talk or recording |\n\n### On your computer\n\nKeep the deck and its images together in a folder, and run one command there:\n\n```sh\nnpx slidetake deck.md\n```\n\nIt opens on `http://localhost:4300` with the files next to the deck served beside it, so `` just works. Save the file in any editor and the deck reloads where you are; type in the browser's editor and it saves to the file. Nothing leaves your machine. Needs Node 20 or later.\n\n`npx slidetake` in a folder opens its `index.md`, `deck.md`, `slides.md` or `README.md`. `--open` opens the browser; `--port 5000` picks the port.\n\n### On your website\n\n`slidetake.js` turns a deck on any page into a Slidetake deck. Describe the deck, then load the script:\n\n```html\n<script>\nwindow.SLIDETAKE = {\n markdown: \"# My deck\\n\\n## A section\",\n settings: {title: \"My deck\"},\n base: location.href, // for images\n trail: [{label: \"My site\", url: \"/\"}],\n themeKey: \"my-theme\", // your light/dark key\n colors: {accent: \"#2563eb\"} // your colours\n};\n<\/script>\n<script src=\"https://cdn.jsdelivr.net/npm/slidetake/dist/slidetake.js\"><\/script>\n```\n\nA viewer, nothing more: to record the deck, open its markdown here or with `npx slidetake`. The hugo-continuum theme writes this for pages with `engine: slidetake`.\n\n### With AI\n\nAny AI can write a deck: point it at [slidetake.com/llms.txt](/llms.txt) and say what the talk is about.\n\n- **An agent** (Claude Code and the like): *\"Write a Slidetake deck about X in talk/deck.md, following slidetake.com/llms.txt\"*, then `npx slidetake talk/deck.md`. The deck reloads as it edits.\n- **A chat**: ask for one markdown block, then paste it into **\u270E Editor** here.\n- **Images**: beside the file for an agent; full URLs in a chat.\n\n## 2\uFE0F\u20E3 Write a deck\n\nA deck is an ordinary markdown file. **Every heading becomes a card**, and a heading branches off the nearest shallower heading above it.\n\n```md\n# Product \u2190 the first card\nIntro text.\n\n## Pricing \u2190 from Product\n### Enterprise \u2190 from Pricing\n## Roadmap {#plan} \u2190 from Product, id \"plan\"\n\nSee the [roadmap](#plan).\n```\n\n### Cards\n\n- Text before the first heading becomes a card of its own.\n- Headings inside fenced code blocks are ignored.\n- A card's id is its heading slugified (`## Moving around` \u2192 `moving-around`), or set one with `{#id}` at the end of the heading.\n- A link to `#id` flies to that card.\n- Cards widen for wide tables, columns, diagrams and embeds; anything wider still is scaled to fit.\n\n### What a card can hold\n\nPlain markdown, and the layout follows from what's on the card. [See every one in the showcase \u2192](/showcase)\n\n| Write | Get |\n|---|---|\n| `<!-- steps -->` | what follows, one press each, to the end of the card or a `<!-- steps: off -->` |\n| ` ```dot `, ` ```d2 ` | a Graphviz or D2 diagram, in the deck's colours |\n| ` ```echarts ` with JSON options | a chart, in the deck's colours |\n| ` ```svg ` | an SVG drawing: `currentColor` and `var(--text)`, `var(--accent)` follow dark and light |\n| a YouTube link alone on a line | the video: the next press plays it |\n| `<!-- view: full -->` | a 16:9 card for a big image |\n\nThe first and last cards animate in on their own.\n\n### Images\n\nThe layout follows from where the images are. The alt text is the caption.\n\n| Write | Get |\n|---|---|\n| an image alone | an image card, laid out by its shape: phone, landscape or 16:9 |\n| an image and text | a split card, the image on the side written first |\n| a list of images, diagrams or charts | a gallery; after `<!-- steps -->`, a carousel |\n| images in one paragraph | a grid, up to four a row |\n| `` | an SVG image, as drawn |\n\n### Deck settings\n\nAn optional block at the top of the file:\n\n```yaml\n---\ntitle: My talk \u2190 page and video title\nduration: 10m \u2190 for the timer\naccent: \"#3b82f6\" \u2190 the deck's colour\nmode: light \u2190 open in light mode\nbrand: example.com \u2190 top-right corner text\nbrand_style: chip \u2190 the brand as a pill\nlogo: https://\u2026/l.png \u2190 image beside it\nbase: https://\u2026/deck/ \u2190 where images live\nsite: https://\u2026/ \u2190 where /images live\n---\n```\n\n`accent` is one colour; Slidetake makes it bright for dark mode and deep enough to read on white for light mode, and uses it for text accents, lines, charts and diagrams. Camera and recording settings are in [step 4](#4-record-a-video).\n\n### Decks from elsewhere\n\n**reveal.js** decks open as they are: `---` starts a slide and `--` a vertical one beneath it. Fragments (`fade-up`, `grow`, \u2026), `r-stack`, `<!-- .element: \u2026 -->`, `<section>` slides, `data-autoslide`, `data-gsap` entrances and `title-scramble` all work.\n\n**Older `+++` decks**, with `id`, `parent`, `x`, `y` frontmatter, still load.\n\n## 3\uFE0F\u20E3 Present\n\nClick a card to fly to it. Drag to pan; scroll or pinch to zoom. On a touch screen, the bottom bar adds \u2190 \u2192 buttons.\n\n| Key | Does |\n|---|---|\n| \u2192 \u2190 Space | next / previous step, in document order (PgDn and PgUp too: what clickers send) |\n| Home End | first / last slide |\n| \u2193 \u2191 | first child / parent |\n| O | the whole map; **O** again or Esc goes back |\n| F | fullscreen; **F** again or Esc leaves |\n| K or ? | these keys; again closes them |\n| 1 2 3 4 | focus, path, radial, tree |\n| + \u2212 | bigger / smaller slides (remembered) |\n| E \xB7 L | editor \xB7 light / dark |\n| C \xB7 V \xB7 R | camera \xB7 camera layouts \xB7 Studio (record) |\n\n### Layouts\n\n**Focus** doesn't travel at all: the next slide fades in where the last one was.\n\n**Path**, the default, is made for presenting and video: a staircase in presenting order. Each section is a row, and the next one starts just below where the last ended, so every move is a short step right or down.\n\n**Radial** rings out from the first card, and **tree** is a top-down chart.\n\nThe layout you pick is remembered in this browser, for every deck.\n\n### On screen\n\nText keeps one size within a section and only changes when the section does; charts and diagrams are fitted on their own.\n\n`<!-- view: overview -->` on a slide pulls back to the whole map for a beat before flying in: a good start to a chapter.\n\n### Progress and timer\n\nIn fullscreen the cursor and controls hide after two seconds without the mouse moving, and a thin bar along the bottom fills with every press.\n\nWith `duration: 10m` (or `90s`, `1h`, `12:30`), a lighter layer of the same colour grows behind it with the clock: if it shows past the solid fill, you're behind; if it reaches the end, the bar pulses. The timer is for you, so recordings show progress only, unless the deck says `timer: always`. `progress: off` hides the bar.\n\n## 4\uFE0F\u20E3 Record a video\n\nTwo modes, both slide by slide, so there's no timeline to edit afterwards. **\u25CF Studio** (beside \u270E Editor, or **R**) opens **Slidetake Studio** in the mode you used last; \u2699 Setup switches between them:\n\n| | Easy mode: in the browser | Pro mode: with OBS |\n|---|---|---|\n| Install | nothing | [OBS Studio](https://obsproject.com) and [ffmpeg](https://ffmpeg.org), both free; a virtual display if your screen isn't 16:9 |\n| Browser | Chrome, Edge or another Chromium browser | any: Safari and Firefox too |\n| Screen | any shape: the deck is recorded in a 16:9 frame | a 16:9 screen, physical or virtual |\n| Quality | 1080p, or 720p on a smaller screen | whatever OBS records |\n| Final video | **Download** joins the picked takes, in the browser | an ffmpeg command |\n\n### Easy mode: record in the browser\n\n**\u25CF Studio** shows every slide of the deck, with every take of it from every recording.\n\n1. **\u2699 Setup**, the first time: pick your camera (or **No camera**) and microphone. \u25CF Record turns the camera on and off by itself.\n2. **\u25CF Record**, and share **this tab** when the browser asks. Only the 16:9 frame is recorded: slides and camera.\n\nFor 1080p the frame needs 1920\xD71080 real pixels (a Retina laptop has them); 1280\xD7720 makes 720p. Smaller: use pro mode.\n\n### Retake slides later\n\nTick slides (shift-click for a range): **\u25CF Record** records just those, then stops.\n\nA take starts with the move in from the slide before it. So when you edit a slide, its takes and the next slide's are marked *outdated*: kept, but not picked until you record them again.\n\nTo drop a slide, delete it, then record the slide after it again.\n\n### Takes stay in this browser\n\nEach take is a file in this browser's private storage until you purge it, in \u2699 Setup \u2192 Files:\n\n| Purge | Removes |\n|---|---|\n| **Unused takes** | takes the video doesn't use |\n| **All takes** | this deck's takes |\n| **Every deck's takes\u2026** | everything Slidetake keeps here; it says how much first |\n\n### Pro mode: set up OBS\n\n1. In OBS: Tools \u2192 WebSocket Server Settings, turn it on.\n2. In **\u25CF Studio**: **\u2699 Setup \u2192 Use pro mode (OBS)**, enter host, port and password, then **Connect**. Tick *Remember*.\n3. Present on a 16:9 screen, physical or virtual (say 1920\xD71080). Setup checks it.\n\nStudio opens in the mode you used last. The line beside \u2699 Setup shows what a take uses: `Pro \xB7 OBS \xB7 1080p \xB7 camera`.\n\n### A 16:9 screen\n\nYouTube is 16:9. If your screen isn't (a MacBook is 16:10, an ultrawide 21:9), add a virtual 1920\xD71080 display, present there with **F**, and point OBS at it:\n\n| System | Virtual display |\n|---|---|\n| macOS | [BetterDisplay](https://github.com/waydabber/BetterDisplay) |\n| Windows | [Virtual Display Driver](https://github.com/VirtualDrivers/Virtual-Display-Driver) |\n| Linux | `xrandr` (X11), or a dummy HDMI plug |\n\nA dummy HDMI plug works on any system.\n\n### OBS on another computer\n\n`?obs=host:port:password` in the address connects as the page opens.\n\nFrom https://slidetake.com, OBS must be on the same computer: browsers block secure pages from plain `ws://` addresses elsewhere. For OBS on another machine, use `npx slidetake`, which serves over http.\n\n### Add your camera\n\n**C** (or **Camera**) turns your webcam on in its box while presenting. A recording doesn't depend on it: it turns on the camera chosen for the deck (or none) by itself. The camera is off every time the page opens; until it's on, the deck's camera settings are ignored, so readers get slides using the whole screen.\n\n```yaml\n---\npip: bottom-right \u2190 corner, or none\npip_size: 24% \u2190 box width\npip_shape: rect \u2190 or circle\npip_mirror: yes \u2190 mirror the webcam\ncamera: 24%, full, off \u2190 what V cycles\n---\n```\n\nSlides are always placed clear of the brand and the camera box.\n\n### Move the camera per slide\n\nA comment in a slide changes the camera from that slide on:\n\n```md\n## Intro\n<!-- camera: full --> \u2190 fills the screen\n\n## Pricing\n<!-- camera: 18% flip --> \u2190 small, other side\n```\n\nWords you can combine: `on`, `off`, `full`, a size like `30%`, a corner, `flip`, `circle` / `rect`, `mirror` / `unmirror`. List them with commas to step through them on one slide: `full, on` opens on you, and the next \u2192 shrinks the camera to its corner and shows the slide.\n\n**V** steps through the deck's `camera:` list by hand.\n\n### Take by take\n\n**\u25CF Record** counts down and starts. From then on \u2192 drives everything: slides, reveals and camera moves (a Bluetooth clicker works).\n\n- **\u2190** takes the slide again. The deck goes back and replays the slide's entry, so whichever take you pick joins smoothly\n- **B** (or **.**, a clicker's blank-screen key) pauses and resumes\n- one press past the last step ends the take; **Esc** ends it early\n\n### Slidetake Studio\n\nWhen the take ends you're back in Studio, the same in both modes:\n\n- the player, with **\u25CF Record** and **\u25B6 Preview** under it\n- every slide and its takes on the right: click one to preview it\n- **\u29C9 Chapters** copies the chapters (`0:00 Intro`, one per section) for the YouTube description. YouTube needs at least three, each 10 seconds or more\n\n### Download (easy mode)\n\n**\u25B6 Preview** plays the picked takes back to back.\n\n**\u2193 Download** joins them into one MP4 in seconds, without re-encoding the video, in a folder you pick once: `deck 2026-10-30 20-04-49.mp4`. Pressed again with nothing changed, it says where the video already is.\n\n### The ffmpeg cut (pro mode)\n\nStudio shows the deck's latest OBS recording; recording again replaces it here (the old file stays in your OBS folder).\n\nPreviews come from the OBS file: open it once, or, in Chrome and Edge, pick your OBS folder and later recordings load by themselves.\n\n**\u29C9 ffmpeg** copies a command that cuts the picked takes, frame-exact. \u2699 Setup \u2192 Video sets how it encodes.\n\n### Sound\n\nIn \u2699 Setup \u2192 Microphone:\n\n| Setting | Does |\n|---|---|\n| **Raw** (default) | the mic as it is: for a good mic in a quiet room |\n| **Voice** | Chrome's noise suppression: fans, hum, steady noise |\n| **\u{1F50A} Volume boost** (on) | raises the voice to YouTube's \u221214 LUFS, never past a \u22121.5 dB peak |\n| **Peak limiter** (off) | catches the few loud peaks, so the boost goes all the way |\n\nYouTube turns loud videos down but not quiet ones up, so without the boost your voice sounds quiet. With OBS, Volume boost adds `loudnorm` to the ffmpeg command.\n\n## 5\uFE0F\u20E3 Share and keep\n\nEvery deck you open is **read-only**: Slidetake's own decks, templates, files on the web and shared links. Viewing one never changes anything.\n\n### Your copy\n\n**Type in a deck**, and it becomes your copy, at `/edit`. It lives in this browser, remembers where it came from, and is there whenever you come back: **Your copy \u2192** in the editor takes you to it.\n\n- There's one copy at a time; the editor bar says whose it is, and marks **edited** while it has changes you haven't saved or shared.\n- **Reset to original** throws your edits away.\n- Starting a new copy asks first if the old one has edits you haven't kept.\n\n### Save and share\n\n**Save** downloads the markdown. **Share** copies a link: the short link while your copy still matches an online original, otherwise a `/share#deflate:\u2026` link with the whole deck compressed inside it. That part of a link never reaches a server. **Open** loads a markdown file from your computer into your copy, and **\u21E3 Load** a deck from a link: a GitHub file, a gist or any markdown URL.\n\n### Address options\n\n| Option | Does |\n|---|---|\n| `?edit=1` | opens the editor |\n| `?layout=focus` (path, radial, tree) | picks the layout; path is the default |\n| `?mode=light` | light theme |\n| `?duration=10m` | talk length for the timer |\n| `#card-id` | opens at a card |\n\n## \u{1F512} Your data\n\nNo accounts, and no decks kept. Recording stays on your device.\n\nNext, everything that leaves your browser, and where it goes: **[Privacy \u2192](/privacy)**\n";
|
|
924
1055
|
|
|
925
1056
|
// src/features.md
|
|
926
|
-
var features_default = "---\ntitle: Slidetake Features\nbrand: slidetake\npip: none\n---\n\n#  Slide<span class=\"st-take\">take</span> Features\n\nThe complete list, one line each. Press \u2192 to walk it, **O** for the map.\n\n## \u2702\uFE0F Record without timeline editing\n\n| Feature | Advantage |\n|---|---|\n| **Takes per slide** (\u2190) | every attempt kept; recording never stops |\n| **
|
|
1057
|
+
var features_default = "---\ntitle: Slidetake Features\nbrand: slidetake\npip: none\n---\n\n#  Slide<span class=\"st-take\">take</span> Features\n\nThe complete list, one line each. Press \u2192 to walk it, **O** for the map.\n\n## \u2702\uFE0F Record without timeline editing\n\nTwo modes, the same takes: **easy** in the browser, **pro** with OBS.\n\n| Feature | Advantage |\n|---|---|\n| **Takes per slide** (\u2190) | every attempt kept; recording never stops |\n| **Pause and resume** (B) | step away without a gap to cut |\n| **Slidetake Studio** | every slide's takes, Preview and Chapters, the same in both modes |\n| **Volume boost** | your voice at YouTube's loudness (\u221214 LUFS), never clipped |\n| **YouTube chapters** | one click copies them, one per section |\n| **Clicker support** | any Bluetooth presenter remote moves the deck |\n\n### Easy mode: in the browser\n\nFor Chrome, Edge or another Chromium browser, on a screen with enough pixels: 1920\xD71080 for 1080p (a Retina laptop has them), 1280\xD7720 for 720p.\n\n| Feature | Advantage |\n|---|---|\n| **Nothing to install** | the deck records itself in a 16:9 frame, on a screen of any shape |\n| **Retake any slide later** | tick slides and record just those; an edited slide's takes are marked outdated |\n| **Download** | the picked takes joined into one MP4 in seconds |\n| **Takes kept in the browser** | every take, from every recording, until you purge them |\n\n### Pro mode: with OBS\n\nFor Safari, Firefox or any browser, a screen too small for easy mode, or whatever OBS can record.\n\n| Feature | Advantage |\n|---|---|\n| **[OBS](https://obsproject.com), driven by the deck** | it starts and stops for you; you only talk |\n| **16:9 check** | Setup warns before a video with bars; use a 16:9 screen, physical or virtual |\n| **Frame-exact [ffmpeg](https://ffmpeg.org) cut** | one command, no video editor |\n\n## \u{1F5FA}\uFE0F A map, not a stack\n\n| Feature | Advantage |\n|---|---|\n| **Four layouts** | focus, path (the default), radial, tree |\n| **The map** (O) | the whole talk at a glance, and back |\n| **Map moments** (`view: overview`) | open a chapter on the big picture |\n| **Steady text** | one size per section, so slides don't jump |\n| **Short flights** | camera moves made to read well on video |\n| **Progress and timer** | a bar that fills, and a clock that tells you if you're behind |\n\n## \u{1F3A5} The camera is part of the deck\n\n| Feature | Advantage |\n|---|---|\n| **Webcam in its box** | you and the slides in one recording, no compositing |\n| **Camera per slide** | corner, size, side, circle, full screen or off |\n| **Steps on one slide** | open on you, then reveal the slide |\n| **Camera layouts** (V) | try them live, without editing the deck |\n| **Off until you turn it on** | not shown to viewers: the slides get the whole screen |\n\n## \u270D\uFE0F Plain markdown in\n\n| Feature | Advantage |\n|---|---|\n| **One file** | any editor, versioned in git, reviewed like code |\n| **Steps, diagrams, charts** | Graphviz, D2, SVG and ECharts as text |\n| **Image cards** | laid out by shape: beside text, across the card, galleries, carousels, grids |\n| **Full-screen cards** (`view: full`) | a 16:9 frame for a big image |\n| **YouTube** | plays on the next press, pauses when you leave |\n| **reveal.js and `+++` decks** | open as they are |\n\n## \u{1F3A8} Your colours\n\n| Feature | Advantage |\n|---|---|\n| **Dark and light** (L) | follows the reader, or your site |\n| **`accent:`** | one colour, shaded for both modes, charts and diagrams included |\n| **`brand:` and `logo:`** | your name on every frame |\n| **Site colours** | embedded decks wear your site's palette and header |\n\n## \u{1F310} Run it anywhere\n\n| Where | Also gives you |\n|---|---|\n| **slidetake.com** | share links that carry the whole deck; your copy of any deck, kept in this browser |\n| **Your computer** | relative images, reload on save, browser edits saved to the file; OBS on another machine |\n| **Your website** | a clean viewer in your site's colours; the hugo-continuum theme with one frontmatter key |\n\n## \u{1F512} Private and open\n\n| Feature | Advantage |\n|---|---|\n| **No accounts, no stored decks** | nothing to sign up for or lose ([privacy](/privacy)) |\n| **Decks inside links** | the deck stays in the `#` part, never sent to a server |\n| **Analytics you can turn off** | one button on slidetake.com |\n| **Open source, Apache 2.0** | read it, host it, change it: [github.com/slidetake/slidetake](https://github.com/slidetake/slidetake) |\n\nNext, see them working: **[Showcase \u2192](/showcase)**\n";
|
|
927
1058
|
|
|
928
1059
|
// src/privacy.md
|
|
929
|
-
var privacy_default = "---\ntitle: Slidetake Privacy\nbrand: slidetake\npip: none\n---\n\n#  Slide<span class=\"st-take\">take</span> Privacy\n\nSlidetake has no accounts and keeps no decks. This page lists everything that leaves your browser, and where it goes.\n\n*Last updated
|
|
1060
|
+
var privacy_default = "---\ntitle: Slidetake Privacy\nbrand: slidetake\npip: none\n---\n\n#  Slide<span class=\"st-take\">take</span> Privacy\n\nSlidetake has no accounts and keeps no decks. This page lists everything that leaves your browser, and where it goes.\n\n*Last updated 31 October 2026.*\n\n## \u{1F4CA} What slidetake.com collects\n\nslidetake.com counts visits with **Google Analytics**: the page's address, your browser and screen, and roughly where you are. Google Analytics sets its own cookies (`_ga`) to tell visits apart.\n\nThe address it records leaves out the part after `#` and `?obs=`, so neither a deck carried in a link nor an OBS password reaches it.\n\n**You can turn it off:** the **Privacy & analytics** button in the header (the pulse icon) \u2192 *Turn analytics off*. Nothing more is sent from that browser, the `_ga` cookies are removed, and the tag isn't loaded on later visits. Cloudflare, which serves the site, still sees each request the way any web server does.\n\n> That is the only analytics. A copy of Slidetake you host yourself, the embed on your own site, and `npx slidetake` send none.\n\n## \u{1F3A5} Recording stays on your device\n\nYour camera, your microphone and the tab you share are read only by your browser, and only while you record. Nothing is uploaded:\n\n- **Easy mode** saves each take in this browser's private storage. **\u2193 Download** writes the video to a folder you pick.\n- **Pro mode** has OBS record on your computer; Slidetake only tells it when to start and stop.\n\n## \u{1F4BE} What stays in your browser\n\nKept in this browser's storage on your device, and never sent anywhere:\n\n| What | Why |\n|---|---|\n| Your copy of a deck | so it's there when you come back |\n| Theme, layout, slide size, editor width | your preferences |\n| Recorded takes | to cut the video, until you purge them |\n| Camera, mic and sound choices | your recording setup |\n| Folders you pick for videos | so Studio needn't ask again |\n| OBS host, port and password | only with *Remember*, as plain text |\n| Your analytics choice | so *off* stays off |\n\nClearing this site's data in your browser removes all of it, recorded takes included.\n\n## \u{1F310} Services a deck can reach\n\nOpening Slidetake, or a deck that uses these, loads files from other services. Each sees your IP address, as with any web request.\n\n| Service | When |\n|---|---|\n| Google Fonts | every page, for the typefaces |\n| cdnjs, jsDelivr | every page (animation, markdown), and for diagrams, charts, recording and OBS |\n| esm.sh | a deck with a D2 diagram |\n| GitHub | opening a GitHub file or gist |\n| YouTube (youtube-nocookie.com) | a deck with a YouTube link; YouTube's own cookies only once you play it |\n| The deck's own address | opening a deck from a link, and its images |\n\nOBS is reached only on the address you give it, normally your own computer.\n\n## \u{1F517} Decks in links\n\nA shared link carries the whole deck after `#`. Browsers never send that part of an address to a server, so the deck travels from you to whoever opens the link without passing through slidetake.com.\n\n## \u{1F4BB} On your computer\n\n`npx slidetake` runs on your machine, serves only the deck's folder, and listens only on `localhost`. It sends nothing to slidetake.com or anyone else. The deck's own diagrams, charts and fonts load from the services above as on the web.\n\n## \u2709\uFE0F Questions\n\nOpen an issue on [github.com/slidetake/slidetake](https://github.com/slidetake/slidetake/issues). Slidetake is open source, so everything above can be checked in its code.\n";
|
|
930
1061
|
|
|
931
1062
|
// examples/blank.md
|
|
932
1063
|
var blank_default = "---\ntitle: My deck\n---\n\n# My deck\n\nStart typing: this becomes your own copy, and the template stays as it is.\n\n## A section\n\nEvery heading is a card. `##` sections branch from the first card.\n\n### A detail\n\n`###` branches from the section above it.\n";
|
|
@@ -938,7 +1069,7 @@
|
|
|
938
1069
|
var recording_default = "---\ntitle: Video title\nduration: 10m\npip: bottom-right\npip_size: 24%\ncamera: 24%, 40%, full, off\n---\n\n<!-- camera: full, on -->\n\n# Video title\n\nOpens full screen on you; the next press shows this slide with you in the corner.\n\n## \u{1F4CC} Disclaimer\n\n<!-- camera: off, on -->\n\nOpens without the camera, so the text has the whole screen; the next press brings you back.\n\n## \u{1F9ED} Contents\n\n- Part one\n- Part two\n- Part three\n\n## \u{1F539} Part one\n\n<!-- view: overview -->\n\nThe overview comment pulls back to the whole map first: a good start to a chapter.\n\n### A detail\n\nSlides you talk over in the corner.\n\n## \u{1F538} Part two\n\n### A detail\n\n## \u{1F537} Part three\n\n### A detail\n\n## \u{1F64F} Thanks for watching\n\n<!-- camera: on, full, on, off -->\n\nEnds on you full screen, then back to the slide, then without the camera.\n";
|
|
939
1070
|
|
|
940
1071
|
// examples/showcase.md
|
|
941
|
-
var showcase_default = '---\ntitle: Slidetake Showcase\nbrand: slidetake\nduration: 10m\n---\n\n#  Slide<span class="st-take">take</span> Showcase\n\nEverything a deck can hold, written in plain markdown and working on screen. Open **\u270E Editor** to see the source of any card. Press \u2192 to walk it, **O** for the map.\n\n## \u270D\uFE0F Text\n\nParagraphs, **bold**, *italic*, `code`, [links](https://slidetake.com) and lists, as markdown writes them.\n\n- One point\n- Another point\n - A detail under it\n\n### Steps\n\nPut `<!-- steps -->` before a list and it reveals one item per press. Everything after it on the card steps too, so a closing line waits its turn:\n\n<!-- steps -->\n- First, the problem\n- Then, the idea\n- Finally, the result\n\n> The conclusion comes last. `<!-- steps: off -->` ends the steps early.\n\n### Quotes and tables\n\n> A quote stands out from the text around it.\n\n| Plan | Price | Users |\n|---|---:|---:|\n| Starter | \u20B90 | 1 |\n| Team | \u20B9499 | 10 |\n\n### Code\n\n```python\ndef take(slide):\n return slide.best_attempt()\n```\n\n## \u{1F4D0} Diagrams\n\nWrite the diagram in a fenced block named after its language.\n\n### Graphviz\n\n```dot\ndigraph {\n rankdir=LR\n node [shape=box style=rounded]\n Markdown -> Deck -> Takes -> Video\n}\n```\n\n### D2\n\n```d2\ndirection: right\nwrite: Write {shape: rectangle}\npresent: Present\nrecord: Record\nwrite -> present -> record: one session\n```\n\n### SVG\n\nDrawn inline, so `currentColor` and `var(--accent)` follow the deck\'s colours. Press **L** and watch it switch.\n\n```svg\n<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 130">\n <rect x="10" y="10" width="90" height="80" rx="10" style="fill:var(--accent)"/>\n <rect x="115" y="10" width="90" height="80" rx="10" style="fill:var(--accent);opacity:.6"/>\n <rect x="220" y="10" width="90" height="80" rx="10" fill="none" stroke="currentColor" stroke-width="2"/>\n <text x="160" y="120" text-anchor="middle" font-size="14" fill="currentColor">accent, faded, outlined</text>\n</svg>\n```\n\n## \u{1F4CA} Charts\n\nECharts, as a fenced `echarts` block of JSON options.\n\n### A bar chart\n\n```echarts\n{\n "xAxis": {"type": "category", "data": ["Jan", "Feb", "Mar", "Apr", "May"]},\n "yAxis": {"type": "value"},\n "series": [{"type": "bar", "data": [12, 19, 15, 24, 30]}]\n}\n```\n\n### A donut\n\n```echarts\n{\n "series": [{"type": "pie", "radius": ["45%", "70%"],\n "data": [{"name": "Equity", "value": 85}, {"name": "Debt", "value": 5}, {"name": "Gold", "value": 10}]}]\n}\n```\n\n## \u{1F5BC}\uFE0F Images\n\nThe layout comes from what\'s on the slide; the alt text is the caption.\n\n### One image\n\n\n\n### Image and text\n\n\n\nAn image beside text makes a split card. Write the text first and the image moves to the right.\n\n### A gallery\n\nA list of images is a gallery. With `<!-- steps -->` it becomes a carousel: one image at a time, the next on each press. Diagrams and charts work the same, and after `<!-- steps -->` two or more of them in a row are a carousel without the list.\n\n<!-- steps -->\n- \n- \n- \n\n### A grid\n\nSeveral images in one paragraph sit side by side, up to four a row:\n\n  \n\n### Full screen\n\n<!-- view: full -->\n\n\n\n## \u25B6\uFE0F YouTube\n\nA YouTube link alone on a line becomes the video
|
|
1072
|
+
var showcase_default = '---\ntitle: Slidetake Showcase\nbrand: slidetake\nduration: 10m\n---\n\n#  Slide<span class="st-take">take</span> Showcase\n\nEverything a deck can hold, written in plain markdown and working on screen. Open **\u270E Editor** to see the source of any card. Press \u2192 to walk it, **O** for the map.\n\n## \u270D\uFE0F Text\n\nParagraphs, **bold**, *italic*, `code`, [links](https://slidetake.com) and lists, as markdown writes them.\n\n- One point\n- Another point\n - A detail under it\n\n### Steps\n\nPut `<!-- steps -->` before a list and it reveals one item per press. Everything after it on the card steps too, so a closing line waits its turn:\n\n<!-- steps -->\n- First, the problem\n- Then, the idea\n- Finally, the result\n\n> The conclusion comes last. `<!-- steps: off -->` ends the steps early.\n\n### Quotes and tables\n\n> A quote stands out from the text around it.\n\n| Plan | Price | Users |\n|---|---:|---:|\n| Starter | \u20B90 | 1 |\n| Team | \u20B9499 | 10 |\n\n### Code\n\n```python\ndef take(slide):\n return slide.best_attempt()\n```\n\n### Links between cards\n\n`{#charts}` at the end of a heading gives its card an id, and a link to `#charts` flies there: [see the charts](#charts).\n\n## \u{1F4D0} Diagrams\n\nWrite the diagram in a fenced block named after its language.\n\n### Graphviz\n\n```dot\ndigraph {\n rankdir=LR\n node [shape=box style=rounded]\n Markdown -> Deck -> Takes -> Video\n}\n```\n\n### D2\n\n```d2\ndirection: right\nwrite: Write {shape: rectangle}\npresent: Present\nrecord: Record\nwrite -> present -> record: one session\n```\n\n### SVG\n\nDrawn inline, so `currentColor` and `var(--accent)` follow the deck\'s colours. Press **L** and watch it switch.\n\n```svg\n<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 130">\n <rect x="10" y="10" width="90" height="80" rx="10" style="fill:var(--accent)"/>\n <rect x="115" y="10" width="90" height="80" rx="10" style="fill:var(--accent);opacity:.6"/>\n <rect x="220" y="10" width="90" height="80" rx="10" fill="none" stroke="currentColor" stroke-width="2"/>\n <text x="160" y="120" text-anchor="middle" font-size="14" fill="currentColor">accent, faded, outlined</text>\n</svg>\n```\n\n### One at a time\n\nDiagrams or charts in a row after `<!-- steps -->` become a carousel: one per press.\n\n<!-- steps -->\n\n```dot\ndigraph { rankdir=LR; node [shape=box style=rounded]; Idea -> Markdown -> Deck -> Takes }\n```\n\n```dot\ndigraph { rankdir=LR; node [shape=box style=rounded]; Takes -> Studio -> Video -> YouTube }\n```\n\n## \u{1F4CA} Charts {#charts}\n\nECharts, as a fenced `echarts` block of JSON options.\n\n### A bar chart\n\n```echarts\n{\n "xAxis": {"type": "category", "data": ["Jan", "Feb", "Mar", "Apr", "May"]},\n "yAxis": {"type": "value"},\n "series": [{"type": "bar", "data": [12, 19, 15, 24, 30]}]\n}\n```\n\n### A donut\n\n```echarts\n{\n "series": [{"type": "pie", "radius": ["45%", "70%"],\n "data": [{"name": "Equity", "value": 85}, {"name": "Debt", "value": 5}, {"name": "Gold", "value": 10}]}]\n}\n```\n\n## \u{1F5BC}\uFE0F Images\n\nThe layout comes from what\'s on the slide; the alt text is the caption.\n\n### One image\n\n\n\n### A tall image\n\n\n\n### Image and text\n\n\n\nAn image beside text makes a split card. Write the text first and the image moves to the right.\n\n### A gallery\n\nA list of images is a gallery. With `<!-- steps -->` it becomes a carousel: one image at a time, the next on each press. Diagrams and charts work the same, and after `<!-- steps -->` two or more of them in a row are a carousel without the list.\n\n<!-- steps -->\n- \n- \n- \n\n### A grid\n\nSeveral images in one paragraph sit side by side, up to four a row:\n\n  \n\n### Full screen\n\n<!-- view: full -->\n\n\n\n## \u25B6\uFE0F YouTube\n\nhttps://www.youtube.com/watch?v=jNQXAC9IVRw\n\nA YouTube link alone on a line becomes the video: the next press plays it, leaving the slide pauses it.\n\n## \u{1F3A5} Camera\n\n<!-- camera: on, full, on -->\n\nTry it: press **C** to turn on your camera, then \u2192. This card puts you in the corner, then full screen, then back, from one comment: `<!-- camera: on, full, on -->`.\n\n## \u{1F5FA}\uFE0F Layouts and the map\n\n<!-- view: overview -->\n\nThis card began by pulling back to the whole map: `<!-- view: overview -->` does that. Try it: press **1** to **4** for focus, path (the default), radial and tree, and **O** to zoom out and back.\n\n### Progress and timer\n\nPress **F**: in fullscreen a thin bar along the bottom fills as you go. This deck says `duration: 10m`, so a lighter clock layer grows behind it; if it shows past the fill, you\'re behind.\n\n## \u{1F3A8} Colours\n\nTry it: press **L** now. Dark and light switch, charts and diagrams included.\n\nA deck sets its own colour with one line, `accent: "#3b82f6"`, shaded for both modes. See it in [blue](/share#deflate:ZVJNa9wwEL3rV0y1hzZGTummn6YENodCoYVCAjksC9Zak5VY1zKacXZN2Gt-QH9if0kl2aSBnPTGevPmjZ_KshTsuMUKvnewbQcUummw4wrk4mL7eXn3UYoyksTiiSBurCMw2OzBagLfIeCRg4bWRagZ2CKw7xXUL7RqBbozgPcYRrau28Gdb1t_oAo4iqisQSpLNFYHzvRUGad3Qf8-h18BiaAofhRFnAKECFvPFshqg3QenS7gmrEnIb6-KkughKEsL0UZu658a4pCwToO2tPmzVuy_tBowrM8yaI20RUB6z1OLnzrhxB7rz0YjzR5n3b1Xab0mm0krGanIa2lgx_mmlpnEEY_vA6pJRtcTdsJUdc1ZkjiQR5XR0eyggfJY48RyEYz7nwYpQJpNOv4bS1_-i7VNwOm4xZNruyQjm_Byc0pgvGF1r2O6cmTEiAJg8N0u_5_vdXh-ZT3Cj4p-KDgi4J3y81pc0peZ_NzGNm-WQrjAjbsfFfF5XeWxSE4RigvoY9hxReQYKT4YKr8XihGGOlPile62QuxTkfKNP-1ORf4-_jnWUyLKQ86E_8A), [coral](/share#deflate:ZVJNa9wwEL3rV0y1hzZGSkn6EWJKYHMoFFooJNDDsrATa7IS61pGI2fXhL32B-Qn9pdUkk0TyElvrDdv3vhJay2iiy3V8K2DxgdsBTYNdbEGubi_vPhw9lkKnVhi8cwQt9YxGGp2YJHBdwR0iAGhdQlihGgJou8VbF6JbRRgZ4AeKIzRum4L975t_Z5riElEFQ1WRaKxGGKh58o43Ab8fQo_AzFDVX2vqjQFmAjufLTAFg3xabK6gJtIPQvx5Y3WwBmD1ldCp65r35qqUrBKg3a8fveerd83yHRSJllCk1wxRNzR5MK3fgip98aD8cST92lX3xVKj9EmwnJ2GvJaGPww19w6QzD64W3ILcXgctpOiM1mQwWyeJSH5cGxrOFRxrGnBGSDkbY-jFKBNBgxfVvJH77L9e1A-fhFplR2yMfX4OT6mMD4SusB29RxVAIkU3CUb1fP13cYXk75qOBCwScFlwrOztfH9TF7nc3PYRT75lwYF6iJznd1Wn5ro9gHFwn0FfQprPQCMkwUH0xd3gunCBP9v-I1NjshVvnImZa_NucCf_88vYhpMeXBJ-If) or [violet](/share#deflate:ZVJNa9wwEL3rV0y1hzZGTmlo-mFKYHMoFFooJJDDsmCtNVmJdS2jGe-uCXvtD-hP7C-pJJt0ISe9sd68eeOnsiwFO26xgm8d7J1vkYVuGuy4Arn4tLluHj9IUUaaWJxRxL11BAabHVhN4DsEPHLQ0LoINQNbBPa9gvqFWq1AdwZwj2Fk67otPPq29QeqgKOIyhqkskRjdeBMT5Vxehv0r0v4GZAIiuJ7UcQpQIiw8WyBrDZIl9HrAu4YexLiy6uyBEoYyvJGlLHr1remKBSs4qAdrd-8JesPjSa8yJMsahNdEbDe4eTCt34IsffOg_FIk_dpV99lSq_ZRsJydhrSWjr4Ya6pdQZh9MPrkFqyweW0nRB1XWOGJJ7kcXl0JCt4kjz2GIFsNOPWh1EqkEazjt9W8ofvUn0_YDoe0OTKDun4GpxcnyIYX2jtdRs7TkqAJAwO0-3q__VGh_Mp7xV8VHCt4LOCd1fr0_qUvM7m5zCyfXMljAvYsPNdFZffWhaH4BihvIE-hhVfQIKR4oOp8nuhGGGkPyve6mYnxCodKdP81-Zc4O_vP2cxLaY86EL8Aw).\n\n## \u2702\uFE0F Record a video\n\nTry it: press **\u25CF Studio** (top right), then **\u25CF Record**. Stumble on a slide, press \u2190, say it again; then pick the best take of each. Step by step: [Docs \u2192 Record a video](/docs#4-record-a-video).\n\n## \u{1F310} Open from anywhere\n\nTry it: this deck is a file on GitHub, and opens from there too: **[slidetake.com/gh/slidetake/slidetake/examples/showcase.md](/gh/slidetake/slidetake/examples/showcase.md)**. Gists, any markdown URL, and a link with the deck inside it open the same way, and `npx slidetake deck.md` opens one from your computer.\n\n## \u{1F680} Start your own\n\nOpen **\u270E Editor** and press **New** for a template (blank, talk or recording), or type in this deck to make it your copy.\n\nThe templates and this deck live in [examples/](https://github.com/slidetake/slidetake/tree/main/examples) on GitHub.\n\nNext, how it all works, step by step: **[Docs \u2192](/docs)**\n';
|
|
942
1073
|
|
|
943
1074
|
// src/core/text.js
|
|
944
1075
|
function slugify(s) {
|
|
@@ -1001,6 +1132,10 @@
|
|
|
1001
1132
|
const s = Math.max(0, Math.round(ms / 1e3)), h = Math.floor(s / 3600), m = Math.floor(s % 3600 / 60), sec = s % 60;
|
|
1002
1133
|
return (h ? h + ":" + String(m).padStart(2, "0") : m) + ":" + String(sec).padStart(2, "0");
|
|
1003
1134
|
}
|
|
1135
|
+
function fmtLength(ms) {
|
|
1136
|
+
const s = Math.max(0, Math.round(ms / 1e3)), h = Math.floor(s / 3600), m = Math.floor(s % 3600 / 60), sec = s % 60;
|
|
1137
|
+
return h ? h + "h " + String(m).padStart(2, "0") + "m" : m ? m + "m " + String(sec).padStart(2, "0") + "s" : sec + "s";
|
|
1138
|
+
}
|
|
1004
1139
|
|
|
1005
1140
|
// src/core/parse.js
|
|
1006
1141
|
function directiveText(body) {
|
|
@@ -1562,7 +1697,7 @@
|
|
|
1562
1697
|
out.get(e.id)
|
|
1563
1698
|
);
|
|
1564
1699
|
const next = sess.events[i + 1];
|
|
1565
|
-
slide.takes.push({ no: slide.takes.length + 1, start: evTime(e), end: next ? evTime(next) : end });
|
|
1700
|
+
slide.takes.push({ no: slide.takes.length + 1, start: evTime(e) + (e.skip || 0), end: next ? evTime(next) - (next.lead || 0) : end });
|
|
1566
1701
|
});
|
|
1567
1702
|
return out;
|
|
1568
1703
|
}
|
|
@@ -1614,7 +1749,7 @@
|
|
|
1614
1749
|
};
|
|
1615
1750
|
var shq = (p) => "'" + String(p).replace(/'/g, "'\\''") + "'";
|
|
1616
1751
|
var secs = (ms) => (ms / 1e3).toFixed(3);
|
|
1617
|
-
function ffmpegScript(sess, mode, { input, outputName, sectionOf: sectionOf2 }) {
|
|
1752
|
+
function ffmpegScript(sess, mode, { input, outputName, sectionOf: sectionOf2, loudness }) {
|
|
1618
1753
|
const ranges = mergedRanges(pickedRanges(sess));
|
|
1619
1754
|
if (!sess.withObs) return "# This was a rehearsal: nothing was recorded.";
|
|
1620
1755
|
if (!ranges.length) return "# Every slide is left out: nothing to render.";
|
|
@@ -1635,7 +1770,319 @@
|
|
|
1635
1770
|
const vKeep = ranges.map((r) => "gte(t," + half(r.f0) + ")*lt(t," + half(r.f1) + ")").join("+");
|
|
1636
1771
|
const aKeep = ranges.map((r) => "gte(t," + at(r.f0) + ")*lt(t," + at(r.f1) + ")").join("+");
|
|
1637
1772
|
const video = mode === "mac" ? "-c:v h264_videotoolbox -b:v 12M" : "-c:v libx264 -crf 18 -preset medium";
|
|
1638
|
-
return chapters + "ffmpeg -i " + shq(input) + " -i /tmp/slidetake-chapters.txt" + maps + ` -vf "select='` + vKeep + `',setpts=N/FRAME_RATE/TB" -af "asetnsamples=n=48:p=0,aselect='` + aKeep +
|
|
1773
|
+
return chapters + "ffmpeg -i " + shq(input) + " -i /tmp/slidetake-chapters.txt" + maps + ` -vf "select='` + vKeep + `',setpts=N/FRAME_RATE/TB" -af "asetnsamples=n=48:p=0,aselect='` + aKeep + "',asetpts=N/SR/TB" + (loudness ? ",loudnorm=I=-14:TP=-1:LRA=11" : "") + '"' + (loudness ? " -ar 48000" : "") + // loudnorm works at 192 kHz; the file goes back to 48 kHz
|
|
1774
|
+
" " + video + " -c:a aac -b:a 192k -movflags +faststart " + shq(output);
|
|
1775
|
+
}
|
|
1776
|
+
|
|
1777
|
+
// src/core/record.js
|
|
1778
|
+
var QUALITIES = [
|
|
1779
|
+
{ name: "1080p", w: 1920, h: 1080, bitrate: 8e6 },
|
|
1780
|
+
{ name: "720p", w: 1280, h: 720, bitrate: 5e6 }
|
|
1781
|
+
];
|
|
1782
|
+
var AUDIO_BITRATE = 192e3;
|
|
1783
|
+
var FPS = 30;
|
|
1784
|
+
function frame16x9(w, h) {
|
|
1785
|
+
const fw = Math.min(w, h * 16 / 9), fh = fw * 9 / 16;
|
|
1786
|
+
return { w: fw, h: fh, x: (w - fw) / 2, y: (h - fh) / 2 };
|
|
1787
|
+
}
|
|
1788
|
+
function bestQuality(w, h, dpr) {
|
|
1789
|
+
const f = frame16x9(w, h);
|
|
1790
|
+
const device = (
|
|
1791
|
+
/** @type {[number, number]} */
|
|
1792
|
+
[Math.floor(f.w * dpr), Math.floor(f.h * dpr)]
|
|
1793
|
+
);
|
|
1794
|
+
return { quality: QUALITIES.find((q) => device[0] >= q.w && device[1] >= q.h) || null, device };
|
|
1795
|
+
}
|
|
1796
|
+
var RECORDING_TYPES = [
|
|
1797
|
+
"video/mp4;codecs=avc1.640028,mp4a.40.2",
|
|
1798
|
+
"video/mp4;codecs=avc1,mp4a.40.2",
|
|
1799
|
+
"video/mp4",
|
|
1800
|
+
"video/webm;codecs=vp9,opus",
|
|
1801
|
+
"video/webm;codecs=vp8,opus",
|
|
1802
|
+
"video/webm"
|
|
1803
|
+
];
|
|
1804
|
+
var recordingType = (isSupported) => RECORDING_TYPES.find((t) => isSupported(t)) || "";
|
|
1805
|
+
var clipExt = (type) => type.startsWith("video/mp4") ? "mp4" : "webm";
|
|
1806
|
+
var bytesPerMinute = (q) => Math.round((q.bitrate + AUDIO_BITRATE) / 8 * 60);
|
|
1807
|
+
function clipPlan(sess) {
|
|
1808
|
+
const evs = /* @__PURE__ */ new Map();
|
|
1809
|
+
sess.events.forEach((e, i) => {
|
|
1810
|
+
if (!evs.has(e.id)) evs.set(e.id, []);
|
|
1811
|
+
evs.get(e.id).push(i);
|
|
1812
|
+
});
|
|
1813
|
+
const out = [];
|
|
1814
|
+
takesOf(
|
|
1815
|
+
/** @type {any} */
|
|
1816
|
+
sess
|
|
1817
|
+
).forEach((slide) => {
|
|
1818
|
+
const pick = sess.picks[slide.id] ?? slide.takes.length;
|
|
1819
|
+
const take = pick ? slide.takes[pick - 1] : null;
|
|
1820
|
+
if (!take) return;
|
|
1821
|
+
const e = sess.events[
|
|
1822
|
+
/** @type {number[]} */
|
|
1823
|
+
evs.get(slide.id)[pick - 1]
|
|
1824
|
+
];
|
|
1825
|
+
if (e && e.clip && take.end > take.start) out.push({ id: slide.id, title: slide.title, clip: e.clip, keep: (take.end - take.start) / 1e3 });
|
|
1826
|
+
});
|
|
1827
|
+
return out;
|
|
1828
|
+
}
|
|
1829
|
+
var afterPrevious = (prev, t) => t > prev ? t : prev + 1e-3;
|
|
1830
|
+
var deviceName = (label) => label.replace(/\s*\([0-9a-f]{4}:[0-9a-f]{4}\)\s*$/i, "");
|
|
1831
|
+
var sizeName = (w, h) => Math.min(w, h) + "p" + (h > w ? " portrait" : "");
|
|
1832
|
+
|
|
1833
|
+
// src/core/loudness.js
|
|
1834
|
+
var YOUTUBE_LUFS = -14;
|
|
1835
|
+
var PEAK_CEILING_DB = -1.5;
|
|
1836
|
+
function kWeighting(rate) {
|
|
1837
|
+
let f0 = 1681.974450955533, q = 0.7071752369554196, k = Math.tan(Math.PI * f0 / rate);
|
|
1838
|
+
const vh = Math.pow(10, 3.999843853973347 / 20), vb = Math.pow(vh, 0.4996667741545416);
|
|
1839
|
+
let a0 = 1 + k / q + k * k;
|
|
1840
|
+
const shelf = {
|
|
1841
|
+
b0: (vh + vb * k / q + k * k) / a0,
|
|
1842
|
+
b1: 2 * (k * k - vh) / a0,
|
|
1843
|
+
b2: (vh - vb * k / q + k * k) / a0,
|
|
1844
|
+
a1: 2 * (k * k - 1) / a0,
|
|
1845
|
+
a2: (1 - k / q + k * k) / a0
|
|
1846
|
+
};
|
|
1847
|
+
f0 = 38.13547087602444;
|
|
1848
|
+
q = 0.5003270373238773;
|
|
1849
|
+
k = Math.tan(Math.PI * f0 / rate);
|
|
1850
|
+
a0 = 1 + k / q + k * k;
|
|
1851
|
+
const highPass = { b0: 1, b1: -2, b2: 1, a1: 2 * (k * k - 1) / a0, a2: (1 - k / q + k * k) / a0 };
|
|
1852
|
+
return { shelf, highPass };
|
|
1853
|
+
}
|
|
1854
|
+
var toDb = (x) => 20 * Math.log10(x);
|
|
1855
|
+
var lufs = (meanSquare) => -0.691 + 10 * Math.log10(meanSquare);
|
|
1856
|
+
function loudnessMeter(sampleRate, channels) {
|
|
1857
|
+
const { shelf: s, highPass: h } = kWeighting(sampleRate);
|
|
1858
|
+
const step2 = Math.round(sampleRate / 10);
|
|
1859
|
+
const energy = [];
|
|
1860
|
+
const state = Array.from({ length: channels }, () => new Float64Array(8));
|
|
1861
|
+
const weight = (
|
|
1862
|
+
/** @param {number} c */
|
|
1863
|
+
(c) => c >= 3 && c <= 4 ? 1.41 : 1
|
|
1864
|
+
);
|
|
1865
|
+
let frames = 0, peak = 0;
|
|
1866
|
+
return {
|
|
1867
|
+
/** @param {Float32Array[]} planes one array per channel, the same length */
|
|
1868
|
+
add(planes) {
|
|
1869
|
+
const len = planes[0].length;
|
|
1870
|
+
for (let c = 0; c < channels; c++) {
|
|
1871
|
+
const x = planes[c] || planes[0], st = state[c], w = weight(c);
|
|
1872
|
+
let [x1, x2, y1, y2, u1, u2, v1, v2] = st;
|
|
1873
|
+
let at = frames, k = Math.floor(at / step2), next = (k + 1) * step2, acc = 0;
|
|
1874
|
+
for (let i = 0; i < len; i++) {
|
|
1875
|
+
const v = x[i];
|
|
1876
|
+
if (v > peak) peak = v;
|
|
1877
|
+
else if (-v > peak) peak = -v;
|
|
1878
|
+
const y = s.b0 * v + s.b1 * x1 + s.b2 * x2 - s.a1 * y1 - s.a2 * y2;
|
|
1879
|
+
x2 = x1;
|
|
1880
|
+
x1 = v;
|
|
1881
|
+
y2 = y1;
|
|
1882
|
+
y1 = y;
|
|
1883
|
+
const z = h.b0 * y + h.b1 * u1 + h.b2 * u2 - h.a1 * v1 - h.a2 * v2;
|
|
1884
|
+
u2 = u1;
|
|
1885
|
+
u1 = y;
|
|
1886
|
+
v2 = v1;
|
|
1887
|
+
v1 = z;
|
|
1888
|
+
acc += z * z;
|
|
1889
|
+
if (++at === next) {
|
|
1890
|
+
energy[k] = (energy[k] || 0) + w * acc;
|
|
1891
|
+
acc = 0;
|
|
1892
|
+
k++;
|
|
1893
|
+
next += step2;
|
|
1894
|
+
}
|
|
1895
|
+
}
|
|
1896
|
+
if (acc) energy[k] = (energy[k] || 0) + w * acc;
|
|
1897
|
+
st.set([x1, x2, y1, y2, u1, u2, v1, v2]);
|
|
1898
|
+
}
|
|
1899
|
+
frames += len;
|
|
1900
|
+
},
|
|
1901
|
+
/** @returns {{integrated: number, peak: number, peakDb: number}} integrated in LUFS (-Infinity for silence) */
|
|
1902
|
+
result() {
|
|
1903
|
+
const done = Math.floor(frames / step2);
|
|
1904
|
+
const blocks = [];
|
|
1905
|
+
for (let j = 3; j < done; j++) blocks.push(((energy[j - 3] || 0) + (energy[j - 2] || 0) + (energy[j - 1] || 0) + (energy[j] || 0)) / (4 * step2));
|
|
1906
|
+
const mean = (
|
|
1907
|
+
/** @param {number[]} a */
|
|
1908
|
+
(a) => a.reduce((x, y) => x + y, 0) / a.length
|
|
1909
|
+
);
|
|
1910
|
+
const audible = blocks.filter((z) => lufs(z) > -70);
|
|
1911
|
+
const kept = audible.length ? audible.filter((z) => lufs(z) > lufs(mean(audible)) - 10) : [];
|
|
1912
|
+
return { integrated: kept.length ? lufs(mean(kept)) : -Infinity, peak, peakDb: peak > 0 ? toDb(peak) : -Infinity };
|
|
1913
|
+
}
|
|
1914
|
+
};
|
|
1915
|
+
}
|
|
1916
|
+
var MAX_BOOST_DB = 20;
|
|
1917
|
+
function gainToTarget(measured, { limit = false, target = YOUTUBE_LUFS, ceiling = PEAK_CEILING_DB } = {}) {
|
|
1918
|
+
if (!isFinite(measured.integrated)) return 0;
|
|
1919
|
+
const g = Math.min(target - measured.integrated, MAX_BOOST_DB);
|
|
1920
|
+
if (g <= 0 || limit || measured.peakDb == null || !isFinite(measured.peakDb)) return g;
|
|
1921
|
+
return Math.max(0, Math.min(g, ceiling - measured.peakDb));
|
|
1922
|
+
}
|
|
1923
|
+
var dbToGain = (db) => Math.pow(10, db / 20);
|
|
1924
|
+
function peakLimiter(sampleRate, channels, opts = {}) {
|
|
1925
|
+
const ceiling = dbToGain(opts.ceilingDb ?? PEAK_CEILING_DB);
|
|
1926
|
+
const L = Math.max(1, Math.round((opts.lookahead ?? 5e-3) * sampleRate));
|
|
1927
|
+
const rel = 1 - Math.exp(-1 / ((opts.release ?? 0.05) * sampleRate));
|
|
1928
|
+
const held = Array.from({ length: channels }, () => []);
|
|
1929
|
+
const gains = [];
|
|
1930
|
+
const mins = [];
|
|
1931
|
+
const box = new Float64Array(L);
|
|
1932
|
+
let n = 0, boxSum = L, smooth = 1, below = false, events = 0, head = 0;
|
|
1933
|
+
box.fill(1);
|
|
1934
|
+
const step2 = (need) => {
|
|
1935
|
+
while (mins.length && mins[mins.length - 1][1] >= need) mins.pop();
|
|
1936
|
+
mins.push([n, need]);
|
|
1937
|
+
while (mins[0][0] <= n - L) mins.shift();
|
|
1938
|
+
const h = mins[0][1];
|
|
1939
|
+
smooth = h < smooth ? h : smooth + (h - smooth) * rel;
|
|
1940
|
+
if (smooth > 0.999) smooth = 1;
|
|
1941
|
+
boxSum += smooth - box[n % L];
|
|
1942
|
+
box[n % L] = smooth;
|
|
1943
|
+
if (n >= L - 1) {
|
|
1944
|
+
const avg = boxSum / L, g = avg > 0.999 ? 1 : avg;
|
|
1945
|
+
gains.push(g);
|
|
1946
|
+
if (g < 0.999 && !below) events++;
|
|
1947
|
+
below = g < 0.999;
|
|
1948
|
+
}
|
|
1949
|
+
n++;
|
|
1950
|
+
};
|
|
1951
|
+
return {
|
|
1952
|
+
/** @param {Float32Array[]} planes */
|
|
1953
|
+
push(planes) {
|
|
1954
|
+
const len = planes[0].length;
|
|
1955
|
+
for (let i = 0; i < len; i++) {
|
|
1956
|
+
let peak = 0;
|
|
1957
|
+
for (let c = 0; c < channels; c++) {
|
|
1958
|
+
const v = (planes[c] || planes[0])[i];
|
|
1959
|
+
held[c].push(v);
|
|
1960
|
+
if (v > peak) peak = v;
|
|
1961
|
+
else if (-v > peak) peak = -v;
|
|
1962
|
+
}
|
|
1963
|
+
step2(peak > ceiling ? ceiling / peak : 1);
|
|
1964
|
+
}
|
|
1965
|
+
},
|
|
1966
|
+
/** frames whose gain is known, ready to take */
|
|
1967
|
+
ready: () => gains.length - head,
|
|
1968
|
+
/** the next n ready frames, limited, one array per channel @param {number} count */
|
|
1969
|
+
take(count) {
|
|
1970
|
+
const out = Array.from({ length: channels }, () => new Float32Array(count));
|
|
1971
|
+
for (let i = 0; i < count; i++) {
|
|
1972
|
+
const g = gains[head + i];
|
|
1973
|
+
for (let c = 0; c < channels; c++) out[c][i] = held[c][head + i] * g;
|
|
1974
|
+
}
|
|
1975
|
+
head += count;
|
|
1976
|
+
if (head > 65536) {
|
|
1977
|
+
gains.splice(0, head);
|
|
1978
|
+
held.forEach((h) => h.splice(0, head));
|
|
1979
|
+
head = 0;
|
|
1980
|
+
}
|
|
1981
|
+
return out;
|
|
1982
|
+
},
|
|
1983
|
+
/** no more input: let the last frames through */
|
|
1984
|
+
end() {
|
|
1985
|
+
for (let i = 0; i < L - 1; i++) {
|
|
1986
|
+
for (let c = 0; c < channels; c++) held[c].push(0);
|
|
1987
|
+
step2(1);
|
|
1988
|
+
}
|
|
1989
|
+
},
|
|
1990
|
+
/** how many separate moments were turned down */
|
|
1991
|
+
get events() {
|
|
1992
|
+
return events;
|
|
1993
|
+
}
|
|
1994
|
+
};
|
|
1995
|
+
}
|
|
1996
|
+
|
|
1997
|
+
// src/core/board.js
|
|
1998
|
+
function fingerprint(text) {
|
|
1999
|
+
let h = 2166136261;
|
|
2000
|
+
for (let i = 0; i < text.length; i++) {
|
|
2001
|
+
h ^= text.charCodeAt(i);
|
|
2002
|
+
h = Math.imul(h, 16777619);
|
|
2003
|
+
}
|
|
2004
|
+
return (h >>> 0).toString(36);
|
|
2005
|
+
}
|
|
2006
|
+
function deckSlides(order2, info) {
|
|
2007
|
+
return order2.map((id, i) => {
|
|
2008
|
+
const prev = order2[i - 1] || "";
|
|
2009
|
+
return { id, title: info(id).title, fp: info(id).fp, prev, prevFp: prev ? info(prev).fp : "" };
|
|
2010
|
+
});
|
|
2011
|
+
}
|
|
2012
|
+
function takesFromRun(sess, run, slides) {
|
|
2013
|
+
const byId = new Map(slides.map((s) => [s.id, s]));
|
|
2014
|
+
const evs = /* @__PURE__ */ new Map();
|
|
2015
|
+
sess.events.forEach((e) => {
|
|
2016
|
+
if (!evs.has(e.id)) evs.set(e.id, []);
|
|
2017
|
+
evs.get(e.id).push(e);
|
|
2018
|
+
});
|
|
2019
|
+
const out = [];
|
|
2020
|
+
takesOf(
|
|
2021
|
+
/** @type {any} */
|
|
2022
|
+
sess
|
|
2023
|
+
).forEach((slide) => slide.takes.forEach((t, k) => {
|
|
2024
|
+
const e = (
|
|
2025
|
+
/** @type {any[]} */
|
|
2026
|
+
evs.get(slide.id)[k]
|
|
2027
|
+
);
|
|
2028
|
+
if (!e || !e.clip || t.end <= t.start) return;
|
|
2029
|
+
const s = byId.get(slide.id);
|
|
2030
|
+
if (!s) return;
|
|
2031
|
+
out.push({
|
|
2032
|
+
uid: e.clip,
|
|
2033
|
+
id: slide.id,
|
|
2034
|
+
title: slide.title,
|
|
2035
|
+
clip: e.clip,
|
|
2036
|
+
ms: t.end - t.start,
|
|
2037
|
+
run,
|
|
2038
|
+
date: sess.date,
|
|
2039
|
+
fp: s.fp,
|
|
2040
|
+
prev: s.prev,
|
|
2041
|
+
prevFp: s.prevFp,
|
|
2042
|
+
at: t.start
|
|
2043
|
+
});
|
|
2044
|
+
}));
|
|
2045
|
+
return out.sort((a, b) => a.at - b.at).map(({ at, ...take }) => take);
|
|
2046
|
+
}
|
|
2047
|
+
function boardRows(board2, slides) {
|
|
2048
|
+
return slides.map((s) => {
|
|
2049
|
+
const takes = board2.takes.filter((t) => t.id === s.id).map((t, i) => ({
|
|
2050
|
+
...t,
|
|
2051
|
+
no: i + 1,
|
|
2052
|
+
outdated: (
|
|
2053
|
+
/** @type {'' | 'slide' | 'before'} */
|
|
2054
|
+
t.fp !== s.fp ? "slide" : (t.prev ?? null) !== s.prev || t.prevFp !== s.prevFp ? "before" : ""
|
|
2055
|
+
)
|
|
2056
|
+
}));
|
|
2057
|
+
const chosen = board2.picks[s.id];
|
|
2058
|
+
let pick = null;
|
|
2059
|
+
if (chosen && takes.some((t) => t.uid === chosen)) pick = chosen;
|
|
2060
|
+
else {
|
|
2061
|
+
const fresh = takes.filter((t) => !t.outdated);
|
|
2062
|
+
pick = fresh.length ? fresh[fresh.length - 1].uid : null;
|
|
2063
|
+
}
|
|
2064
|
+
return { id: s.id, title: s.title, takes, pick };
|
|
2065
|
+
});
|
|
2066
|
+
}
|
|
2067
|
+
function boardSession(rows) {
|
|
2068
|
+
const events = [];
|
|
2069
|
+
let t = 0;
|
|
2070
|
+
rows.forEach((r) => {
|
|
2071
|
+
const take = r.pick ? r.takes.find((x) => x.uid === r.pick) : null;
|
|
2072
|
+
if (!take) return;
|
|
2073
|
+
events.push({ id: r.id, title: r.title, t, clip: take.clip });
|
|
2074
|
+
t += take.ms;
|
|
2075
|
+
});
|
|
2076
|
+
return { events, picks: {}, total: t };
|
|
2077
|
+
}
|
|
2078
|
+
function selectedInOrder(order2, selected2) {
|
|
2079
|
+
const set = new Set(selected2);
|
|
2080
|
+
return order2.filter((id) => set.has(id));
|
|
2081
|
+
}
|
|
2082
|
+
function rangeOf(order2, anchor, id) {
|
|
2083
|
+
const a = anchor ? order2.indexOf(anchor) : -1, b = order2.indexOf(id);
|
|
2084
|
+
if (a < 0 || b < 0) return [id];
|
|
2085
|
+
return order2.slice(Math.min(a, b), Math.max(a, b) + 1);
|
|
1639
2086
|
}
|
|
1640
2087
|
|
|
1641
2088
|
// src/app.js
|
|
@@ -1643,7 +2090,7 @@
|
|
|
1643
2090
|
var LOCAL = window.SLIDETAKE_LOCAL || null;
|
|
1644
2091
|
var LOGO = document.querySelector("header .mark .logo").outerHTML;
|
|
1645
2092
|
document.documentElement.classList.toggle("embed", !!EMBED);
|
|
1646
|
-
var RECORDING_UI = !EMBED
|
|
2093
|
+
var RECORDING_UI = !EMBED;
|
|
1647
2094
|
document.documentElement.classList.toggle("no-record", !RECORDING_UI);
|
|
1648
2095
|
var reduceMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
1649
2096
|
var BUILTIN = { home: sample_default, docs: docs_default, features: features_default, privacy: privacy_default, showcase: showcase_default, "template:blank": blank_default, "template:talk": talk_default, "template:recording": recording_default };
|
|
@@ -1708,6 +2155,17 @@
|
|
|
1708
2155
|
return { html: "<p>(could not render)</p>", err: "render error" };
|
|
1709
2156
|
}
|
|
1710
2157
|
}
|
|
2158
|
+
var NAME_MARK = '<span class="st-name">' + LOGO + 'Slide<span class="st-take">take</span></span>';
|
|
2159
|
+
function markName(body) {
|
|
2160
|
+
const walk = document.createTreeWalker(body, NodeFilter.SHOW_TEXT, { acceptNode: (t) => /Slidetake/.test(t.nodeValue || "") && !t.parentElement?.closest("code, pre, kbd, svg, em, .st-name") ? 1 : 2 });
|
|
2161
|
+
const hits = [];
|
|
2162
|
+
while (walk.nextNode()) hits.push(walk.currentNode);
|
|
2163
|
+
hits.forEach((t) => {
|
|
2164
|
+
const span = document.createElement("span");
|
|
2165
|
+
span.innerHTML = escapeHtml(t.nodeValue || "").replace(/Slidetake/g, NAME_MARK);
|
|
2166
|
+
t.replaceWith(...span.childNodes);
|
|
2167
|
+
});
|
|
2168
|
+
}
|
|
1711
2169
|
function applyDeckSettings() {
|
|
1712
2170
|
const name = deck.brand || "", logo = deck.logo || "";
|
|
1713
2171
|
const chip = /^chip$/i.test(deck.brand_style || "");
|
|
@@ -1817,7 +2275,7 @@
|
|
|
1817
2275
|
document.documentElement.classList.toggle("dark", next === "dark");
|
|
1818
2276
|
} else save("slidetake:mode", next);
|
|
1819
2277
|
applyMode();
|
|
1820
|
-
if (world.querySelector(".echarts-container, .diagram.d2")) rebuild(true);
|
|
2278
|
+
if (world.querySelector(".echarts-container, .diagram.d2, .diagram.dot")) rebuild(true);
|
|
1821
2279
|
}
|
|
1822
2280
|
function cameraList() {
|
|
1823
2281
|
const raw = (deck.camera || "").replace(/^\[|\]$/g, "");
|
|
@@ -2159,10 +2617,10 @@
|
|
|
2159
2617
|
const parts = [...body.children].filter((c) => !/^H[1-6]$/.test(c.tagName) && !(c.nodeType === 1 && c.tagName === "HR"));
|
|
2160
2618
|
const media = parts.filter((c) => c.matches("figure.media"));
|
|
2161
2619
|
if (media.length === 1 && parts.length === 1) el.classList.add("card-media");
|
|
2162
|
-
if (parts.length === 1 && (parts[0].matches("figure.media:not(.yt)") || parts[0].matches(".gallery.carousel:not(.diagrams)"))) el.classList.add("card-bleed");
|
|
2163
2620
|
const walker = document.createTreeWalker(body, NodeFilter.SHOW_COMMENT);
|
|
2164
2621
|
while (walker.nextNode()) if (/^\s*view\s*:\s*full\s*$/i.test(walker.currentNode.data)) el.classList.add("card-full");
|
|
2165
|
-
|
|
2622
|
+
if (parts.length === 1 && (parts[0].matches("figure.media:not(.yt)") || parts[0].matches(".gallery.carousel:not(.diagrams)"))) el.classList.add("card-bleed");
|
|
2623
|
+
else if (media.length === 1 && parts.length > 1 && !media[0].matches(".yt")) {
|
|
2166
2624
|
el.classList.add("card-split", parts.indexOf(media[0]) === 0 ? "media-first" : "media-last");
|
|
2167
2625
|
const text = document.createElement("div");
|
|
2168
2626
|
text.className = "split-text";
|
|
@@ -2282,7 +2740,7 @@
|
|
|
2282
2740
|
n.visual = !!b.querySelector("iframe, .echarts-container, pre > code.language-dot, pre > code.language-d2, pre > code.language-echarts, .diagram, figure.media");
|
|
2283
2741
|
if (n.visual) w = XWIDE_W;
|
|
2284
2742
|
const full = el.classList.contains("card-full");
|
|
2285
|
-
el.classList.remove("img-portrait", "img-landscape", "img-overlay");
|
|
2743
|
+
el.classList.remove("img-portrait", "img-landscape", "img-overlay", "img-cover");
|
|
2286
2744
|
if (full) w = XWIDE_W;
|
|
2287
2745
|
if (el.classList.contains("card-bleed")) {
|
|
2288
2746
|
const aspect = Math.max(0, ...[...b.querySelectorAll("img")].map((i) => i.naturalWidth && i.naturalHeight ? i.naturalWidth / i.naturalHeight : 0)) || 16 / 9;
|
|
@@ -2294,6 +2752,7 @@
|
|
|
2294
2752
|
} else if (full || Math.abs(aspect - 16 / 9) < 0.08) {
|
|
2295
2753
|
el.classList.add("img-overlay");
|
|
2296
2754
|
w = XWIDE_W;
|
|
2755
|
+
if (aspect >= 16 / 9 && aspect <= 16 / 9 * 1.15) el.classList.add("img-cover");
|
|
2297
2756
|
} else if (aspect < 1.3) {
|
|
2298
2757
|
const iw = Math.min(Math.round(BLEED_H * aspect), XWIDE_W - 300);
|
|
2299
2758
|
el.classList.add("img-portrait");
|
|
@@ -2313,6 +2772,16 @@
|
|
|
2313
2772
|
w = Math.max(w, Math.min(WIDE_W, Math.ceil(t.offsetWidth) + pad + 12));
|
|
2314
2773
|
});
|
|
2315
2774
|
}
|
|
2775
|
+
const codes = b.querySelectorAll("pre");
|
|
2776
|
+
if (codes.length) {
|
|
2777
|
+
el.style.width = XWIDE_W + "px";
|
|
2778
|
+
const pad = el.offsetWidth - b.clientWidth;
|
|
2779
|
+
codes.forEach((p) => {
|
|
2780
|
+
p.style.width = "max-content";
|
|
2781
|
+
w = Math.max(w, Math.min(XWIDE_W, Math.ceil(p.offsetWidth) + pad + 2));
|
|
2782
|
+
p.style.width = "";
|
|
2783
|
+
});
|
|
2784
|
+
}
|
|
2316
2785
|
const growers = b.querySelectorAll(".fragment.grow");
|
|
2317
2786
|
if (growers.length) {
|
|
2318
2787
|
el.style.width = w + "px";
|
|
@@ -2408,6 +2877,12 @@
|
|
|
2408
2877
|
});
|
|
2409
2878
|
return t;
|
|
2410
2879
|
}
|
|
2880
|
+
function dotTheme() {
|
|
2881
|
+
const text = tokenHex("--text"), muted = tokenHex("--text-muted"), accent = tokenHex("--accent");
|
|
2882
|
+
const font = '"Helvetica,Arial,sans-serif"';
|
|
2883
|
+
return ' graph [bgcolor=transparent color="' + muted + '" fontcolor="' + text + '" fontname=' + font + '] node [color="' + accent + '" fontcolor="' + text + '" fontname=' + font + '] edge [color="' + muted + '" fontcolor="' + muted + '" fontname=' + font + "] ";
|
|
2884
|
+
}
|
|
2885
|
+
var withDotTheme = (code, theme) => code.replace("{", "{" + theme);
|
|
2411
2886
|
var withD2Defaults = (code) => /d2-config\s*:/.test(code) ? code : "vars: {\n d2-config: {\n layout-engine: elk\n }\n}\n" + code;
|
|
2412
2887
|
var scripts = {};
|
|
2413
2888
|
function loadScript(url) {
|
|
@@ -2442,11 +2917,12 @@
|
|
|
2442
2917
|
await loadScript(VIZ_URL);
|
|
2443
2918
|
viz = viz || await Viz.instance();
|
|
2444
2919
|
if (gen !== buildGen) return;
|
|
2920
|
+
const theme = dotTheme();
|
|
2445
2921
|
dots.forEach((code) => {
|
|
2446
2922
|
const box = document.createElement("div");
|
|
2447
|
-
box.className = "diagram";
|
|
2923
|
+
box.className = "diagram dot";
|
|
2448
2924
|
try {
|
|
2449
|
-
box.appendChild(viz.renderSVGElement(code.textContent));
|
|
2925
|
+
box.appendChild(viz.renderSVGElement(withDotTheme(code.textContent, theme)));
|
|
2450
2926
|
} catch (e) {
|
|
2451
2927
|
box.className = "diagram err";
|
|
2452
2928
|
box.textContent = "Diagram error: " + e.message;
|
|
@@ -2565,6 +3041,7 @@
|
|
|
2565
3041
|
applyStepsComments(body);
|
|
2566
3042
|
groupVisualRuns(body);
|
|
2567
3043
|
applyMedia(el, body);
|
|
3044
|
+
if (/^slidetake$/i.test(deck.brand || "")) markName(body);
|
|
2568
3045
|
body.querySelectorAll("thead").forEach((h) => {
|
|
2569
3046
|
if (!h.textContent.trim()) h.remove();
|
|
2570
3047
|
});
|
|
@@ -2949,6 +3426,7 @@
|
|
|
2949
3426
|
leaveSlide();
|
|
2950
3427
|
}
|
|
2951
3428
|
const arriving = id !== currentId;
|
|
3429
|
+
if (arriving) arrivedFrom = currentId;
|
|
2952
3430
|
currentId = id;
|
|
2953
3431
|
clearTimeout(mapTimer);
|
|
2954
3432
|
mapTimer = null;
|
|
@@ -2959,7 +3437,7 @@
|
|
|
2959
3437
|
el.classList.remove("entering");
|
|
2960
3438
|
}
|
|
2961
3439
|
applyStepState(arriving);
|
|
2962
|
-
if (arriving) logTake("slide", id);
|
|
3440
|
+
if (arriving && !quietArrival) logTake("slide", id);
|
|
2963
3441
|
const n = nodes.get(id);
|
|
2964
3442
|
if (arriving && n.mapFirst && !atLastStep && !instant && layoutMode !== "focus") {
|
|
2965
3443
|
fitAll();
|
|
@@ -2973,6 +3451,8 @@
|
|
|
2973
3451
|
setHash(id);
|
|
2974
3452
|
}
|
|
2975
3453
|
var mapTimer = null;
|
|
3454
|
+
var arrivedFrom = null;
|
|
3455
|
+
var quietArrival = false;
|
|
2976
3456
|
function leaveSlide() {
|
|
2977
3457
|
const prev = nodes.get(currentId);
|
|
2978
3458
|
if (!prev) return;
|
|
@@ -3300,6 +3780,7 @@
|
|
|
3300
3780
|
function setPresent(on) {
|
|
3301
3781
|
presenting = on;
|
|
3302
3782
|
document.body.classList.toggle("presenting", on);
|
|
3783
|
+
lightUp(document.getElementById("btn-present"), on);
|
|
3303
3784
|
markActive();
|
|
3304
3785
|
const de = document.documentElement;
|
|
3305
3786
|
if (on && de.requestFullscreen && !document.fullscreenElement) de.requestFullscreen().catch(() => {
|
|
@@ -3320,7 +3801,6 @@
|
|
|
3320
3801
|
var NEXT_KEYS = ["ArrowRight", "PageDown", " ", "ArrowDown", "Enter"];
|
|
3321
3802
|
var BACK_KEYS = ["ArrowLeft", "PageUp", "ArrowUp", "r", "R"];
|
|
3322
3803
|
var PAUSE_KEYS = ["b", "B", "."];
|
|
3323
|
-
var recDialog = document.getElementById("rec-dialog");
|
|
3324
3804
|
var reviewDialog = document.getElementById("review");
|
|
3325
3805
|
var countdownEl = document.getElementById("rec-countdown");
|
|
3326
3806
|
var pausedEl = document.getElementById("rec-paused");
|
|
@@ -3329,12 +3809,12 @@
|
|
|
3329
3809
|
var obsPass = document.getElementById("obs-pass");
|
|
3330
3810
|
var obsRemember = document.getElementById("obs-remember");
|
|
3331
3811
|
var obsStatus = document.getElementById("obs-status");
|
|
3332
|
-
var recStartBtn = document.getElementById("rec-start");
|
|
3333
3812
|
var obs = null;
|
|
3334
3813
|
var obsConnected = false;
|
|
3335
3814
|
var recStartResolve = null;
|
|
3336
3815
|
var obsFps = null;
|
|
3337
|
-
var
|
|
3816
|
+
var obsSize = "";
|
|
3817
|
+
var rec = { active: false, withObs: false, counting: false, paused: false, finishing: false, t0: 0, pauseAt: 0, pausedMs: 0, events: [], outputPath: null, browser: null };
|
|
3338
3818
|
var wait = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
3339
3819
|
var nextFrame = () => Promise.race([new Promise((r) => requestAnimationFrame(() => requestAnimationFrame(r))), wait(100)]);
|
|
3340
3820
|
function recNow() {
|
|
@@ -3375,15 +3855,6 @@
|
|
|
3375
3855
|
if (e.target === m || e.target.closest("[data-close]")) m.classList.remove("open");
|
|
3376
3856
|
});
|
|
3377
3857
|
});
|
|
3378
|
-
document.querySelectorAll("[data-copy]").forEach((b) => b.addEventListener("click", () => {
|
|
3379
|
-
const ta = document.getElementById(b.dataset.copy);
|
|
3380
|
-
ta.select();
|
|
3381
|
-
(navigator.clipboard ? navigator.clipboard.writeText(ta.value) : Promise.reject()).catch(() => document.execCommand("copy"));
|
|
3382
|
-
b.textContent = "Copied";
|
|
3383
|
-
setTimeout(() => {
|
|
3384
|
-
b.textContent = "Copy";
|
|
3385
|
-
}, 1500);
|
|
3386
|
-
}));
|
|
3387
3858
|
function loadObsSettings() {
|
|
3388
3859
|
const fromUrl = new URLSearchParams(location.search).get("obs");
|
|
3389
3860
|
if (fromUrl) {
|
|
@@ -3414,9 +3885,13 @@
|
|
|
3414
3885
|
}
|
|
3415
3886
|
}
|
|
3416
3887
|
}
|
|
3417
|
-
function setObsStatus(text, kind) {
|
|
3888
|
+
function setObsStatus(text, kind, detail) {
|
|
3418
3889
|
obsStatus.textContent = text;
|
|
3419
3890
|
obsStatus.className = kind || "";
|
|
3891
|
+
obsStatus.title = detail || text;
|
|
3892
|
+
const d = document.getElementById("obs-detail");
|
|
3893
|
+
d.textContent = detail || "";
|
|
3894
|
+
d.hidden = !detail;
|
|
3420
3895
|
}
|
|
3421
3896
|
var isLoopback = (host) => /^(localhost|127(\.\d+){3}|\[?::1\]?)$/i.test(host);
|
|
3422
3897
|
function obsBlockedHere(host) {
|
|
@@ -3428,11 +3903,11 @@
|
|
|
3428
3903
|
const url = "ws://" + host + ":" + (obsPort.value.trim() || "4455");
|
|
3429
3904
|
if (obsBlockedHere(host)) {
|
|
3430
3905
|
obsConnected = false;
|
|
3431
|
-
|
|
3432
|
-
setObsStatus(OBS_HTTPS_HELP, "err");
|
|
3906
|
+
setObsStatus("Blocked here", "err", OBS_HTTPS_HELP);
|
|
3433
3907
|
return;
|
|
3434
3908
|
}
|
|
3435
|
-
setObsStatus("Connecting
|
|
3909
|
+
setObsStatus("Connecting\u2026");
|
|
3910
|
+
obsStatus.title = "Connecting to " + url;
|
|
3436
3911
|
try {
|
|
3437
3912
|
await loadScript(OBS_URL);
|
|
3438
3913
|
const Ctor = window.OBSWebSocket && (window.OBSWebSocket.default || window.OBSWebSocket);
|
|
@@ -3445,8 +3920,7 @@
|
|
|
3445
3920
|
obs = new Ctor();
|
|
3446
3921
|
obs.on("ConnectionClosed", () => {
|
|
3447
3922
|
obsConnected = false;
|
|
3448
|
-
setObsStatus("Disconnected
|
|
3449
|
-
recStartBtn.disabled = true;
|
|
3923
|
+
setObsStatus("Disconnected", "err");
|
|
3450
3924
|
});
|
|
3451
3925
|
obs.on("RecordStateChanged", (e) => {
|
|
3452
3926
|
if (e.outputState === "OBS_WEBSOCKET_OUTPUT_STARTED" && recStartResolve) {
|
|
@@ -3460,15 +3934,21 @@
|
|
|
3460
3934
|
try {
|
|
3461
3935
|
const v = await obs.call("GetVideoSettings");
|
|
3462
3936
|
if (v && v.fpsNumerator && v.fpsDenominator) obsFps = v.fpsNumerator / v.fpsDenominator;
|
|
3937
|
+
obsSize = v && v.outputWidth && v.outputHeight ? sizeName(v.outputWidth, v.outputHeight) : "";
|
|
3463
3938
|
} catch (e) {
|
|
3464
3939
|
}
|
|
3465
|
-
setObsStatus("Connected"
|
|
3940
|
+
setObsStatus("Connected", "ok", "");
|
|
3941
|
+
obsStatus.title = "Connected" + (info && info.obsWebSocketVersion ? " \xB7 OBS WebSocket " + info.obsWebSocketVersion : "");
|
|
3466
3942
|
saveObsSettings();
|
|
3943
|
+
if (reviewDialog.classList.contains("open") && obsMode()) {
|
|
3944
|
+
say("Connected to OBS. Press \u25CF Record.");
|
|
3945
|
+
setupSummary();
|
|
3946
|
+
}
|
|
3467
3947
|
} catch (e) {
|
|
3468
3948
|
obsConnected = false;
|
|
3469
|
-
|
|
3949
|
+
const why = e && e.message && e.message !== "Error" ? e.message + "." : "Nothing answered at " + url + ".";
|
|
3950
|
+
setObsStatus("Could not connect", "err", why + " Is OBS running with its WebSocket server on, and are the port and password right?");
|
|
3470
3951
|
}
|
|
3471
|
-
recStartBtn.disabled = !obsConnected;
|
|
3472
3952
|
}
|
|
3473
3953
|
document.getElementById("obs-connect").onclick = connectObs;
|
|
3474
3954
|
obsRemember.addEventListener("change", saveObsSettings);
|
|
@@ -3484,35 +3964,364 @@
|
|
|
3484
3964
|
const shape = Math.abs(r - w / h) < 5e-3 ? name : "about " + name;
|
|
3485
3965
|
el.innerHTML = '<span class="warn">This screen is ' + shape + " (" + w + "\xD7" + h + "), not 16:9, so the video will have bars or be cropped. Move this window to a 16:9 screen, physical or virtual (say 1920\xD71080), then press F there.</span>";
|
|
3486
3966
|
}
|
|
3487
|
-
|
|
3967
|
+
var MEDIABUNNY_URL = "https://cdn.jsdelivr.net/npm/mediabunny@1.64.0/+esm";
|
|
3968
|
+
var recCam = document.getElementById("rec-cam");
|
|
3969
|
+
var recMic = document.getElementById("rec-mic");
|
|
3970
|
+
var recQuality = document.getElementById("rec-quality");
|
|
3971
|
+
var recMeter = document.getElementById("rec-meter");
|
|
3972
|
+
var recCheck = document.getElementById("rec-browser-check");
|
|
3973
|
+
var recMode = load("slidetake:rec-mode") || "";
|
|
3974
|
+
var recNote = "";
|
|
3975
|
+
var meter = null;
|
|
3976
|
+
function browserRecording() {
|
|
3977
|
+
const md = navigator.mediaDevices;
|
|
3978
|
+
if (!window.isSecureContext || !md || !md.getDisplayMedia) return { why: "This page can\u2019t capture itself here. Open Slidetake in Chrome or Edge on a computer." };
|
|
3979
|
+
if (!window.RestrictionTarget && !window.CropTarget) return { why: "Recording in the browser needs Chrome or Edge (or another Chromium browser) on a computer." };
|
|
3980
|
+
const type = window.MediaRecorder ? recordingType((t) => MediaRecorder.isTypeSupported(t)) : "";
|
|
3981
|
+
if (!type || !navigator.storage || !navigator.storage.getDirectory) return { why: "This browser can\u2019t record video here. Use a recent Chrome or Edge." };
|
|
3982
|
+
const { quality, device } = bestQuality(screen.width, screen.height, devicePixelRatio || 1);
|
|
3983
|
+
if (!quality) return { why: "This screen gives a " + device[0] + "\xD7" + device[1] + " frame, less than 720p. Use pro mode (OBS), or a larger screen." };
|
|
3984
|
+
return { ok: true, type, quality };
|
|
3985
|
+
}
|
|
3986
|
+
var meterToken = 0;
|
|
3987
|
+
async function stopMeter() {
|
|
3988
|
+
meterToken++;
|
|
3989
|
+
if (!meter) return;
|
|
3990
|
+
cancelAnimationFrame(meter.raf);
|
|
3991
|
+
meter.stream.getTracks().forEach((t) => t.stop());
|
|
3992
|
+
meter.ctx.close().catch(() => {
|
|
3993
|
+
});
|
|
3994
|
+
meter = null;
|
|
3995
|
+
recMeter.value = 0;
|
|
3996
|
+
}
|
|
3997
|
+
async function startMeter() {
|
|
3998
|
+
await stopMeter();
|
|
3999
|
+
const token = meterToken;
|
|
4000
|
+
try {
|
|
4001
|
+
const id = recMic.value;
|
|
4002
|
+
const stream = await navigator.mediaDevices.getUserMedia({ audio: micConstraints(id) });
|
|
4003
|
+
if (token !== meterToken) {
|
|
4004
|
+
stream.getTracks().forEach((t) => t.stop());
|
|
4005
|
+
return;
|
|
4006
|
+
}
|
|
4007
|
+
const ctx = new AudioContext(), an = ctx.createAnalyser();
|
|
4008
|
+
an.fftSize = 512;
|
|
4009
|
+
ctx.createMediaStreamSource(stream).connect(an);
|
|
4010
|
+
const buf = new Float32Array(an.fftSize);
|
|
4011
|
+
const m = meter = { stream, ctx, raf: 0 };
|
|
4012
|
+
const loop = () => {
|
|
4013
|
+
if (meter !== m) return;
|
|
4014
|
+
an.getFloatTimeDomainData(buf);
|
|
4015
|
+
let peak = 0;
|
|
4016
|
+
for (const v of buf) peak = Math.max(peak, Math.abs(v));
|
|
4017
|
+
recMeter.value = Math.max(peak, recMeter.value * 0.85);
|
|
4018
|
+
m.raf = requestAnimationFrame(loop);
|
|
4019
|
+
};
|
|
4020
|
+
loop();
|
|
4021
|
+
} catch (e) {
|
|
4022
|
+
recCheck.innerHTML = '<span class="warn">The microphone isn\u2019t available: ' + escapeHtml(e.message || e.name) + ". Allow it in the site settings.</span>";
|
|
4023
|
+
}
|
|
4024
|
+
}
|
|
4025
|
+
async function fillDevices(withMeter = true) {
|
|
4026
|
+
try {
|
|
4027
|
+
if (withMeter && !meter) await startMeter();
|
|
4028
|
+
const devs = await navigator.mediaDevices.enumerateDevices();
|
|
4029
|
+
const opts = (kind, saved) => {
|
|
4030
|
+
const all = devs.filter((d) => d.kind === kind), def = all.find((d) => d.deviceId === "default");
|
|
4031
|
+
const defLabel = def ? def.label.replace(/^Default - /, "") : "";
|
|
4032
|
+
const list = all.filter((d) => d.deviceId !== "default" && d.deviceId !== "communications");
|
|
4033
|
+
const isDef = (d) => !!def && (d.label === defLabel || !!def.groupId && d.groupId === def.groupId && !list.some((x) => x !== d && x.label === defLabel));
|
|
4034
|
+
const names = list.map((d, i) => deviceName(d.label) || (kind === "audioinput" ? "Microphone " : "Camera ") + (i + 1));
|
|
4035
|
+
names.forEach((n, i) => {
|
|
4036
|
+
const k = names.slice(0, i).filter((m) => m === n).length;
|
|
4037
|
+
if (k) names[i] = n + " " + (k + 1);
|
|
4038
|
+
});
|
|
4039
|
+
const pick = list.some((d) => d.deviceId === saved) || saved === "none" ? saved : (list.find(isDef) || list[0] || {}).deviceId;
|
|
4040
|
+
return list.map((d, i) => '<option value="' + escapeHtml(d.deviceId) + '"' + (d.deviceId === pick ? " selected" : "") + ">" + escapeHtml(names[i] + (isDef(d) ? " (system default)" : "")) + "</option>").join("");
|
|
4041
|
+
};
|
|
4042
|
+
const cam2 = camChoice();
|
|
4043
|
+
recCam.innerHTML = '<option value="none"' + (cam2 === "none" ? " selected" : "") + ">No camera</option>" + opts("videoinput", cam2);
|
|
4044
|
+
const mic = load("slidetake:mic") || "";
|
|
4045
|
+
recMic.innerHTML = opts("audioinput", mic);
|
|
4046
|
+
if (mic && recMic.value === mic && meter && meter.stream.getAudioTracks()[0].getSettings().deviceId !== mic) startMeter();
|
|
4047
|
+
} catch (e) {
|
|
4048
|
+
}
|
|
4049
|
+
}
|
|
4050
|
+
recMic.onchange = () => {
|
|
4051
|
+
save("slidetake:mic", recMic.value);
|
|
4052
|
+
startMeter();
|
|
4053
|
+
setupSummary();
|
|
4054
|
+
};
|
|
4055
|
+
recCam.onchange = () => {
|
|
4056
|
+
setCamChoice(recCam.value);
|
|
4057
|
+
if (recCam.value !== "none" && cameraStream) {
|
|
4058
|
+
stopWebcam();
|
|
4059
|
+
startWebcam();
|
|
4060
|
+
}
|
|
4061
|
+
setupSummary();
|
|
4062
|
+
};
|
|
4063
|
+
var deckUsesCamera = () => (deck.pip || "none").toLowerCase() !== "none" || !!deck.camera || [...nodes.values()].some((n) => n.camera);
|
|
4064
|
+
var camChoiceKey = () => "slidetake:rec-cam:" + sessionKey();
|
|
4065
|
+
function camChoice() {
|
|
4066
|
+
const c = load(camChoiceKey());
|
|
4067
|
+
return c ? c : deckUsesCamera() ? load("slidetake:cam") || "default" : "none";
|
|
4068
|
+
}
|
|
4069
|
+
function setCamChoice(c) {
|
|
4070
|
+
save(camChoiceKey(), c);
|
|
4071
|
+
if (c !== "none" && c !== "default") save("slidetake:cam", c);
|
|
4072
|
+
}
|
|
4073
|
+
function cameraForRecording() {
|
|
4074
|
+
rec.camWas = !cameraOff;
|
|
4075
|
+
const want = camChoice() !== "none";
|
|
4076
|
+
if (want !== !cameraOff) setCameraEnabled(want, true);
|
|
4077
|
+
}
|
|
4078
|
+
function restoreCamera() {
|
|
4079
|
+
if (rec.camWas == null) return;
|
|
4080
|
+
if (rec.camWas !== !cameraOff) setCameraEnabled(rec.camWas, true);
|
|
4081
|
+
rec.camWas = null;
|
|
4082
|
+
}
|
|
4083
|
+
recQuality.onchange = () => {
|
|
4084
|
+
save("slidetake:quality", recQuality.value);
|
|
4085
|
+
setupSummary();
|
|
4086
|
+
};
|
|
4087
|
+
async function showBrowserCheck() {
|
|
4088
|
+
const b = browserRecording();
|
|
4089
|
+
if (!b.ok) {
|
|
4090
|
+
recCheck.innerHTML = '<span class="warn">' + escapeHtml(b.why) + "</span>";
|
|
4091
|
+
return b;
|
|
4092
|
+
}
|
|
4093
|
+
if (recNote) {
|
|
4094
|
+
recCheck.innerHTML = '<span class="warn">' + escapeHtml(recNote) + "</span>";
|
|
4095
|
+
recNote = "";
|
|
4096
|
+
}
|
|
4097
|
+
const best = QUALITIES.indexOf(b.quality), saved = load("slidetake:quality");
|
|
4098
|
+
recQuality.innerHTML = QUALITIES.slice(best).map((q) => "<option" + (q.name === saved ? " selected" : "") + ">" + q.name + "</option>").join("");
|
|
4099
|
+
let room = "";
|
|
4100
|
+
try {
|
|
4101
|
+
const { quota, usage } = await navigator.storage.estimate();
|
|
4102
|
+
const q = QUALITIES.find((x) => x.name === recQuality.value) || b.quality;
|
|
4103
|
+
room = " Room for about " + Math.floor((quota - usage) / bytesPerMinute(q)) + " minutes of takes.";
|
|
4104
|
+
} catch (e) {
|
|
4105
|
+
}
|
|
4106
|
+
if (!recCheck.querySelector(".warn")) recCheck.innerHTML = '<span class="ok">Ready: this screen records up to ' + b.quality.name + " in fullscreen." + escapeHtml(room) + "</span>";
|
|
4107
|
+
return b;
|
|
4108
|
+
}
|
|
4109
|
+
function setRecMode(mode) {
|
|
4110
|
+
recMode = mode;
|
|
4111
|
+
save("slidetake:rec-mode", mode);
|
|
4112
|
+
if (reviewDialog.classList.contains("open")) openTakes({ setup: true });
|
|
4113
|
+
}
|
|
4114
|
+
var obsMode = () => reviewDialog.classList.contains("obs");
|
|
4115
|
+
function openTakes(opts = {}) {
|
|
3488
4116
|
if (!RECORDING_UI) return;
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
4117
|
+
if (browserRecording().ok && (recMode || "browser") === "browser") openBoard(opts);
|
|
4118
|
+
else openObsTakes(opts);
|
|
4119
|
+
}
|
|
4120
|
+
function openObsTakes(opts = {}) {
|
|
4121
|
+
const last = loadSessions().find((x) => x.key === sessionKey() && x.withObs && !x.inBrowser);
|
|
4122
|
+
openReview(last || {
|
|
4123
|
+
key: sessionKey(),
|
|
4124
|
+
deckTitle: deck.title || (order[0] ? nodes.get(order[0]).title : "Deck"),
|
|
4125
|
+
date: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4126
|
+
withObs: true,
|
|
4127
|
+
outputPath: null,
|
|
4128
|
+
reason: "",
|
|
4129
|
+
total: 0,
|
|
4130
|
+
totalObs: null,
|
|
4131
|
+
fps: obsFps,
|
|
4132
|
+
events: [],
|
|
4133
|
+
picks: {},
|
|
4134
|
+
empty: true
|
|
4135
|
+
}, opts);
|
|
4136
|
+
}
|
|
4137
|
+
document.getElementById("btn-studio").onclick = () => openTakes();
|
|
4138
|
+
async function takesDir(id, create) {
|
|
4139
|
+
const root = await navigator.storage.getDirectory();
|
|
4140
|
+
const all = await root.getDirectoryHandle("slidetake-takes", { create: true });
|
|
4141
|
+
return all.getDirectoryHandle(id, { create: !!create });
|
|
4142
|
+
}
|
|
4143
|
+
async function deleteTakes(id) {
|
|
4144
|
+
try {
|
|
4145
|
+
const root = await navigator.storage.getDirectory();
|
|
4146
|
+
await (await root.getDirectoryHandle("slidetake-takes")).removeEntry(id, { recursive: true });
|
|
4147
|
+
} catch (e) {
|
|
4148
|
+
}
|
|
4149
|
+
}
|
|
4150
|
+
var outputSize = (q) => ({ width: q.w, height: q.h, aspectRatio: 16 / 9, frameRate: FPS, resizeMode: "crop-and-scale" });
|
|
4151
|
+
async function attachCapture(track) {
|
|
4152
|
+
if (window.RestrictionTarget && track.restrictTo) await track.restrictTo(await RestrictionTarget.fromElement(stageWrap));
|
|
4153
|
+
else await track.cropTo(await CropTarget.fromElement(stageWrap));
|
|
4154
|
+
}
|
|
4155
|
+
async function reattachCapture(b) {
|
|
4156
|
+
try {
|
|
4157
|
+
if (window.RestrictionTarget && b.track.restrictTo) await b.track.restrictTo(null);
|
|
4158
|
+
else await b.track.cropTo(null);
|
|
4159
|
+
await attachCapture(b.track);
|
|
4160
|
+
} catch (e) {
|
|
4161
|
+
}
|
|
4162
|
+
await b.track.applyConstraints(outputSize(b.quality)).catch(() => {
|
|
4163
|
+
});
|
|
4164
|
+
await nextFrame();
|
|
4165
|
+
}
|
|
4166
|
+
async function beginBrowserCapture() {
|
|
4167
|
+
const b = browserRecording();
|
|
4168
|
+
if (!b.ok) throw new Error(b.why);
|
|
4169
|
+
const quality = QUALITIES.find((q) => q.name === recQuality.value) || b.quality;
|
|
4170
|
+
document.body.classList.add("rec-frame");
|
|
4171
|
+
const display = await navigator.mediaDevices.getDisplayMedia({
|
|
4172
|
+
video: { frameRate: FPS },
|
|
4173
|
+
audio: false,
|
|
4174
|
+
preferCurrentTab: true,
|
|
4175
|
+
selfBrowserSurface: "include",
|
|
4176
|
+
surfaceSwitching: "exclude",
|
|
4177
|
+
monitorTypeSurfaces: "exclude"
|
|
4178
|
+
});
|
|
4179
|
+
const track = display.getVideoTracks()[0];
|
|
4180
|
+
const stopAll = () => display.getTracks().forEach((t) => t.stop());
|
|
4181
|
+
if (!track.restrictTo && !track.cropTo) {
|
|
4182
|
+
stopAll();
|
|
4183
|
+
throw new Error("Share \u201Cthis tab\u201D to record the slides.");
|
|
4184
|
+
}
|
|
4185
|
+
try {
|
|
4186
|
+
await attachCapture(track);
|
|
4187
|
+
} catch (e) {
|
|
4188
|
+
stopAll();
|
|
4189
|
+
throw new Error("Chrome could not record just the slides (" + (e.message || e.name) + ").");
|
|
4190
|
+
}
|
|
4191
|
+
await track.applyConstraints(outputSize(quality)).catch(() => {
|
|
4192
|
+
});
|
|
4193
|
+
let mic;
|
|
4194
|
+
try {
|
|
4195
|
+
const id2 = load("slidetake:mic");
|
|
4196
|
+
mic = await navigator.mediaDevices.getUserMedia({ audio: micConstraints(id2) });
|
|
4197
|
+
} catch (e) {
|
|
4198
|
+
stopAll();
|
|
4199
|
+
throw new Error("The microphone isn\u2019t available (" + (e.message || e.name) + ").");
|
|
4200
|
+
}
|
|
4201
|
+
const id = (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-");
|
|
4202
|
+
rec.browser = {
|
|
4203
|
+
id,
|
|
4204
|
+
display,
|
|
4205
|
+
mic,
|
|
4206
|
+
track,
|
|
4207
|
+
quality,
|
|
4208
|
+
type: b.type,
|
|
4209
|
+
stream: new MediaStream([track, ...mic.getAudioTracks()]),
|
|
4210
|
+
dir: await takesDir(id, true),
|
|
4211
|
+
clips: [],
|
|
4212
|
+
cur: null,
|
|
4213
|
+
chain: Promise.resolve(),
|
|
4214
|
+
error: null
|
|
4215
|
+
};
|
|
4216
|
+
track.addEventListener("ended", () => {
|
|
4217
|
+
if (rec.active && !rec.finishing) finishTake("Sharing stopped");
|
|
4218
|
+
});
|
|
4219
|
+
}
|
|
4220
|
+
function endBrowserCapture() {
|
|
4221
|
+
const b = rec.browser;
|
|
4222
|
+
if (!b) return;
|
|
4223
|
+
b.display.getTracks().forEach((t) => t.stop());
|
|
4224
|
+
b.mic.getTracks().forEach((t) => t.stop());
|
|
4225
|
+
document.body.classList.remove("rec-frame");
|
|
4226
|
+
}
|
|
4227
|
+
function startClip(ev) {
|
|
4228
|
+
const b = rec.browser;
|
|
4229
|
+
const name = "take-" + b.clips.length + "." + clipExt(b.type);
|
|
4230
|
+
const clip = { name, rec: null, done: null };
|
|
4231
|
+
b.clips.push(clip);
|
|
4232
|
+
ev.clip = b.id + "/" + name;
|
|
4233
|
+
b.chain = b.chain.then(async () => {
|
|
4234
|
+
const file = await (await b.dir.getFileHandle(name, { create: true })).createWritable();
|
|
4235
|
+
const r = new MediaRecorder(b.stream, { mimeType: b.type, videoBitsPerSecond: b.quality.bitrate, audioBitsPerSecond: AUDIO_BITRATE });
|
|
4236
|
+
let writes = Promise.resolve();
|
|
4237
|
+
r.ondataavailable = (e) => {
|
|
4238
|
+
if (e.data.size) writes = writes.then(() => file.write(e.data)).catch((err) => {
|
|
4239
|
+
b.error = err;
|
|
4240
|
+
});
|
|
4241
|
+
};
|
|
4242
|
+
clip.done = new Promise((res) => {
|
|
4243
|
+
r.onstop = async () => {
|
|
4244
|
+
await writes;
|
|
4245
|
+
await file.close().catch(() => {
|
|
4246
|
+
});
|
|
4247
|
+
res();
|
|
4248
|
+
};
|
|
4249
|
+
});
|
|
4250
|
+
await new Promise((res) => {
|
|
4251
|
+
r.onstart = res;
|
|
4252
|
+
r.start(1e3);
|
|
4253
|
+
});
|
|
4254
|
+
ev.t = Math.round(recNow());
|
|
4255
|
+
if (ev.cutAt != null) ev.lead = Math.max(0, Math.round(ev.t - ev.cutAt));
|
|
4256
|
+
const prev = b.cur;
|
|
4257
|
+
b.cur = clip;
|
|
4258
|
+
clip.rec = r;
|
|
4259
|
+
if (prev && prev.rec.state !== "inactive") prev.rec.stop();
|
|
4260
|
+
}).catch((err) => {
|
|
4261
|
+
b.error = err;
|
|
4262
|
+
});
|
|
4263
|
+
}
|
|
4264
|
+
async function startTake(kind, only) {
|
|
3501
4265
|
if (rec.active || !order.length) return;
|
|
4266
|
+
const withObs = kind === "obs";
|
|
4267
|
+
stopMeter();
|
|
4268
|
+
if (kind === "browser") {
|
|
4269
|
+
if (!presenting) setPresent(true);
|
|
4270
|
+
try {
|
|
4271
|
+
await beginBrowserCapture();
|
|
4272
|
+
} catch (e) {
|
|
4273
|
+
document.body.classList.remove("rec-frame");
|
|
4274
|
+
if (presenting) setPresent(false);
|
|
4275
|
+
recNote = e.name === "NotAllowedError" ? "Recording needs this tab shared: press \u25CF Record again and choose Share." : e.message;
|
|
4276
|
+
openBoard({ setup: true });
|
|
4277
|
+
return;
|
|
4278
|
+
}
|
|
4279
|
+
}
|
|
3502
4280
|
closeModals();
|
|
3503
|
-
|
|
4281
|
+
const pick = only && only.length ? only.filter((id) => order.includes(id)) : null;
|
|
4282
|
+
const firstId = pick ? pick[0] : order[0];
|
|
4283
|
+
const beforeId = order[order.indexOf(firstId) - 1] || null;
|
|
4284
|
+
Object.assign(rec, {
|
|
4285
|
+
active: true,
|
|
4286
|
+
withObs,
|
|
4287
|
+
counting: true,
|
|
4288
|
+
paused: false,
|
|
4289
|
+
finishing: false,
|
|
4290
|
+
t0: 0,
|
|
4291
|
+
pausedMs: 0,
|
|
4292
|
+
events: [],
|
|
4293
|
+
outputPath: null,
|
|
4294
|
+
only: pick ? new Set(pick) : null
|
|
4295
|
+
});
|
|
4296
|
+
if (kind !== "browser") rec.browser = null;
|
|
3504
4297
|
document.body.classList.add("recording");
|
|
3505
4298
|
hidePipMsg();
|
|
3506
4299
|
const lay = document.getElementById("rec-layout").value;
|
|
3507
4300
|
if (lay !== "current" && lay !== layoutMode) setMode(lay, true);
|
|
3508
4301
|
if (!presenting) setPresent(true);
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
4302
|
+
cameraForRecording();
|
|
4303
|
+
if (beforeId) {
|
|
4304
|
+
document.body.classList.add("no-anim");
|
|
4305
|
+
nodes.get(beforeId)._played = true;
|
|
4306
|
+
quietArrival = true;
|
|
4307
|
+
navigate(beforeId, true, true);
|
|
4308
|
+
quietArrival = false;
|
|
4309
|
+
pipEl.getAnimations().forEach((a) => a.finish());
|
|
4310
|
+
await nextFrame();
|
|
4311
|
+
document.body.classList.remove("no-anim");
|
|
4312
|
+
} else {
|
|
4313
|
+
if (currentId === firstId) {
|
|
4314
|
+
stepPos = 0;
|
|
4315
|
+
camManual = null;
|
|
4316
|
+
camCycle = -1;
|
|
4317
|
+
}
|
|
4318
|
+
navigate(firstId, true);
|
|
3513
4319
|
}
|
|
3514
|
-
|
|
4320
|
+
if (!document.fullscreenElement && document.documentElement.requestFullscreen) await document.documentElement.requestFullscreen().catch(() => {
|
|
4321
|
+
});
|
|
4322
|
+
const hint = countdownEl.querySelector(".hint");
|
|
3515
4323
|
for (let i = 3; i > 0; i--) {
|
|
4324
|
+
hint.textContent = (document.fullscreenElement ? "" : "Press F for fullscreen \xB7 ") + "recording starts after the countdown \xB7 Esc to cancel";
|
|
3516
4325
|
countdownEl.querySelector(".num").textContent = i;
|
|
3517
4326
|
countdownEl.classList.add("show");
|
|
3518
4327
|
await wait(1e3);
|
|
@@ -3539,9 +4348,19 @@
|
|
|
3539
4348
|
await started;
|
|
3540
4349
|
if (!rec.active) return;
|
|
3541
4350
|
}
|
|
4351
|
+
if (rec.browser) await reattachCapture(rec.browser);
|
|
3542
4352
|
rec.counting = false;
|
|
3543
4353
|
rec.t0 = performance.now();
|
|
3544
|
-
const first = nodes.get(
|
|
4354
|
+
const first = nodes.get(firstId);
|
|
4355
|
+
if (beforeId) {
|
|
4356
|
+
logTake("slide", firstId);
|
|
4357
|
+
if (rec.browser) await rec.browser.chain;
|
|
4358
|
+
resetEntrances(first);
|
|
4359
|
+
quietArrival = true;
|
|
4360
|
+
navigate(firstId);
|
|
4361
|
+
quietArrival = false;
|
|
4362
|
+
return;
|
|
4363
|
+
}
|
|
3545
4364
|
resetEntrances(first);
|
|
3546
4365
|
applyStepState(true);
|
|
3547
4366
|
logTake("slide", currentId);
|
|
@@ -3549,16 +4368,31 @@
|
|
|
3549
4368
|
function abortTake(message) {
|
|
3550
4369
|
rec.active = false;
|
|
3551
4370
|
rec.counting = false;
|
|
4371
|
+
if (rec.browser) {
|
|
4372
|
+
const b = rec.browser;
|
|
4373
|
+
b.chain.then(() => {
|
|
4374
|
+
if (b.cur && b.cur.rec.state !== "inactive") b.cur.rec.stop();
|
|
4375
|
+
}).then(() => deleteTakes(b.id));
|
|
4376
|
+
endBrowserCapture();
|
|
4377
|
+
rec.browser = null;
|
|
4378
|
+
}
|
|
3552
4379
|
countdownEl.classList.remove("show");
|
|
3553
4380
|
document.body.classList.remove("recording");
|
|
3554
4381
|
if (presenting) setPresent(false);
|
|
4382
|
+
restoreCamera();
|
|
3555
4383
|
showPipMsg(message);
|
|
3556
4384
|
}
|
|
3557
|
-
function logTake(kind, id) {
|
|
4385
|
+
function logTake(kind, id, cutAt) {
|
|
3558
4386
|
if (!rec.active || !rec.t0 || rec.finishing) return;
|
|
3559
4387
|
const n = nodes.get(id);
|
|
3560
4388
|
const ev = { id, title: n ? n.title : id, retake: kind === "retake", t: Math.round(recNow()), obsT: null };
|
|
4389
|
+
if (cutAt == null && rec.browser) cutAt = ev.t;
|
|
4390
|
+
if (cutAt != null) {
|
|
4391
|
+
ev.cutAt = cutAt;
|
|
4392
|
+
ev.lead = Math.max(0, Math.round(ev.t - cutAt));
|
|
4393
|
+
}
|
|
3561
4394
|
rec.events.push(ev);
|
|
4395
|
+
if (rec.browser) startClip(ev);
|
|
3562
4396
|
if (rec.withObs && obsConnected) {
|
|
3563
4397
|
obs.call("GetRecordStatus").then((r) => {
|
|
3564
4398
|
if (r && typeof r.outputDuration === "number") ev.obsT = r.outputDuration;
|
|
@@ -3577,7 +4411,13 @@
|
|
|
3577
4411
|
else finishTake("Stopped early");
|
|
3578
4412
|
return;
|
|
3579
4413
|
}
|
|
3580
|
-
if (
|
|
4414
|
+
if ((k === "f" || k === "F") && !document.fullscreenElement && document.documentElement.requestFullscreen) {
|
|
4415
|
+
e.preventDefault();
|
|
4416
|
+
document.documentElement.requestFullscreen().catch(() => {
|
|
4417
|
+
});
|
|
4418
|
+
return;
|
|
4419
|
+
}
|
|
4420
|
+
if (rec.counting || rec.finishing || retaking) return;
|
|
3581
4421
|
if (PAUSE_KEYS.includes(k)) {
|
|
3582
4422
|
togglePause();
|
|
3583
4423
|
return;
|
|
@@ -3589,13 +4429,64 @@
|
|
|
3589
4429
|
function takeForward() {
|
|
3590
4430
|
const steps = slideSteps(nodes.get(currentId));
|
|
3591
4431
|
const lastStep = Math.min(stepPos, steps.length - 1) >= steps.length - 1;
|
|
3592
|
-
|
|
3593
|
-
|
|
4432
|
+
const i = order.indexOf(currentId);
|
|
4433
|
+
if (!lastStep) {
|
|
4434
|
+
step(1);
|
|
4435
|
+
return;
|
|
4436
|
+
}
|
|
4437
|
+
if (!rec.only) {
|
|
4438
|
+
if (i === order.length - 1) finishTake();
|
|
4439
|
+
else step(1);
|
|
4440
|
+
return;
|
|
4441
|
+
}
|
|
4442
|
+
const next = order.slice(i + 1).find((id) => rec.only.has(id));
|
|
4443
|
+
if (!next) finishTake();
|
|
4444
|
+
else if (order[i + 1] === next) step(1);
|
|
4445
|
+
else enterFresh(order[order.indexOf(next) - 1], next, "slide");
|
|
3594
4446
|
}
|
|
3595
|
-
|
|
4447
|
+
var retaking = false;
|
|
4448
|
+
async function retake() {
|
|
3596
4449
|
const n = nodes.get(currentId);
|
|
3597
|
-
if (!n) return;
|
|
3598
|
-
|
|
4450
|
+
if (!n || retaking) return;
|
|
4451
|
+
const target = currentId, from = arrivedFrom;
|
|
4452
|
+
if (!from || from === target || !nodes.has(from)) {
|
|
4453
|
+
restartSlide(n);
|
|
4454
|
+
return;
|
|
4455
|
+
}
|
|
4456
|
+
enterFresh(from, target, "retake");
|
|
4457
|
+
}
|
|
4458
|
+
async function enterFresh(from, target, kind) {
|
|
4459
|
+
const n = nodes.get(target);
|
|
4460
|
+
if (!n || retaking) return;
|
|
4461
|
+
retaking = true;
|
|
4462
|
+
const cutAt = recNow();
|
|
4463
|
+
document.body.classList.add("no-anim");
|
|
4464
|
+
const prev = nodes.get(from);
|
|
4465
|
+
quietArrival = true;
|
|
4466
|
+
prev._played = true;
|
|
4467
|
+
navigate(from, true, true);
|
|
4468
|
+
pipEl.getAnimations().forEach((a) => a.finish());
|
|
4469
|
+
quietArrival = false;
|
|
4470
|
+
await nextFrame();
|
|
4471
|
+
document.body.classList.remove("no-anim");
|
|
4472
|
+
logTake(kind, target, cutAt);
|
|
4473
|
+
if (rec.browser) await rec.browser.chain;
|
|
4474
|
+
if (rec.withObs) await obsHold();
|
|
4475
|
+
resetEntrances(n);
|
|
4476
|
+
quietArrival = true;
|
|
4477
|
+
navigate(target);
|
|
4478
|
+
quietArrival = false;
|
|
4479
|
+
if (!cameraStream && !pipEl.hidden && pipState.used) startWebcam();
|
|
4480
|
+
retaking = false;
|
|
4481
|
+
}
|
|
4482
|
+
var OBS_HOLD = 600;
|
|
4483
|
+
async function obsHold() {
|
|
4484
|
+
const ev = rec.events[rec.events.length - 1];
|
|
4485
|
+
if (ev) ev.skip = OBS_HOLD / 2;
|
|
4486
|
+
await wait(OBS_HOLD);
|
|
4487
|
+
}
|
|
4488
|
+
async function restartSlide(n) {
|
|
4489
|
+
retaking = true;
|
|
3599
4490
|
stepPos = 0;
|
|
3600
4491
|
camManual = null;
|
|
3601
4492
|
camCycle = -1;
|
|
@@ -3604,6 +4495,9 @@
|
|
|
3604
4495
|
if (!cameraStream && !pipEl.hidden && pipState.used) startWebcam();
|
|
3605
4496
|
else refocus();
|
|
3606
4497
|
updateActivePath();
|
|
4498
|
+
logTake("retake", currentId);
|
|
4499
|
+
if (rec.withObs) await obsHold();
|
|
4500
|
+
retaking = false;
|
|
3607
4501
|
}
|
|
3608
4502
|
async function togglePause() {
|
|
3609
4503
|
if (!rec.t0) return;
|
|
@@ -3613,12 +4507,24 @@
|
|
|
3613
4507
|
clearTimeout(autoTimer);
|
|
3614
4508
|
if (rec.withObs) await obs.call("PauseRecord").catch(() => {
|
|
3615
4509
|
});
|
|
4510
|
+
if (rec.browser) {
|
|
4511
|
+
const b = rec.browser;
|
|
4512
|
+
b.chain = b.chain.then(() => {
|
|
4513
|
+
if (b.cur && b.cur.rec.state === "recording") b.cur.rec.pause();
|
|
4514
|
+
});
|
|
4515
|
+
}
|
|
3616
4516
|
pausedEl.classList.add("show");
|
|
3617
4517
|
} else {
|
|
3618
4518
|
pausedEl.classList.remove("show");
|
|
3619
4519
|
await nextFrame();
|
|
3620
4520
|
if (rec.withObs) await obs.call("ResumeRecord").catch(() => {
|
|
3621
4521
|
});
|
|
4522
|
+
if (rec.browser) {
|
|
4523
|
+
const b = rec.browser;
|
|
4524
|
+
b.chain = b.chain.then(() => {
|
|
4525
|
+
if (b.cur && b.cur.rec.state === "paused") b.cur.rec.resume();
|
|
4526
|
+
});
|
|
4527
|
+
}
|
|
3622
4528
|
rec.pausedMs += performance.now() - rec.pauseAt;
|
|
3623
4529
|
rec.paused = false;
|
|
3624
4530
|
scheduleAutoslide(nodes.get(currentId));
|
|
@@ -3639,13 +4545,12 @@
|
|
|
3639
4545
|
}
|
|
3640
4546
|
let total = Math.round(recNow()), totalObs = null;
|
|
3641
4547
|
if (rec.withObs) {
|
|
3642
|
-
await wait(1200);
|
|
3643
|
-
total = Math.round(recNow());
|
|
3644
4548
|
try {
|
|
3645
4549
|
const st = await obs.call("GetRecordStatus");
|
|
3646
4550
|
if (st && typeof st.outputDuration === "number") totalObs = st.outputDuration;
|
|
3647
4551
|
} catch (e) {
|
|
3648
4552
|
}
|
|
4553
|
+
await wait(1200);
|
|
3649
4554
|
try {
|
|
3650
4555
|
const r = await obs.call("StopRecord");
|
|
3651
4556
|
rec.outputPath = r && r.outputPath;
|
|
@@ -3653,10 +4558,22 @@
|
|
|
3653
4558
|
reason = (reason ? reason + ". " : "") + "OBS did not confirm the stop (" + (e && e.message || e) + ")";
|
|
3654
4559
|
}
|
|
3655
4560
|
}
|
|
4561
|
+
const b = rec.browser;
|
|
4562
|
+
if (b) {
|
|
4563
|
+
await wait(600);
|
|
4564
|
+
await b.chain;
|
|
4565
|
+
total = Math.round(recNow());
|
|
4566
|
+
if (b.cur && b.cur.rec && b.cur.rec.state !== "inactive") b.cur.rec.stop();
|
|
4567
|
+
await Promise.all(b.clips.map((c) => c.done));
|
|
4568
|
+
endBrowserCapture();
|
|
4569
|
+
rec.browser = null;
|
|
4570
|
+
if (b.error) reason = (reason ? reason + ". " : "") + "Some of the take could not be saved (" + (b.error.message || b.error.name) + ")";
|
|
4571
|
+
}
|
|
3656
4572
|
rec.active = false;
|
|
3657
4573
|
rec.finishing = false;
|
|
3658
4574
|
document.body.classList.remove("recording");
|
|
3659
4575
|
if (presenting) setPresent(false);
|
|
4576
|
+
restoreCamera();
|
|
3660
4577
|
const session = {
|
|
3661
4578
|
key: sessionKey(),
|
|
3662
4579
|
deckTitle: deck.title || nodes.get(order[0]).title,
|
|
@@ -3666,12 +4583,17 @@
|
|
|
3666
4583
|
reason: reason || "",
|
|
3667
4584
|
total,
|
|
3668
4585
|
totalObs,
|
|
3669
|
-
fps: obsFps,
|
|
3670
|
-
|
|
4586
|
+
fps: b ? FPS : obsFps,
|
|
4587
|
+
...b ? { inBrowser: true, takesId: b.id, quality: b.quality.name, type: b.type } : {},
|
|
4588
|
+
events: rec.events.map((e) => ({ id: e.id, title: e.title, retake: e.retake, t: e.t, obsT: e.obsT, ...e.lead ? { lead: e.lead } : {}, ...e.skip ? { skip: e.skip } : {}, ...e.clip ? { clip: e.clip } : {} })),
|
|
3671
4589
|
picks: {}
|
|
3672
4590
|
};
|
|
4591
|
+
if (session.inBrowser) {
|
|
4592
|
+
addToBoard(session);
|
|
4593
|
+
return;
|
|
4594
|
+
}
|
|
3673
4595
|
saveSession(session);
|
|
3674
|
-
openReview(session);
|
|
4596
|
+
openReview(session, { note: (reason ? reason + ". " : "") + takesOf(session).size + " slides recorded with OBS." });
|
|
3675
4597
|
}
|
|
3676
4598
|
function sessionKey() {
|
|
3677
4599
|
return slugify(deck.title || (order[0] ? nodes.get(order[0]).title : "deck"));
|
|
@@ -3686,16 +4608,10 @@
|
|
|
3686
4608
|
function saveSession(sess) {
|
|
3687
4609
|
const all = loadSessions().filter((x) => x.date !== sess.date);
|
|
3688
4610
|
all.unshift(sess);
|
|
3689
|
-
|
|
3690
|
-
|
|
3691
|
-
function renderSessionList() {
|
|
3692
|
-
const box = document.getElementById("rec-sessions");
|
|
3693
|
-
const mine = loadSessions().filter((x) => x.key === sessionKey());
|
|
3694
|
-
box.innerHTML = mine.length ? "<h3>Earlier takes of this deck</h3>" + mine.map((x, i) => '<div class="row"><button class="btn small" data-session="' + i + '">Review</button><span>' + escapeHtml(new Date(x.date).toLocaleString()) + " \xB7 " + fmtTime(x.totalObs ?? x.total) + (x.withObs ? "" : " \xB7 rehearsal") + (x.outputPath ? " \xB7 " + escapeHtml(baseName(x.outputPath)) : "") + "</span></div>").join("") : "";
|
|
3695
|
-
box.querySelectorAll("[data-session]").forEach((b) => b.onclick = () => {
|
|
3696
|
-
closeModals();
|
|
3697
|
-
openReview(mine[+b.dataset.session]);
|
|
4611
|
+
all.slice(12).forEach((x) => {
|
|
4612
|
+
if (x.takesId) deleteTakes(x.takesId);
|
|
3698
4613
|
});
|
|
4614
|
+
save("slidetake:sessions", JSON.stringify(all.slice(0, 12)));
|
|
3699
4615
|
}
|
|
3700
4616
|
function sectionOf(id) {
|
|
3701
4617
|
const path = nodes.has(id) ? breadcrumbPath(id) : [id];
|
|
@@ -3710,83 +4626,108 @@
|
|
|
3710
4626
|
var ffmpegScript2 = (sess, mode) => ffmpegScript(sess, mode, {
|
|
3711
4627
|
input: sess.outputPath || reviewFileName || "recording.mov",
|
|
3712
4628
|
outputName: sessionKey() + "-final.mp4",
|
|
3713
|
-
sectionOf: sectionInfo
|
|
4629
|
+
sectionOf: sectionInfo,
|
|
4630
|
+
loudness: loudOn()
|
|
4631
|
+
});
|
|
4632
|
+
var loudBtns = document.querySelectorAll(".rv-loud");
|
|
4633
|
+
var loudOn = () => load("slidetake:loudness") !== "off";
|
|
4634
|
+
var showLoud = () => loudBtns.forEach((b) => {
|
|
4635
|
+
b.setAttribute("aria-pressed", String(loudOn()));
|
|
4636
|
+
b.classList.toggle("on", loudOn());
|
|
4637
|
+
});
|
|
4638
|
+
var limiterBtn = document.getElementById("rv-limiter");
|
|
4639
|
+
var limiterOn = () => load("slidetake:limiter") === "on";
|
|
4640
|
+
var showLimiter = () => {
|
|
4641
|
+
limiterBtn.setAttribute("aria-pressed", String(limiterOn()));
|
|
4642
|
+
limiterBtn.classList.toggle("on", limiterOn());
|
|
4643
|
+
};
|
|
4644
|
+
showLimiter();
|
|
4645
|
+
limiterBtn.onclick = () => {
|
|
4646
|
+
save("slidetake:limiter", limiterOn() ? "off" : "on");
|
|
4647
|
+
showLimiter();
|
|
4648
|
+
};
|
|
4649
|
+
var micSound = () => load("slidetake:mic-sound") === "voice" ? "voice" : "raw";
|
|
4650
|
+
var micConstraints = (id) => ({ ...id ? { deviceId: { ideal: id } } : {}, echoCancellation: false, autoGainControl: false, noiseSuppression: micSound() === "voice" });
|
|
4651
|
+
var soundBtns = document.querySelectorAll("[data-sound]");
|
|
4652
|
+
var showSound = () => soundBtns.forEach((b) => {
|
|
4653
|
+
const on = b.dataset.sound === micSound();
|
|
4654
|
+
b.classList.toggle("active", on);
|
|
4655
|
+
b.setAttribute("aria-checked", String(on));
|
|
4656
|
+
});
|
|
4657
|
+
showSound();
|
|
4658
|
+
soundBtns.forEach((b) => b.onclick = () => {
|
|
4659
|
+
save("slidetake:mic-sound", b.dataset.sound);
|
|
4660
|
+
showSound();
|
|
4661
|
+
if (meter) startMeter();
|
|
4662
|
+
});
|
|
4663
|
+
showLoud();
|
|
4664
|
+
loudBtns.forEach((b) => b.onclick = () => {
|
|
4665
|
+
save("slidetake:loudness", loudOn() ? "off" : "on");
|
|
4666
|
+
showLoud();
|
|
4667
|
+
if (reviewing) renderReview();
|
|
3714
4668
|
});
|
|
3715
|
-
function deckTags() {
|
|
3716
|
-
const all = Object.keys(deck).filter((k) => k === "tags" || /_tags$/.test(k)).flatMap((k) => [].concat(deck[k])).filter((t) => typeof t === "string");
|
|
3717
|
-
return [...new Set(all.map((t) => t.trim()).filter(Boolean))];
|
|
3718
|
-
}
|
|
3719
|
-
function relatedLinks() {
|
|
3720
|
-
return [].concat(deck.related || []).map((x) => {
|
|
3721
|
-
const md = String(x).match(/^\[([^\]]+)\]\(([^)]+)\)$/), pipe2 = String(x).split("|");
|
|
3722
|
-
if (md) return md[1] + ": " + md[2];
|
|
3723
|
-
if (pipe2.length === 2) return pipe2[0].trim() + ": " + pipe2[1].trim();
|
|
3724
|
-
return String(x);
|
|
3725
|
-
});
|
|
3726
|
-
}
|
|
3727
|
-
function deckLink() {
|
|
3728
|
-
if (deck.permalink || deck.url) return deck.permalink || deck.url;
|
|
3729
|
-
const site = deck.site || load("slidetake:site");
|
|
3730
|
-
if (!site || !deckBase) return "";
|
|
3731
|
-
try {
|
|
3732
|
-
const path = new URL(deckBase).pathname.replace(/\/index\.md$/i, "/").replace(/\.md$/i, "/");
|
|
3733
|
-
return new URL(path, site).href;
|
|
3734
|
-
} catch (e) {
|
|
3735
|
-
return "";
|
|
3736
|
-
}
|
|
3737
|
-
}
|
|
3738
|
-
function describe(sess) {
|
|
3739
|
-
const ch = finalChapters2(sess), link = document.getElementById("rv-link").value.trim(), related = relatedLinks(), tags = deckTags();
|
|
3740
|
-
const parts = [];
|
|
3741
|
-
if (deck.summary) parts.push(deck.summary);
|
|
3742
|
-
if (link) parts.push("\u{1F4D1} Slides: " + link);
|
|
3743
|
-
if (ch.lines.length >= 3) parts.push("Chapters\n" + ch.lines.join("\n"));
|
|
3744
|
-
if (related.length) parts.push("Related\n" + related.map((r) => "\u2022 " + r).join("\n"));
|
|
3745
|
-
if (tags.length) parts.push(tags.slice(0, 3).map((t) => "#" + t.replace(/[^\p{L}\p{N}]+/gu, "")).join(" "));
|
|
3746
|
-
document.getElementById("rv-yt-desc").value = parts.join("\n\n");
|
|
3747
|
-
document.getElementById("rv-chapters-note").textContent = (ch.dropped ? ch.dropped + " section" + (ch.dropped > 1 ? "s were" : " was") + " under 10 seconds and folded into the chapter before, as YouTube requires. " : "") + (ch.lines.length < 3 ? "YouTube needs at least three chapters, so none are listed. " : "") + "Final length " + fmtTime(ch.length) + ".";
|
|
3748
|
-
}
|
|
3749
4669
|
var reviewing = null;
|
|
3750
4670
|
var playlist = null;
|
|
3751
4671
|
var rvVideo = document.getElementById("rv-video");
|
|
3752
4672
|
var rvNow = document.getElementById("rv-now");
|
|
3753
|
-
function
|
|
4673
|
+
function say(text, { warn = false, html = "", title = "" } = {}) {
|
|
4674
|
+
rvNow.classList.toggle("warn", warn);
|
|
4675
|
+
if (html) rvNow.innerHTML = html;
|
|
4676
|
+
else rvNow.textContent = text;
|
|
4677
|
+
rvNow.title = title || rvNow.textContent;
|
|
4678
|
+
const again = document.getElementById("rv-save-again");
|
|
4679
|
+
if (again) again.onclick = () => downloadVideo(true);
|
|
4680
|
+
}
|
|
4681
|
+
var lastTicked = -1;
|
|
4682
|
+
var selNote = () => {
|
|
4683
|
+
const n = selectedInOrder(order, selected).length;
|
|
4684
|
+
return n ? n + "/" + order.length + " slide" + (n === 1 ? "" : "s") + " up for a take" : "";
|
|
4685
|
+
};
|
|
4686
|
+
function openReview(sess, opts = {}) {
|
|
4687
|
+
closeModals();
|
|
3754
4688
|
reviewing = sess;
|
|
3755
4689
|
playlist = null;
|
|
3756
|
-
const
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
].filter(Boolean).join(" \xB7 ");
|
|
4690
|
+
const retakes = sess.events.filter((e) => e.retake).length;
|
|
4691
|
+
const about = sess.empty ? "" : takesOf(sess).size + " slides, " + (retakes ? retakes + " retake" + (retakes > 1 ? "s" : "") : "no retakes") + ", recorded " + fmtLength(sess.totalObs ?? sess.total) + ". ";
|
|
4692
|
+
reviewDialog.classList.remove("in-browser", "board");
|
|
4693
|
+
reviewDialog.classList.add("obs");
|
|
4694
|
+
const recBtn = document.getElementById("rv-rec");
|
|
4695
|
+
recBtn.title = "Records the deck with OBS: a new video in place of this one";
|
|
4696
|
+
recBtn.disabled = false;
|
|
4697
|
+
document.getElementById("rv-use-browser").style.display = browserRecording().ok ? "" : "none";
|
|
4698
|
+
document.getElementById("rv-render-btn").disabled = document.getElementById("rv-clean").disabled = !!sess.cleaned;
|
|
3766
4699
|
document.getElementById("rv-file").textContent = sess.outputPath ? " (" + baseName(sess.outputPath) + ")" : "";
|
|
3767
|
-
document.getElementById("rv-yt-title").value = sess.deckTitle;
|
|
3768
4700
|
const fps = sessionFps(sess);
|
|
3769
4701
|
fpsSel.value = [...fpsSel.options].reduce((a, o) => Math.abs(o.value - fps) < Math.abs(a.value - fps) ? o : a).value;
|
|
3770
|
-
|
|
3771
|
-
document.getElementById("rv-link").value = deckLink();
|
|
3772
|
-
if (rvVideo.src && reviewFileName !== baseName(sess.outputPath) && sess.outputPath) {
|
|
4702
|
+
if (rvVideo.src && (sess.inBrowser || reviewFileName !== baseName(sess.outputPath) && sess.outputPath)) {
|
|
3773
4703
|
rvVideo.removeAttribute("src");
|
|
3774
4704
|
rvVideo.load();
|
|
3775
4705
|
reviewFileName = "";
|
|
3776
4706
|
}
|
|
3777
|
-
document.getElementById("rv-novideo").hidden = !!rvVideo.src;
|
|
4707
|
+
document.getElementById("rv-novideo").hidden = !!rvVideo.src || !!sess.empty;
|
|
4708
|
+
playlist = null;
|
|
4709
|
+
clipList = null;
|
|
4710
|
+
resetPreview();
|
|
3778
4711
|
renderReview();
|
|
3779
4712
|
openModal(reviewDialog);
|
|
3780
|
-
|
|
4713
|
+
setupEl.open = !!opts.setup || !obsConnected || !!sess.empty;
|
|
4714
|
+
if (setupEl.open) refreshSetup();
|
|
4715
|
+
else fillDevices(false).then(setupSummary);
|
|
4716
|
+
say(opts.note || (sess.empty ? obsConnected ? "Press \u25CF Record: OBS records the deck." : "Connect to OBS in Setup, then press \u25CF Record." : about + (rvVideo.src ? "Click a take to preview it." : "Open the recording to preview it.")));
|
|
4717
|
+
if (!sess.empty) autoLoadRecording(sess);
|
|
3781
4718
|
}
|
|
3782
4719
|
function renderReview() {
|
|
4720
|
+
if (reviewing && reviewing.board) {
|
|
4721
|
+
renderBoard();
|
|
4722
|
+
return;
|
|
4723
|
+
}
|
|
3783
4724
|
const sess = reviewing, list = document.getElementById("rv-list");
|
|
3784
4725
|
let lastSec = null;
|
|
3785
4726
|
list.innerHTML = [...takesOf(sess).values()].map((slide) => {
|
|
3786
4727
|
const pick = sess.picks[slide.id] ?? slide.takes.length, sec = sectionOf(slide.id);
|
|
3787
4728
|
const isSec = sec !== lastSec;
|
|
3788
4729
|
lastSec = sec;
|
|
3789
|
-
const chips = slide.takes.map((t) => '<button class="rv-chip' + (pick === t.no ? " on" : "") + '" data-id="' + escapeHtml(slide.id) + '" data-take="' + t.no + '">
|
|
4730
|
+
const chips = slide.takes.map((t) => '<button class="rv-chip' + (pick === t.no ? " on" : "") + '" data-id="' + escapeHtml(slide.id) + '" data-take="' + t.no + '">Take ' + t.no + " \xB7 " + fmtLength(t.end - t.start) + "</button>").join("");
|
|
3790
4731
|
return '<div class="rv-row' + (isSec ? " sec" : "") + '"><div class="t">' + escapeHtml(slide.title) + "<small>" + fmtTime(slide.takes[0].start) + '</small></div><div class="rv-chips">' + chips + "</div></div>";
|
|
3791
4732
|
}).join("");
|
|
3792
4733
|
list.querySelectorAll(".rv-chip").forEach((b) => b.onclick = () => {
|
|
@@ -3794,12 +4735,61 @@
|
|
|
3794
4735
|
saveSession(sess);
|
|
3795
4736
|
renderReview();
|
|
3796
4737
|
const slide = takesOf(sess).get(b.dataset.id), t = slide && slide.takes[+b.dataset.take - 1];
|
|
3797
|
-
if (t)
|
|
4738
|
+
if (!t) return;
|
|
4739
|
+
const title = slide.title + (slide.takes.length > 1 ? " \xB7 take " + t.no : "");
|
|
4740
|
+
if (sess.inBrowser) {
|
|
4741
|
+
const ev = sess.events.filter((e) => e.id === b.dataset.id)[t.no - 1];
|
|
4742
|
+
if (ev && ev.clip) playClips([{ clip: ev.clip, keep: (t.end - t.start) / 1e3, title }]);
|
|
4743
|
+
} else playRange([{ start: t.start, end: t.end, title }]);
|
|
4744
|
+
});
|
|
4745
|
+
document.getElementById("rv-ffmpeg-copy").disabled = document.getElementById("rv-play-final").disabled = !sess.events.length;
|
|
4746
|
+
showChapters(sess);
|
|
4747
|
+
showFinalSize(sess);
|
|
4748
|
+
}
|
|
4749
|
+
var cutChapters = "";
|
|
4750
|
+
function showChapters(sess) {
|
|
4751
|
+
const ch = finalChapters2(sess), btn = document.getElementById("rv-chapters");
|
|
4752
|
+
cutChapters = ch.lines.join("\n");
|
|
4753
|
+
btn.disabled = ch.lines.length < 3;
|
|
4754
|
+
btn.title = ch.lines.length < 3 ? "YouTube needs at least three chapters of 10 seconds or more" : "Copies the " + ch.lines.length + " chapters, to paste into the YouTube description";
|
|
4755
|
+
}
|
|
4756
|
+
function copyWith(btn, text) {
|
|
4757
|
+
const label = btn.dataset.label || (btn.dataset.label = btn.textContent);
|
|
4758
|
+
(navigator.clipboard ? navigator.clipboard.writeText(text) : Promise.reject()).catch(() => {
|
|
3798
4759
|
});
|
|
3799
|
-
|
|
3800
|
-
|
|
4760
|
+
btn.textContent = "\u2713 Copied";
|
|
4761
|
+
clearTimeout(+btn.dataset.timer);
|
|
4762
|
+
btn.dataset.timer = String(setTimeout(() => {
|
|
4763
|
+
btn.textContent = label;
|
|
4764
|
+
}, 1500));
|
|
4765
|
+
}
|
|
4766
|
+
document.getElementById("rv-chapters").onclick = (e) => copyWith(e.currentTarget, cutChapters);
|
|
4767
|
+
document.getElementById("rv-ffmpeg-copy").onclick = (e) => {
|
|
4768
|
+
if (!reviewing || !reviewing.events.length) return;
|
|
4769
|
+
copyWith(e.currentTarget, ffmpegScript2(reviewing, document.getElementById("rv-mode").value));
|
|
4770
|
+
say("Copied the ffmpeg command: run it in a terminal, in the folder with " + (baseName(reviewing.outputPath) || "the recording") + ".");
|
|
4771
|
+
};
|
|
4772
|
+
var clipSizes = /* @__PURE__ */ new Map();
|
|
4773
|
+
var finalSizeToken = 0;
|
|
4774
|
+
async function showFinalSize(sess) {
|
|
4775
|
+
const el = document.getElementById("rv-final"), token = ++finalSizeToken;
|
|
4776
|
+
const ms = pickedRanges(sess).reduce((a, r) => a + r.end - r.start, 0);
|
|
4777
|
+
const line = (bytes) => (!bytes ? "Final cut " : "about " + (bytes > 1e9 ? (bytes / 1e9).toFixed(1) + " GB" : Math.max(1, Math.round(bytes / 1e6)) + " MB") + " \xB7 ") + fmtLength(ms);
|
|
4778
|
+
if (!sess.inBrowser || sess.cleaned) {
|
|
4779
|
+
el.textContent = line(null);
|
|
4780
|
+
return;
|
|
4781
|
+
}
|
|
4782
|
+
try {
|
|
4783
|
+
let bytes = 0;
|
|
4784
|
+
for (const part of clipPlan(sess)) {
|
|
4785
|
+
if (!clipSizes.has(part.clip)) clipSizes.set(part.clip, (await clipFile(part.clip)).size);
|
|
4786
|
+
bytes += clipSizes.get(part.clip);
|
|
4787
|
+
}
|
|
4788
|
+
if (token === finalSizeToken) el.textContent = line(bytes);
|
|
4789
|
+
} catch (e) {
|
|
4790
|
+
if (token === finalSizeToken) el.textContent = line(null);
|
|
4791
|
+
}
|
|
3801
4792
|
}
|
|
3802
|
-
document.getElementById("rv-mode").onchange = () => renderReview();
|
|
3803
4793
|
var fpsSel = document.getElementById("rv-fps");
|
|
3804
4794
|
fpsSel.onchange = () => {
|
|
3805
4795
|
if (!reviewing) return;
|
|
@@ -3807,27 +4797,20 @@
|
|
|
3807
4797
|
saveSession(reviewing);
|
|
3808
4798
|
renderReview();
|
|
3809
4799
|
};
|
|
3810
|
-
document.getElementById("rv-link").addEventListener("input", (e) => {
|
|
3811
|
-
try {
|
|
3812
|
-
save("slidetake:site", new URL(e.target.value.trim()).origin);
|
|
3813
|
-
} catch (err) {
|
|
3814
|
-
}
|
|
3815
|
-
if (reviewing) describe(reviewing);
|
|
3816
|
-
});
|
|
3817
4800
|
var pendingPlay = null;
|
|
3818
4801
|
function playRange(ranges) {
|
|
3819
4802
|
if (!rvVideo.src) {
|
|
3820
4803
|
pendingPlay = ranges;
|
|
3821
|
-
|
|
4804
|
+
say(rvOpening ? "Opening the recording\u2026 it plays when ready." : "Open the recording to preview.");
|
|
3822
4805
|
return;
|
|
3823
4806
|
}
|
|
3824
4807
|
pendingPlay = null;
|
|
3825
4808
|
playlist = { ranges, i: 0 };
|
|
3826
|
-
|
|
4809
|
+
say("\u25B6 " + ranges[0].title);
|
|
3827
4810
|
const go = () => {
|
|
3828
4811
|
rvVideo.currentTime = ranges[0].start / 1e3;
|
|
3829
4812
|
rvVideo.play().catch((e) => {
|
|
3830
|
-
if (e && e.name !== "AbortError")
|
|
4813
|
+
if (e && e.name !== "AbortError") say("Could not play: " + e.message, { warn: true });
|
|
3831
4814
|
});
|
|
3832
4815
|
};
|
|
3833
4816
|
if (rvVideo.readyState >= 1) go();
|
|
@@ -3841,15 +4824,641 @@
|
|
|
3841
4824
|
if (playlist.i >= playlist.ranges.length) {
|
|
3842
4825
|
rvVideo.pause();
|
|
3843
4826
|
playlist = null;
|
|
3844
|
-
|
|
4827
|
+
say("");
|
|
3845
4828
|
return;
|
|
3846
4829
|
}
|
|
3847
4830
|
const next = playlist.ranges[playlist.i];
|
|
3848
4831
|
rvVideo.currentTime = next.start / 1e3;
|
|
3849
|
-
|
|
4832
|
+
say("\u25B6 " + next.title);
|
|
4833
|
+
});
|
|
4834
|
+
var previewBtn = document.getElementById("rv-play-final");
|
|
4835
|
+
var previewFrom = null;
|
|
4836
|
+
function resetPreview() {
|
|
4837
|
+
previewFrom = null;
|
|
4838
|
+
}
|
|
4839
|
+
previewBtn.onclick = () => {
|
|
4840
|
+
if (!reviewing) return;
|
|
4841
|
+
if (!reviewing.inBrowser) {
|
|
4842
|
+
playRange(pickedRanges(reviewing).map((r) => ({ start: r.start, end: r.end, title: r.title })));
|
|
4843
|
+
return;
|
|
4844
|
+
}
|
|
4845
|
+
if (clipList && !clipList.single) {
|
|
4846
|
+
if (rvVideo.paused) rvVideo.play().catch(() => {
|
|
4847
|
+
});
|
|
4848
|
+
else rvVideo.pause();
|
|
4849
|
+
return;
|
|
4850
|
+
}
|
|
4851
|
+
const plan = clipPlan(reviewing);
|
|
4852
|
+
const start = Math.max(0, previewFrom ? plan.findIndex((p) => p.id === previewFrom) : 0);
|
|
4853
|
+
previewFrom = null;
|
|
4854
|
+
playClips(plan.slice(start));
|
|
4855
|
+
};
|
|
4856
|
+
function showPreviewState() {
|
|
4857
|
+
const running = clipList && !clipList.single && !rvVideo.paused;
|
|
4858
|
+
previewBtn.textContent = running ? "\u275A\u275A Pause" : "\u25B6 Preview";
|
|
4859
|
+
document.querySelectorAll("#rv-list .rv-row.playing").forEach((r) => r.classList.remove("playing"));
|
|
4860
|
+
const part = clipList && clipList.parts[clipList.i];
|
|
4861
|
+
const row = part && part.id && document.querySelector('#rv-list .rv-row[data-id="' + CSS.escape(part.id) + '"]');
|
|
4862
|
+
if (row) {
|
|
4863
|
+
row.classList.add("playing");
|
|
4864
|
+
row.scrollIntoView({ block: "nearest" });
|
|
4865
|
+
}
|
|
4866
|
+
}
|
|
4867
|
+
rvVideo.addEventListener("play", showPreviewState);
|
|
4868
|
+
rvVideo.addEventListener("pause", () => {
|
|
4869
|
+
if (clipList && clipList.single && rvVideo.currentTime < clipList.parts[0].keep - 0.05) {
|
|
4870
|
+
previewFrom = clipList.parts[0].id;
|
|
4871
|
+
say("Preview starts from " + clipList.parts[0].title.replace(/ · take \d+$/, "") + ".");
|
|
4872
|
+
}
|
|
4873
|
+
showPreviewState();
|
|
4874
|
+
});
|
|
4875
|
+
function singleTakeDone(part) {
|
|
4876
|
+
const plan = reviewing ? clipPlan(reviewing) : [];
|
|
4877
|
+
const i = plan.findIndex((p) => p.id === part.id), next = i >= 0 ? plan[i + 1] : null;
|
|
4878
|
+
previewFrom = next ? next.id : null;
|
|
4879
|
+
say(next ? "Preview continues from " + next.title + "." : "That was the last slide: Preview plays from the start.");
|
|
4880
|
+
}
|
|
4881
|
+
function planesOf(smp) {
|
|
4882
|
+
return Array.from({ length: smp.numberOfChannels }, (_, c) => {
|
|
4883
|
+
const p = new Float32Array(smp.numberOfFrames);
|
|
4884
|
+
smp.copyTo(p, { planeIndex: c, format: "f32-planar" });
|
|
4885
|
+
return p;
|
|
4886
|
+
});
|
|
4887
|
+
}
|
|
4888
|
+
var clipList = null;
|
|
4889
|
+
async function clipFile(path) {
|
|
4890
|
+
const [run, name] = path.split("/");
|
|
4891
|
+
return (await (await takesDir(run)).getFileHandle(name)).getFile();
|
|
4892
|
+
}
|
|
4893
|
+
async function playClips(parts, i = 0, single = false) {
|
|
4894
|
+
if (!reviewing || reviewing.cleaned || !parts.length) return;
|
|
4895
|
+
playlist = null;
|
|
4896
|
+
clipList = { parts, i, single };
|
|
4897
|
+
try {
|
|
4898
|
+
const file = await clipFile(parts[i].clip);
|
|
4899
|
+
if (!reviewDialog.classList.contains("open")) return;
|
|
4900
|
+
if (rvVideo.src) URL.revokeObjectURL(rvVideo.src);
|
|
4901
|
+
rvVideo.src = URL.createObjectURL(file);
|
|
4902
|
+
say("\u25B6 " + parts[i].title);
|
|
4903
|
+
await rvVideo.play();
|
|
4904
|
+
} catch (e) {
|
|
4905
|
+
if (e && e.name === "AbortError") return;
|
|
4906
|
+
clipList = null;
|
|
4907
|
+
say(e && e.name === "NotFoundError" ? "This take is no longer in the browser." : "Could not play this take: " + (e && e.message || e), { warn: true });
|
|
4908
|
+
}
|
|
4909
|
+
}
|
|
4910
|
+
function clipDone() {
|
|
4911
|
+
const c = clipList;
|
|
4912
|
+
if (c.i + 1 < c.parts.length) {
|
|
4913
|
+
playClips(c.parts, c.i + 1, c.single);
|
|
4914
|
+
return;
|
|
4915
|
+
}
|
|
4916
|
+
clipList = null;
|
|
4917
|
+
rvVideo.pause();
|
|
4918
|
+
if (c.single) singleTakeDone(c.parts[0]);
|
|
4919
|
+
else say("");
|
|
4920
|
+
showPreviewState();
|
|
4921
|
+
}
|
|
4922
|
+
rvVideo.addEventListener("timeupdate", () => {
|
|
4923
|
+
if (clipList && rvVideo.currentTime >= clipList.parts[clipList.i].keep) clipDone();
|
|
4924
|
+
});
|
|
4925
|
+
rvVideo.addEventListener("ended", () => {
|
|
4926
|
+
if (clipList) clipDone();
|
|
3850
4927
|
});
|
|
3851
|
-
document.getElementById("rv-
|
|
3852
|
-
|
|
4928
|
+
var renderBtn = document.getElementById("rv-render-btn");
|
|
4929
|
+
renderBtn.onclick = () => downloadVideo(false);
|
|
4930
|
+
var renderDone = 0;
|
|
4931
|
+
var renderLabel = (
|
|
4932
|
+
/** @param {string} [t] */
|
|
4933
|
+
(t) => {
|
|
4934
|
+
clearTimeout(renderDone);
|
|
4935
|
+
renderBtn.textContent = t || "\u2193 Download";
|
|
4936
|
+
}
|
|
4937
|
+
);
|
|
4938
|
+
var savedWhere = (d) => d.where ? "\u201C" + d.where + "\u201D as " + d.name : "your downloads as " + d.name;
|
|
4939
|
+
async function stillSaved(d) {
|
|
4940
|
+
if (!d.where) return true;
|
|
4941
|
+
try {
|
|
4942
|
+
const dir = await kvGet("video-folder");
|
|
4943
|
+
if (!dir || dir.name !== d.where || await dir.queryPermission({ mode: "readwrite" }) !== "granted") return true;
|
|
4944
|
+
await dir.getFileHandle(d.name);
|
|
4945
|
+
return true;
|
|
4946
|
+
} catch (e) {
|
|
4947
|
+
return false;
|
|
4948
|
+
}
|
|
4949
|
+
}
|
|
4950
|
+
async function downloadVideo(force) {
|
|
4951
|
+
const sess = reviewing;
|
|
4952
|
+
if (!sess || !sess.inBrowser || sess.cleaned) return;
|
|
4953
|
+
const plan = clipPlan(sess);
|
|
4954
|
+
if (!plan.length) {
|
|
4955
|
+
say("No slide has a take yet: nothing to save.", { warn: true });
|
|
4956
|
+
return;
|
|
4957
|
+
}
|
|
4958
|
+
const sig = JSON.stringify([plan.map((c) => [c.clip, Math.round(c.keep * 1e3)]), loudOn(), limiterOn(), sess.type]);
|
|
4959
|
+
const last = sess.board && board.lastDownload;
|
|
4960
|
+
if (!force && last && last.sig === sig && await stillSaved(last)) {
|
|
4961
|
+
say("", {
|
|
4962
|
+
html: '<button class="btn small" id="rv-save-again">Save another copy</button> Already saved in ' + escapeHtml(savedWhere(last)) + ".",
|
|
4963
|
+
title: "Already saved in " + savedWhere(last) + ". A new video is made only when a take or the sound settings change."
|
|
4964
|
+
});
|
|
4965
|
+
return;
|
|
4966
|
+
}
|
|
4967
|
+
const mp4 = clipExt(sess.type || "") === "mp4";
|
|
4968
|
+
const name = sessionKey() + " " + fileStamp(/* @__PURE__ */ new Date()) + "." + (mp4 ? "mp4" : "webm");
|
|
4969
|
+
let file = null, where = "";
|
|
4970
|
+
try {
|
|
4971
|
+
const dir = await videoFolder(false);
|
|
4972
|
+
if (dir) {
|
|
4973
|
+
file = await (await dir.getFileHandle(name, { create: true })).createWritable();
|
|
4974
|
+
where = dir.name;
|
|
4975
|
+
}
|
|
4976
|
+
} catch (e) {
|
|
4977
|
+
if (e && e.name === "AbortError") return;
|
|
4978
|
+
}
|
|
4979
|
+
const btn = renderBtn;
|
|
4980
|
+
btn.disabled = true;
|
|
4981
|
+
renderLabel("Preparing\u2026");
|
|
4982
|
+
try {
|
|
4983
|
+
const MB = await import(MEDIABUNNY_URL);
|
|
4984
|
+
const target = file ? new MB.StreamTarget(file) : new MB.BufferTarget();
|
|
4985
|
+
const out = new MB.Output({ format: mp4 ? new MB.Mp4OutputFormat({ fastStart: file ? false : "in-memory" }) : new MB.WebMOutputFormat(), target });
|
|
4986
|
+
let gain = 1, loudNote = "";
|
|
4987
|
+
const useLimiter = loudOn() && limiterOn();
|
|
4988
|
+
if (loudOn()) {
|
|
4989
|
+
const first = await measureCut(MB, plan, 1, false, "Measuring");
|
|
4990
|
+
if (first && isFinite(first.integrated)) {
|
|
4991
|
+
let db = gainToTarget(first, { limit: useLimiter });
|
|
4992
|
+
if (useLimiter && Math.abs(db) >= 0.05) {
|
|
4993
|
+
const then = await measureCut(MB, plan, dbToGain(db), true, "Checking");
|
|
4994
|
+
if (then && isFinite(then.integrated)) db = Math.min(db + (YOUTUBE_LUFS - then.integrated), MAX_BOOST_DB);
|
|
4995
|
+
}
|
|
4996
|
+
gain = dbToGain(db);
|
|
4997
|
+
const reached = useLimiter ? YOUTUBE_LUFS : first.integrated + db;
|
|
4998
|
+
const heldBack = !useLimiter && gainToTarget(first, { limit: true }) - db > 0.5;
|
|
4999
|
+
loudNote = " \xB7 loudness " + first.integrated.toFixed(1) + (Math.abs(db) < 0.05 ? " LUFS, left as is" : " \u2192 " + reached.toFixed(1) + " LUFS") + (heldBack ? "; a loud peak held it back, turn on Peak limiter to reach " + YOUTUBE_LUFS : "");
|
|
5000
|
+
}
|
|
5001
|
+
}
|
|
5002
|
+
const reencode = gain !== 1 || useLimiter;
|
|
5003
|
+
await checkJoinable(MB, plan);
|
|
5004
|
+
let vSrc = null, aSrc = null, offset = 0, lastV = -1, lastA = -1, limiter = null;
|
|
5005
|
+
const limited = [];
|
|
5006
|
+
const sendLimited = async () => {
|
|
5007
|
+
while (limited.length && limiter.ready() >= limited[0].n) {
|
|
5008
|
+
const piece = limited.shift(), planes = limiter.take(piece.n), data = new Float32Array(piece.n * piece.ch);
|
|
5009
|
+
planes.forEach((p, c) => data.set(p, c * piece.n));
|
|
5010
|
+
await aSrc.add(new MB.AudioSample({ data, format: "f32-planar", numberOfChannels: piece.ch, sampleRate: piece.rate, timestamp: piece.t }));
|
|
5011
|
+
}
|
|
5012
|
+
};
|
|
5013
|
+
for (const [i, part] of plan.entries()) {
|
|
5014
|
+
renderLabel("Joining " + (i + 1) + "/" + plan.length);
|
|
5015
|
+
const input = new MB.Input({ source: new MB.BlobSource(await clipFile(part.clip)), formats: MB.ALL_FORMATS });
|
|
5016
|
+
const vt = await input.getPrimaryVideoTrack(), at = await input.getPrimaryAudioTrack();
|
|
5017
|
+
if (!vt) throw new Error(part.title + " has no video");
|
|
5018
|
+
if (!vSrc) {
|
|
5019
|
+
vSrc = new MB.EncodedVideoPacketSource(await vt.getCodec());
|
|
5020
|
+
out.addVideoTrack(vSrc, { frameRate: FPS });
|
|
5021
|
+
if (at) {
|
|
5022
|
+
aSrc = reencode ? new MB.AudioSampleSource({ codec: mp4 ? "aac" : "opus", bitrate: AUDIO_BITRATE }) : new MB.EncodedAudioPacketSource(await at.getCodec());
|
|
5023
|
+
out.addAudioTrack(aSrc);
|
|
5024
|
+
}
|
|
5025
|
+
await out.start();
|
|
5026
|
+
}
|
|
5027
|
+
const vMeta = { decoderConfig: await vt.getDecoderConfig() };
|
|
5028
|
+
let end = 0, first = true;
|
|
5029
|
+
for await (const pk of new MB.EncodedPacketSink(vt).packets()) {
|
|
5030
|
+
if (pk.timestamp >= part.keep) continue;
|
|
5031
|
+
lastV = afterPrevious(lastV, offset + pk.timestamp);
|
|
5032
|
+
await vSrc.add(pk.clone({ timestamp: lastV }), first && i === 0 ? vMeta : void 0);
|
|
5033
|
+
first = false;
|
|
5034
|
+
end = Math.max(end, pk.timestamp + pk.duration);
|
|
5035
|
+
}
|
|
5036
|
+
if (at && aSrc && reencode) {
|
|
5037
|
+
for await (const smp of new MB.AudioSampleSink(at).samples(0, end)) {
|
|
5038
|
+
if (smp.timestamp + smp.duration > end + 1e-4) {
|
|
5039
|
+
smp.close();
|
|
5040
|
+
continue;
|
|
5041
|
+
}
|
|
5042
|
+
lastA = afterPrevious(lastA, offset + smp.timestamp);
|
|
5043
|
+
const planes = planesOf(smp);
|
|
5044
|
+
planes.forEach((p) => {
|
|
5045
|
+
for (let k = 0; k < p.length; k++) p[k] *= gain;
|
|
5046
|
+
});
|
|
5047
|
+
if (useLimiter) {
|
|
5048
|
+
limiter = limiter || peakLimiter(smp.sampleRate, planes.length);
|
|
5049
|
+
limiter.push(planes);
|
|
5050
|
+
limited.push({ t: lastA, n: smp.numberOfFrames, rate: smp.sampleRate, ch: planes.length });
|
|
5051
|
+
smp.close();
|
|
5052
|
+
await sendLimited();
|
|
5053
|
+
} else {
|
|
5054
|
+
const n = smp.numberOfFrames, data = new Float32Array(n * planes.length);
|
|
5055
|
+
planes.forEach((p, c) => data.set(p, c * n));
|
|
5056
|
+
await aSrc.add(new MB.AudioSample({ data, format: "f32-planar", numberOfChannels: planes.length, sampleRate: smp.sampleRate, timestamp: lastA }));
|
|
5057
|
+
smp.close();
|
|
5058
|
+
}
|
|
5059
|
+
}
|
|
5060
|
+
} else if (at && aSrc) {
|
|
5061
|
+
const aMeta = { decoderConfig: await at.getDecoderConfig() };
|
|
5062
|
+
let aFirst = true;
|
|
5063
|
+
for await (const pk of new MB.EncodedPacketSink(at).packets()) {
|
|
5064
|
+
if (pk.timestamp + pk.duration > end + 1e-4) continue;
|
|
5065
|
+
lastA = afterPrevious(lastA, offset + pk.timestamp);
|
|
5066
|
+
await aSrc.add(pk.clone({ timestamp: lastA }), aFirst && i === 0 ? aMeta : void 0);
|
|
5067
|
+
aFirst = false;
|
|
5068
|
+
}
|
|
5069
|
+
}
|
|
5070
|
+
offset += end;
|
|
5071
|
+
}
|
|
5072
|
+
if (limiter) {
|
|
5073
|
+
limiter.end();
|
|
5074
|
+
await sendLimited();
|
|
5075
|
+
if (limiter.events) loudNote += ", " + limiter.events + " peak" + (limiter.events === 1 ? "" : "s") + " limited";
|
|
5076
|
+
}
|
|
5077
|
+
renderLabel("Finishing\u2026");
|
|
5078
|
+
await out.finalize();
|
|
5079
|
+
if (!file) {
|
|
5080
|
+
const a = document.createElement("a");
|
|
5081
|
+
a.href = URL.createObjectURL(new Blob([target.buffer], { type: mp4 ? "video/mp4" : "video/webm" }));
|
|
5082
|
+
a.download = name;
|
|
5083
|
+
a.click();
|
|
5084
|
+
setTimeout(() => URL.revokeObjectURL(a.href), 1e4);
|
|
5085
|
+
}
|
|
5086
|
+
const saved = { sig, name, where };
|
|
5087
|
+
if (sess.board) {
|
|
5088
|
+
board.lastDownload = saved;
|
|
5089
|
+
saveBoard();
|
|
5090
|
+
}
|
|
5091
|
+
say("Saved in " + savedWhere(saved) + " (" + fmtLength(offset * 1e3) + loudNote + ").");
|
|
5092
|
+
renderLabel("\u2713 Saved");
|
|
5093
|
+
renderDone = setTimeout(() => renderLabel(), 2500);
|
|
5094
|
+
} catch (e) {
|
|
5095
|
+
renderLabel();
|
|
5096
|
+
say("Could not save the video: " + (e && e.message || e), { warn: true });
|
|
5097
|
+
if (file) file.abort().catch(() => {
|
|
5098
|
+
});
|
|
5099
|
+
} finally {
|
|
5100
|
+
btn.disabled = !!sess.cleaned;
|
|
5101
|
+
}
|
|
5102
|
+
}
|
|
5103
|
+
async function measureCut(MB, plan, gain, limit, label) {
|
|
5104
|
+
let meter2 = null, limiter = null;
|
|
5105
|
+
for (const [i, part] of plan.entries()) {
|
|
5106
|
+
renderLabel(label + " " + (i + 1) + "/" + plan.length);
|
|
5107
|
+
const at = await new MB.Input({ source: new MB.BlobSource(await clipFile(part.clip)), formats: MB.ALL_FORMATS }).getPrimaryAudioTrack();
|
|
5108
|
+
if (!at) continue;
|
|
5109
|
+
for await (const smp of new MB.AudioSampleSink(at).samples(0, part.keep)) {
|
|
5110
|
+
const planes = planesOf(smp);
|
|
5111
|
+
meter2 = meter2 || loudnessMeter(smp.sampleRate, planes.length);
|
|
5112
|
+
if (gain !== 1 && limit) {
|
|
5113
|
+
planes.forEach((p) => {
|
|
5114
|
+
for (let k = 0; k < p.length; k++) p[k] *= gain;
|
|
5115
|
+
});
|
|
5116
|
+
limiter = limiter || peakLimiter(smp.sampleRate, planes.length);
|
|
5117
|
+
limiter.push(planes);
|
|
5118
|
+
if (limiter.ready()) meter2.add(limiter.take(limiter.ready()));
|
|
5119
|
+
} else meter2.add(planes);
|
|
5120
|
+
smp.close();
|
|
5121
|
+
}
|
|
5122
|
+
}
|
|
5123
|
+
if (limiter) {
|
|
5124
|
+
limiter.end();
|
|
5125
|
+
if (limiter.ready()) meter2.add(limiter.take(limiter.ready()));
|
|
5126
|
+
}
|
|
5127
|
+
return meter2 ? meter2.result() : null;
|
|
5128
|
+
}
|
|
5129
|
+
async function checkJoinable(MB, plan) {
|
|
5130
|
+
const keys = [];
|
|
5131
|
+
for (const part of plan) {
|
|
5132
|
+
const vt = await new MB.Input({ source: new MB.BlobSource(await clipFile(part.clip)), formats: MB.ALL_FORMATS }).getPrimaryVideoTrack();
|
|
5133
|
+
const c = vt && await vt.getDecoderConfig();
|
|
5134
|
+
keys.push(c ? c.codec + " " + c.codedWidth + "\xD7" + c.codedHeight + " " + (c.description ? [...new Uint8Array(c.description)].join(".") : "") : "none");
|
|
5135
|
+
}
|
|
5136
|
+
const count = /* @__PURE__ */ new Map();
|
|
5137
|
+
keys.forEach((k) => count.set(k, (count.get(k) || 0) + 1));
|
|
5138
|
+
const main = [...count.entries()].sort((a, b) => b[1] - a[1])[0][0];
|
|
5139
|
+
const odd = plan.filter((_, i) => keys[i] !== main);
|
|
5140
|
+
if (odd.length) throw new Error(odd.map((p) => p.title).join(", ") + (odd.length === 1 ? " was" : " were") + " recorded at a different size (" + keys[plan.indexOf(odd[0])].split(" ")[1] + ", not " + main.split(" ")[1] + "). Tick " + (odd.length === 1 ? "it" : "them") + " and record again");
|
|
5141
|
+
}
|
|
5142
|
+
var fileStamp = (d) => {
|
|
5143
|
+
const p2 = (n) => String(n).padStart(2, "0");
|
|
5144
|
+
return d.getFullYear() + "-" + p2(d.getMonth() + 1) + "-" + p2(d.getDate()) + " " + p2(d.getHours()) + "-" + p2(d.getMinutes()) + "-" + p2(d.getSeconds());
|
|
5145
|
+
};
|
|
5146
|
+
async function videoFolder(ask) {
|
|
5147
|
+
if (!window.showDirectoryPicker) return null;
|
|
5148
|
+
let dir = ask ? null : await kvGet("video-folder");
|
|
5149
|
+
if (dir) {
|
|
5150
|
+
let perm = await dir.queryPermission({ mode: "readwrite" });
|
|
5151
|
+
if (perm === "prompt") perm = await dir.requestPermission({ mode: "readwrite" });
|
|
5152
|
+
if (perm === "granted") return dir;
|
|
5153
|
+
}
|
|
5154
|
+
dir = await window.showDirectoryPicker({ id: "slidetake-videos", mode: "readwrite", startIn: "videos" });
|
|
5155
|
+
kvSet("video-folder", dir);
|
|
5156
|
+
return dir;
|
|
5157
|
+
}
|
|
5158
|
+
document.getElementById("rv-folder-change").onclick = async () => {
|
|
5159
|
+
try {
|
|
5160
|
+
const dir = await videoFolder(true);
|
|
5161
|
+
if (dir) say("Videos now go to " + dir.name + ".");
|
|
5162
|
+
} catch (e) {
|
|
5163
|
+
}
|
|
5164
|
+
};
|
|
5165
|
+
var board = null;
|
|
5166
|
+
var boardKey = "";
|
|
5167
|
+
var selAnchor = null;
|
|
5168
|
+
var selected = /* @__PURE__ */ new Set();
|
|
5169
|
+
var boardStoreKey = () => "slidetake:board:" + sessionKey();
|
|
5170
|
+
function loadBoard() {
|
|
5171
|
+
const key = boardStoreKey();
|
|
5172
|
+
if (board && boardKey === key) return board;
|
|
5173
|
+
boardKey = key;
|
|
5174
|
+
try {
|
|
5175
|
+
board = JSON.parse(load(key) || "null");
|
|
5176
|
+
} catch (e) {
|
|
5177
|
+
board = null;
|
|
5178
|
+
}
|
|
5179
|
+
if (!board || !Array.isArray(board.takes)) board = { takes: [], picks: {}, type: "", quality: "" };
|
|
5180
|
+
return board;
|
|
5181
|
+
}
|
|
5182
|
+
var saveBoard = () => save(boardStoreKey(), JSON.stringify(board));
|
|
5183
|
+
var slideFp = (id) => {
|
|
5184
|
+
const n = nodes.get(id);
|
|
5185
|
+
return n ? fingerprint(n.title + "\n" + n.html) : "";
|
|
5186
|
+
};
|
|
5187
|
+
var boardDeck = () => deckSlides(order, (id) => ({ title: nodes.get(id).title, fp: slideFp(id) }));
|
|
5188
|
+
function addToBoard(sess) {
|
|
5189
|
+
loadBoard();
|
|
5190
|
+
const takes = takesFromRun(sess, sess.takesId, boardDeck());
|
|
5191
|
+
takes.forEach((t) => {
|
|
5192
|
+
delete board.picks[t.id];
|
|
5193
|
+
});
|
|
5194
|
+
board.takes.push(...takes);
|
|
5195
|
+
Object.assign(board, { type: sess.type, quality: sess.quality });
|
|
5196
|
+
saveBoard();
|
|
5197
|
+
selected.clear();
|
|
5198
|
+
openBoard({ note: (sess.reason ? sess.reason + ". " : "") + takes.length + " new take" + (takes.length === 1 ? "" : "s") + " on the board." });
|
|
5199
|
+
}
|
|
5200
|
+
function boardReview() {
|
|
5201
|
+
const rows = boardRows(loadBoard(), boardDeck());
|
|
5202
|
+
const sess = Object.assign(boardSession(rows), {
|
|
5203
|
+
board: true,
|
|
5204
|
+
inBrowser: true,
|
|
5205
|
+
withObs: false,
|
|
5206
|
+
type: board.type || "video/mp4",
|
|
5207
|
+
quality: board.quality || "",
|
|
5208
|
+
deckTitle: deck.title || (order[0] ? nodes.get(order[0]).title : "Deck"),
|
|
5209
|
+
date: (/* @__PURE__ */ new Date()).toISOString()
|
|
5210
|
+
});
|
|
5211
|
+
return { rows, sess };
|
|
5212
|
+
}
|
|
5213
|
+
var setupEl = document.getElementById("rv-setup");
|
|
5214
|
+
var setupBtn = document.getElementById("rv-setup-btn");
|
|
5215
|
+
setupEl.addEventListener("toggle", () => {
|
|
5216
|
+
setupBtn.setAttribute("aria-expanded", String(setupEl.open));
|
|
5217
|
+
if (setupEl.open) refreshSetup();
|
|
5218
|
+
else stopMeter();
|
|
5219
|
+
});
|
|
5220
|
+
setupBtn.onclick = () => {
|
|
5221
|
+
setupEl.open = !setupEl.open;
|
|
5222
|
+
};
|
|
5223
|
+
reviewDialog.addEventListener("click", (e) => {
|
|
5224
|
+
if (e.target === reviewDialog || e.target.closest("[data-close]")) stopMeter();
|
|
5225
|
+
});
|
|
5226
|
+
function refreshSetup() {
|
|
5227
|
+
if (obsMode()) {
|
|
5228
|
+
showScreenAdvice();
|
|
5229
|
+
fillDevices(false).then(setupSummary);
|
|
5230
|
+
return;
|
|
5231
|
+
}
|
|
5232
|
+
recCheck.innerHTML = "";
|
|
5233
|
+
showBrowserCheck().then((b) => {
|
|
5234
|
+
if (b.ok) fillDevices().then(setupSummary);
|
|
5235
|
+
else setupSummary();
|
|
5236
|
+
});
|
|
5237
|
+
}
|
|
5238
|
+
var browserName = (() => {
|
|
5239
|
+
const brands = (navigator.userAgentData && navigator.userAgentData.brands || []).map((b) => b.brand).filter((b) => !/chromium|not.?a.?brand/i.test(b));
|
|
5240
|
+
if (brands.length) return brands[0].replace(/^(Google|Microsoft) /, "");
|
|
5241
|
+
const ua = navigator.userAgent;
|
|
5242
|
+
return /Firefox\//.test(ua) ? "Firefox" : /Edg\//.test(ua) ? "Edge" : /OPR\//.test(ua) ? "Opera" : /Chrome\//.test(ua) ? "Chrome" : /Safari\//.test(ua) ? "Safari" : "this browser";
|
|
5243
|
+
})();
|
|
5244
|
+
document.querySelectorAll(".browser-name").forEach((el) => {
|
|
5245
|
+
el.textContent = browserName;
|
|
5246
|
+
});
|
|
5247
|
+
function setupSummary() {
|
|
5248
|
+
const name = (
|
|
5249
|
+
/** @param {HTMLSelectElement} sel */
|
|
5250
|
+
(sel) => {
|
|
5251
|
+
const o = sel.selectedOptions[0];
|
|
5252
|
+
return o ? o.textContent.replace(/ \(system default\)$/, "") : "";
|
|
5253
|
+
}
|
|
5254
|
+
);
|
|
5255
|
+
const cam2 = name(recCam) || (camChoice() === "none" ? "No camera" : "Camera");
|
|
5256
|
+
const parts = obsMode() ? ["Pro", "OBS", obsSize, cam2].filter(Boolean) : browserRecording().ok ? ["Easy", browserName, recQuality.value, cam2, name(recMic) || "Microphone"].filter(Boolean) : ["Easy", browserName + " can\u2019t record here"];
|
|
5257
|
+
const el = document.getElementById("rv-using");
|
|
5258
|
+
el.textContent = parts.join(" \xB7 ");
|
|
5259
|
+
el.title = setupBtn.title = "Recording with " + parts.join(" \xB7 ");
|
|
5260
|
+
}
|
|
5261
|
+
function openBoard(opts = {}) {
|
|
5262
|
+
if (!RECORDING_UI) return;
|
|
5263
|
+
closeModals();
|
|
5264
|
+
loadBoard();
|
|
5265
|
+
reviewDialog.classList.remove("obs");
|
|
5266
|
+
reviewDialog.classList.add("in-browser", "board");
|
|
5267
|
+
document.getElementById("rv-rec").title = "Records the whole deck, or only the ticked slides (shift-click ticks a range)";
|
|
5268
|
+
document.getElementById("rv-novideo").hidden = true;
|
|
5269
|
+
if (rvVideo.src) {
|
|
5270
|
+
URL.revokeObjectURL(rvVideo.src);
|
|
5271
|
+
rvVideo.removeAttribute("src");
|
|
5272
|
+
rvVideo.load();
|
|
5273
|
+
}
|
|
5274
|
+
playlist = null;
|
|
5275
|
+
clipList = null;
|
|
5276
|
+
resetPreview();
|
|
5277
|
+
lastTicked = -1;
|
|
5278
|
+
renderBoard();
|
|
5279
|
+
openModal(reviewDialog);
|
|
5280
|
+
const ready = browserRecording().ok;
|
|
5281
|
+
setupEl.open = !!opts.setup || !ready || !board.takes.length;
|
|
5282
|
+
if (setupEl.open) refreshSetup();
|
|
5283
|
+
else showBrowserCheck().then(() => fillDevices(false)).then(setupSummary);
|
|
5284
|
+
say(opts.note || selNote() || (board.takes.length ? boardState() + ". Click a take to preview it." : order.length + " slides, nothing recorded yet. Press \u25CF Record."));
|
|
5285
|
+
}
|
|
5286
|
+
function boardState() {
|
|
5287
|
+
const rows = boardRows(loadBoard(), boardDeck());
|
|
5288
|
+
const ready = rows.filter((r) => r.pick).length, outdated = rows.filter((r) => r.takes.length && !r.pick).length;
|
|
5289
|
+
return ready + " of " + rows.length + " slides ready" + (outdated ? ", " + outdated + " to record again" : "");
|
|
5290
|
+
}
|
|
5291
|
+
function renderBoard() {
|
|
5292
|
+
const { rows, sess } = boardReview();
|
|
5293
|
+
reviewing = sess;
|
|
5294
|
+
const list = document.getElementById("rv-list");
|
|
5295
|
+
let lastSec = null;
|
|
5296
|
+
list.innerHTML = rows.map((r) => {
|
|
5297
|
+
const sec = sectionOf(r.id), isSec = sec !== lastSec;
|
|
5298
|
+
lastSec = sec;
|
|
5299
|
+
const id = escapeHtml(r.id);
|
|
5300
|
+
const why = { slide: "Recorded before this slide changed", before: "Starts with the entry from the slide before, which has changed or is gone: record this slide again" };
|
|
5301
|
+
const chips = r.takes.length ? r.takes.map((t) => '<button class="rv-chip' + (r.pick === t.uid ? " on" : "") + (t.outdated ? ' outdated" title="' + why[t.outdated] : "") + '" data-id="' + id + '" data-uid="' + escapeHtml(t.uid) + '">Take ' + t.no + " \xB7 " + fmtLength(t.ms) + "</button>").join("") + (r.pick ? "" : '<span class="rv-none">' + (r.takes.some((t) => t.outdated === "before") && !r.takes.some((t) => t.outdated === "slide") ? "The slide before changed: record again" : "Changed since: record again") + "</span>") : '<span class="rv-none">No take yet</span>';
|
|
5302
|
+
return '<div class="rv-row with-sel' + (isSec ? " sec" : "") + (selected.has(r.id) ? " selected" : "") + '" data-id="' + id + '"><input type="checkbox" class="rv-sel" data-id="' + id + '"' + (selected.has(r.id) ? " checked" : "") + ' aria-label="Select ' + escapeHtml(r.title) + ' to record"><div><div class="t">' + escapeHtml(r.title) + '</div><div class="rv-chips">' + chips + "</div></div></div>";
|
|
5303
|
+
}).join("");
|
|
5304
|
+
list.querySelectorAll(".rv-chip").forEach((b) => b.onclick = () => {
|
|
5305
|
+
board.picks[b.dataset.id] = b.dataset.uid;
|
|
5306
|
+
saveBoard();
|
|
5307
|
+
renderBoard();
|
|
5308
|
+
const row = rows.find((r) => r.id === b.dataset.id), t = row && row.takes.find((x) => x.uid === b.dataset.uid);
|
|
5309
|
+
if (t) playClips([{ id: row.id, clip: t.clip, keep: t.ms / 1e3, title: row.title + " \xB7 take " + t.no }], 0, true);
|
|
5310
|
+
});
|
|
5311
|
+
list.querySelectorAll(".rv-sel").forEach((c) => c.addEventListener("click", (e) => {
|
|
5312
|
+
const ids = e.shiftKey ? rangeOf(order, selAnchor, c.dataset.id) : [c.dataset.id];
|
|
5313
|
+
ids.forEach((i) => {
|
|
5314
|
+
if (c.checked) selected.add(i);
|
|
5315
|
+
else selected.delete(i);
|
|
5316
|
+
});
|
|
5317
|
+
resetPreview();
|
|
5318
|
+
selAnchor = c.dataset.id;
|
|
5319
|
+
renderBoard();
|
|
5320
|
+
}));
|
|
5321
|
+
const ticked = selectedInOrder(order, selected), ready = browserRecording().ok;
|
|
5322
|
+
document.getElementById("rv-rec").disabled = !ready;
|
|
5323
|
+
if (lastTicked >= 0 && ticked.length !== lastTicked) say(selNote() || "Record takes the whole deck.");
|
|
5324
|
+
lastTicked = ticked.length;
|
|
5325
|
+
document.getElementById("rv-render-btn").disabled = document.getElementById("rv-play-final").disabled = !sess.events.length;
|
|
5326
|
+
showChapters(sess);
|
|
5327
|
+
showFinalSize(sess);
|
|
5328
|
+
}
|
|
5329
|
+
document.getElementById("rv-rec").onclick = () => {
|
|
5330
|
+
if (!obsMode()) {
|
|
5331
|
+
startTake("browser", selectedInOrder(order, selected));
|
|
5332
|
+
return;
|
|
5333
|
+
}
|
|
5334
|
+
if (obsConnected) {
|
|
5335
|
+
startTake("obs");
|
|
5336
|
+
return;
|
|
5337
|
+
}
|
|
5338
|
+
setupEl.open = true;
|
|
5339
|
+
say("Connect to OBS first: Setup \u2192 OBS \u2192 Connect.", { warn: true });
|
|
5340
|
+
};
|
|
5341
|
+
document.getElementById("rv-use-obs").onclick = () => setRecMode("obs");
|
|
5342
|
+
document.getElementById("rv-use-browser").onclick = () => setRecMode("browser");
|
|
5343
|
+
async function deleteClips(takes) {
|
|
5344
|
+
for (const t of takes) {
|
|
5345
|
+
try {
|
|
5346
|
+
const [run, file] = t.clip.split("/");
|
|
5347
|
+
await (await takesDir(run)).removeEntry(file);
|
|
5348
|
+
} catch (e) {
|
|
5349
|
+
}
|
|
5350
|
+
}
|
|
5351
|
+
const gone = new Set(takes.map((t) => t.uid));
|
|
5352
|
+
board.takes = board.takes.filter((t) => !gone.has(t.uid));
|
|
5353
|
+
Object.keys(board.picks).forEach((id) => {
|
|
5354
|
+
if (gone.has(board.picks[id])) delete board.picks[id];
|
|
5355
|
+
});
|
|
5356
|
+
saveBoard();
|
|
5357
|
+
if (rvVideo.src) {
|
|
5358
|
+
URL.revokeObjectURL(rvVideo.src);
|
|
5359
|
+
rvVideo.removeAttribute("src");
|
|
5360
|
+
rvVideo.load();
|
|
5361
|
+
}
|
|
5362
|
+
clipList = null;
|
|
5363
|
+
resetPreview();
|
|
5364
|
+
renderBoard();
|
|
5365
|
+
}
|
|
5366
|
+
document.querySelectorAll(".rv-purge .rv-menu button").forEach((b) => b.addEventListener("click", () => {
|
|
5367
|
+
b.closest("details").open = false;
|
|
5368
|
+
}));
|
|
5369
|
+
document.getElementById("rv-clean-unused").onclick = async () => {
|
|
5370
|
+
const { rows } = boardReview(), used = new Set(rows.map((r) => r.pick).filter(Boolean));
|
|
5371
|
+
const unused = board.takes.filter((t) => !used.has(t.uid));
|
|
5372
|
+
if (!unused.length) {
|
|
5373
|
+
say("Every take is in use.");
|
|
5374
|
+
return;
|
|
5375
|
+
}
|
|
5376
|
+
if (!confirm("Purge " + unused.length + " take" + (unused.length === 1 ? "" : "s") + " the video doesn\u2019t use (earlier attempts and outdated takes)?")) return;
|
|
5377
|
+
await deleteClips(unused);
|
|
5378
|
+
say("Purged " + unused.length + " unused take" + (unused.length === 1 ? "" : "s") + ".");
|
|
5379
|
+
};
|
|
5380
|
+
document.getElementById("rv-clean").onclick = async () => {
|
|
5381
|
+
if (!board.takes.length || !confirm("Purge all " + board.takes.length + " takes of this deck from this browser? Download the video first if you need it.")) return;
|
|
5382
|
+
const runs = new Set(board.takes.map((t) => t.clip.split("/")[0]));
|
|
5383
|
+
board.takes = [];
|
|
5384
|
+
board.picks = {};
|
|
5385
|
+
saveBoard();
|
|
5386
|
+
for (const r of runs) await deleteTakes(r);
|
|
5387
|
+
if (rvVideo.src) {
|
|
5388
|
+
URL.revokeObjectURL(rvVideo.src);
|
|
5389
|
+
rvVideo.removeAttribute("src");
|
|
5390
|
+
rvVideo.load();
|
|
5391
|
+
}
|
|
5392
|
+
clipList = null;
|
|
5393
|
+
resetPreview();
|
|
5394
|
+
say("All takes purged.");
|
|
5395
|
+
renderBoard();
|
|
5396
|
+
};
|
|
5397
|
+
document.getElementById("rv-clean-every").onclick = async () => {
|
|
5398
|
+
let root, bytes = 0, files = 0;
|
|
5399
|
+
try {
|
|
5400
|
+
root = await navigator.storage.getDirectory();
|
|
5401
|
+
} catch (e) {
|
|
5402
|
+
return;
|
|
5403
|
+
}
|
|
5404
|
+
const walk = async (dir) => {
|
|
5405
|
+
for await (const h of dir.values()) {
|
|
5406
|
+
if (h.kind === "directory") await walk(h);
|
|
5407
|
+
else {
|
|
5408
|
+
files++;
|
|
5409
|
+
bytes += (await h.getFile()).size;
|
|
5410
|
+
}
|
|
5411
|
+
}
|
|
5412
|
+
};
|
|
5413
|
+
try {
|
|
5414
|
+
await walk(await root.getDirectoryHandle("slidetake-takes"));
|
|
5415
|
+
} catch (e) {
|
|
5416
|
+
}
|
|
5417
|
+
const boards = [];
|
|
5418
|
+
try {
|
|
5419
|
+
for (let i = 0; i < localStorage.length; i++) {
|
|
5420
|
+
const k = localStorage.key(i);
|
|
5421
|
+
if (k && k.startsWith("slidetake:board:")) boards.push(k);
|
|
5422
|
+
}
|
|
5423
|
+
} catch (e) {
|
|
5424
|
+
}
|
|
5425
|
+
const decks = boards.filter((k) => {
|
|
5426
|
+
try {
|
|
5427
|
+
return JSON.parse(localStorage.getItem(k) || "{}").takes.length > 0;
|
|
5428
|
+
} catch (e) {
|
|
5429
|
+
return false;
|
|
5430
|
+
}
|
|
5431
|
+
}).length;
|
|
5432
|
+
if (!files) {
|
|
5433
|
+
say("No takes are kept in this browser.");
|
|
5434
|
+
return;
|
|
5435
|
+
}
|
|
5436
|
+
const size = bytes > 1e9 ? (bytes / 1e9).toFixed(1) + " GB" : Math.max(1, Math.round(bytes / 1e6)) + " MB";
|
|
5437
|
+
if (!confirm("Purge " + size + " of takes (" + files + " file" + (files === 1 ? "" : "s") + ") from " + (decks || "no") + " deck" + (decks === 1 ? "" : "s") + " and any left behind? Every deck loses its takes; download the videos you need first.")) return;
|
|
5438
|
+
try {
|
|
5439
|
+
await root.removeEntry("slidetake-takes", { recursive: true });
|
|
5440
|
+
} catch (e) {
|
|
5441
|
+
}
|
|
5442
|
+
boards.forEach((k) => {
|
|
5443
|
+
try {
|
|
5444
|
+
localStorage.removeItem(k);
|
|
5445
|
+
} catch (e) {
|
|
5446
|
+
}
|
|
5447
|
+
});
|
|
5448
|
+
save("slidetake:sessions", JSON.stringify(loadSessions().map((x) => x.inBrowser ? { ...x, cleaned: true } : x)));
|
|
5449
|
+
board = null;
|
|
5450
|
+
boardKey = "";
|
|
5451
|
+
loadBoard();
|
|
5452
|
+
clipSizes.clear();
|
|
5453
|
+
if (rvVideo.src) {
|
|
5454
|
+
URL.revokeObjectURL(rvVideo.src);
|
|
5455
|
+
rvVideo.removeAttribute("src");
|
|
5456
|
+
rvVideo.load();
|
|
5457
|
+
}
|
|
5458
|
+
clipList = null;
|
|
5459
|
+
resetPreview();
|
|
5460
|
+
renderBoard();
|
|
5461
|
+
say("Purged " + size + " of takes from every deck.");
|
|
3853
5462
|
};
|
|
3854
5463
|
function idb(name) {
|
|
3855
5464
|
return new Promise((res, rej) => {
|
|
@@ -3888,7 +5497,7 @@
|
|
|
3888
5497
|
if (!rvVideo.getAttribute("src")) return;
|
|
3889
5498
|
if (rvHandle && rvRetries < 5) {
|
|
3890
5499
|
rvRetries++;
|
|
3891
|
-
|
|
5500
|
+
say("Reloading " + reviewFileName + " (OBS was still finishing it)\u2026");
|
|
3892
5501
|
await new Promise((r) => setTimeout(r, 1500));
|
|
3893
5502
|
try {
|
|
3894
5503
|
useRecording(await stableFile(rvHandle), rvHandle, true);
|
|
@@ -3896,7 +5505,7 @@
|
|
|
3896
5505
|
} catch (e) {
|
|
3897
5506
|
}
|
|
3898
5507
|
}
|
|
3899
|
-
|
|
5508
|
+
say(rvHandle ? "Chrome cannot play " + reviewFileName + ". In OBS set Recording Format to Hybrid MP4 (or MP4) with H.264 video; the ffmpeg command still works with this file." : "Could not play " + (reviewFileName || "this file") + ". If OBS was still finishing it when you opened it, open it again; if it still fails, set OBS to Hybrid MP4 (or MP4) with H.264 video.", { warn: true });
|
|
3900
5509
|
});
|
|
3901
5510
|
async function stableFile(handle) {
|
|
3902
5511
|
rvOpening = true;
|
|
@@ -3923,10 +5532,9 @@
|
|
|
3923
5532
|
rvVideo.src = URL.createObjectURL(file);
|
|
3924
5533
|
reviewFileName = file.name;
|
|
3925
5534
|
document.getElementById("rv-novideo").hidden = true;
|
|
3926
|
-
|
|
5535
|
+
say("Loaded " + file.name + ". Click a take to preview it.");
|
|
3927
5536
|
if (pendingPlay) playRange(pendingPlay);
|
|
3928
5537
|
else if (retry && playlist) playRange(playlist.ranges.slice(playlist.i));
|
|
3929
|
-
if (reviewing) document.getElementById("rv-ffmpeg").value = ffmpegScript2(reviewing, document.getElementById("rv-mode").value);
|
|
3930
5538
|
}
|
|
3931
5539
|
var fileInput = document.getElementById("rv-file-input");
|
|
3932
5540
|
fileInput.addEventListener("change", () => {
|
|
@@ -3937,28 +5545,26 @@
|
|
|
3937
5545
|
if (!window.showOpenFilePicker) return fileInput.click();
|
|
3938
5546
|
try {
|
|
3939
5547
|
const [handle] = await window.showOpenFilePicker({ id: "obs-recordings", types: [{ description: "Recordings", accept: { "video/*": [".mov", ".mp4", ".m4v", ".mkv", ".webm"] } }] });
|
|
3940
|
-
|
|
5548
|
+
say("Opening " + handle.name + "\u2026");
|
|
3941
5549
|
useRecording(await stableFile(handle), handle);
|
|
3942
5550
|
} catch (e) {
|
|
3943
|
-
if (!e || e.name !== "AbortError")
|
|
5551
|
+
if (!e || e.name !== "AbortError") say("Could not open that file.", { warn: true });
|
|
3944
5552
|
}
|
|
3945
5553
|
};
|
|
3946
5554
|
var folderBtn = document.getElementById("rv-folder");
|
|
3947
|
-
folderBtn.
|
|
5555
|
+
if (!window.showDirectoryPicker) folderBtn.style.display = "none";
|
|
3948
5556
|
folderBtn.onclick = async () => {
|
|
3949
5557
|
const name = reviewing && baseName(reviewing.outputPath);
|
|
3950
5558
|
try {
|
|
3951
5559
|
const dir = await window.showDirectoryPicker({ id: "obs-recordings", mode: "read" });
|
|
3952
5560
|
kvSet("obs-folder", dir);
|
|
3953
5561
|
if (!name) {
|
|
3954
|
-
|
|
5562
|
+
say("Folder remembered. This session has no file name from OBS; open the file instead.");
|
|
3955
5563
|
return;
|
|
3956
5564
|
}
|
|
3957
5565
|
const handle = await dir.getFileHandle(name);
|
|
3958
5566
|
useRecording(await stableFile(handle), handle);
|
|
3959
5567
|
} catch (e) {
|
|
3960
|
-
if (e && e.name === "AbortError") return;
|
|
3961
|
-
rvNow.textContent = (name ? name + " is not in that folder" : "Could not read that folder") + ". Use \u201COpen the recording file\u2026\u201D instead.";
|
|
3962
5568
|
}
|
|
3963
5569
|
};
|
|
3964
5570
|
async function autoLoadRecording(sess) {
|
|
@@ -3969,21 +5575,11 @@
|
|
|
3969
5575
|
const dir = await kvGet("obs-folder");
|
|
3970
5576
|
if (!dir || await dir.queryPermission({ mode: "read" }) !== "granted") return;
|
|
3971
5577
|
const handle = await dir.getFileHandle(name);
|
|
3972
|
-
|
|
5578
|
+
say("Opening " + name + "\u2026");
|
|
3973
5579
|
useRecording(await stableFile(handle), handle);
|
|
3974
5580
|
} catch (e) {
|
|
3975
5581
|
}
|
|
3976
5582
|
}
|
|
3977
|
-
document.getElementById("rv-download").onclick = () => {
|
|
3978
|
-
if (!reviewing) return;
|
|
3979
|
-
const sess = reviewing, ch = finalChapters2(sess);
|
|
3980
|
-
const text = "# " + document.getElementById("rv-yt-title").value + "\n\nRecorded " + new Date(sess.date).toLocaleString() + (sess.outputPath ? " \xB7 " + sess.outputPath : "") + " \xB7 final length " + fmtTime(ch.length) + "\n\n## Render\n\n```sh\n" + document.getElementById("rv-ffmpeg").value + "\n```\n\n## YouTube title\n\n" + document.getElementById("rv-yt-title").value + "\n\n## YouTube description\n\n" + document.getElementById("rv-yt-desc").value + "\n\n## Tags\n\n" + document.getElementById("rv-yt-tags").value + "\n\n## Picked takes\n\n" + pickedRanges(sess).map((r) => "- " + fmtTime(r.start) + "\u2013" + fmtTime(r.end) + " " + r.title).join("\n") + "\n";
|
|
3981
|
-
const a = document.createElement("a");
|
|
3982
|
-
a.href = URL.createObjectURL(new Blob([text], { type: "text/markdown" }));
|
|
3983
|
-
a.download = sessionKey() + "-publish.md";
|
|
3984
|
-
a.click();
|
|
3985
|
-
setTimeout(() => URL.revokeObjectURL(a.href), 1e3);
|
|
3986
|
-
};
|
|
3987
5583
|
if (loadObsSettings() && new URLSearchParams(location.search).get("obs")) connectObs();
|
|
3988
5584
|
var camBtn = document.getElementById("btn-camera");
|
|
3989
5585
|
var pipMsg = document.getElementById("pip-msg");
|
|
@@ -4040,7 +5636,8 @@
|
|
|
4040
5636
|
camBtn.disabled = true;
|
|
4041
5637
|
showPipMsg("Waiting for camera permission \u2014 check the browser prompt near the address bar.", true);
|
|
4042
5638
|
try {
|
|
4043
|
-
|
|
5639
|
+
const camId = load("slidetake:cam");
|
|
5640
|
+
cameraStream = await navigator.mediaDevices.getUserMedia({ video: { ...camId ? { deviceId: { ideal: camId } } : {}, width: { ideal: 1920 }, height: { ideal: 1080 }, frameRate: { ideal: 30 } }, audio: false });
|
|
4044
5641
|
hidePipMsg();
|
|
4045
5642
|
} catch (e) {
|
|
4046
5643
|
const name = e && e.name;
|
|
@@ -4069,13 +5666,17 @@
|
|
|
4069
5666
|
refocus();
|
|
4070
5667
|
}
|
|
4071
5668
|
var CAMERA_ICON = '<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round" aria-hidden="true"><rect x="2" y="6" width="14" height="12" rx="2"/><path d="M16 10.5 22 7v10l-6-3.5z"/></svg>';
|
|
5669
|
+
function lightUp(btn, on) {
|
|
5670
|
+
btn.classList.toggle("on", on);
|
|
5671
|
+
btn.setAttribute("aria-pressed", String(on));
|
|
5672
|
+
}
|
|
4072
5673
|
function updateCamBtn() {
|
|
4073
5674
|
if (!camBtn.querySelector("svg")) camBtn.innerHTML = CAMERA_ICON + '<span class="lbl"> Camera</span>';
|
|
4074
5675
|
camBtn.classList.toggle("on", !cameraOff);
|
|
4075
5676
|
camBtn.setAttribute("aria-pressed", String(!cameraOff));
|
|
4076
5677
|
camBtn.title = cameraOff ? "Camera is off for every slide (C)" : "Camera is on and follows the deck (C)";
|
|
4077
5678
|
}
|
|
4078
|
-
function setCameraEnabled(on) {
|
|
5679
|
+
function setCameraEnabled(on, quiet) {
|
|
4079
5680
|
if (on && !RECORDING_UI) return;
|
|
4080
5681
|
cameraOff = !on;
|
|
4081
5682
|
if (cameraOff) {
|
|
@@ -4090,7 +5691,7 @@
|
|
|
4090
5691
|
applyStepState();
|
|
4091
5692
|
updateActivePath();
|
|
4092
5693
|
refocus();
|
|
4093
|
-
if (!presenting) showPipMsg(on ? "Camera on \u2014 slides follow their camera settings." : "Camera off \u2014 camera settings are ignored and slides use the whole screen.");
|
|
5694
|
+
if (!presenting && !quiet) showPipMsg(on ? "Camera on \u2014 slides follow their camera settings." : "Camera off \u2014 camera settings are ignored and slides use the whole screen.");
|
|
4094
5695
|
if (on) startWebcam();
|
|
4095
5696
|
}
|
|
4096
5697
|
camBtn.onclick = () => setCameraEnabled(cameraOff);
|
|
@@ -4108,6 +5709,12 @@
|
|
|
4108
5709
|
else if (presenting) setPresent(false);
|
|
4109
5710
|
});
|
|
4110
5711
|
var help = document.getElementById("help");
|
|
5712
|
+
new MutationObserver(() => lightUp(document.getElementById("btn-keys"), help.classList.contains("open"))).observe(help, { attributes: true, attributeFilter: ["class"] });
|
|
5713
|
+
new MutationObserver(() => {
|
|
5714
|
+
const open = reviewDialog.classList.contains("open");
|
|
5715
|
+
document.getElementById("btn-studio").classList.toggle("active", open);
|
|
5716
|
+
if (!open && !rvVideo.paused) rvVideo.pause();
|
|
5717
|
+
}).observe(reviewDialog, { attributes: true, attributeFilter: ["class"] });
|
|
4111
5718
|
document.getElementById("btn-keys").onclick = () => help.classList.add("open");
|
|
4112
5719
|
document.getElementById("help-close").onclick = () => help.classList.remove("open");
|
|
4113
5720
|
help.addEventListener("click", (e) => {
|
|
@@ -4116,7 +5723,7 @@
|
|
|
4116
5723
|
window.addEventListener("keydown", (e) => {
|
|
4117
5724
|
if (e.key === "F5") {
|
|
4118
5725
|
e.preventDefault();
|
|
4119
|
-
if (!rec.active)
|
|
5726
|
+
if (!rec.active) openTakes();
|
|
4120
5727
|
return;
|
|
4121
5728
|
}
|
|
4122
5729
|
if (rec.active) {
|
|
@@ -4157,7 +5764,7 @@
|
|
|
4157
5764
|
} else if (k === "f" || k === "F" || k === "p" || k === "P") {
|
|
4158
5765
|
setPresent(!presenting);
|
|
4159
5766
|
} else if (k === "r" || k === "R") {
|
|
4160
|
-
|
|
5767
|
+
openTakes();
|
|
4161
5768
|
} else if (/^[1-4]$/.test(k)) {
|
|
4162
5769
|
setMode(LAYOUTS[+k - 1]);
|
|
4163
5770
|
} else if (k === "c" || k === "C") {
|