Files
Atay-Makhzan/web_src/js/markup/asciicast.ts
T

17 lines
652 B
TypeScript
Raw Normal View History

2025-04-05 11:56:48 +08:00
import {queryElems} from '../utils/dom.ts';
2025-04-05 11:56:48 +08:00
export async function initMarkupRenderAsciicast(elMarkup: HTMLElement): Promise<void> {
queryElems(elMarkup, '.asciinema-player-container', async (el) => {
const [player] = await Promise.all([
2026-03-29 12:24:30 +02:00
import('asciinema-player'),
import('asciinema-player/dist/bundle/asciinema-player.css'),
2025-04-05 11:56:48 +08:00
]);
2026-02-02 01:00:34 +08:00
player.create(el.getAttribute('data-asciinema-player-src')!, el, {
2025-04-05 11:56:48 +08:00
// poster (a preview frame) to display until the playback is started.
// Set it to 1 hour (also means the end if the video is shorter) to make the preview frame show more.
poster: 'npt:1:0:0',
});
});
}