All files / app/mods/media video.ts

100% Statements 3/3
100% Branches 0/0
100% Functions 0/0
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69125x       125x                                                                                                                     125x          
import { DateTime } from 'luxon';
import { Plugin } from '../../model/plugin';
import { Mod } from '../../model/tag';
 
export const videoPlugin: Plugin = {
  tag: 'plugin/video',
  name: $localize`🎞️ Video`,
  config: {
    version: 3,
    type: 'plugin',
    default: true,
    proxy: true,
    add: true,
    embeddable: true,
    generated: $localize`Generated by jasper-ui ${DateTime.now().toISO()}`,
    aiInstructions: ` # plugin/video
    The video plugin indicates a Ref contains a video file. It contains optional
    field url which is typically missing. When the url field is missing it is
    assumed to be the URL of the Ref instead.
    Put each generated video in a separate Ref after the first response Ref and
    tag it plugin/video. Set that Ref's URL to ai:part1, ai:part2, and so on,
    matching the returned assets in order. Never use unnumbered ai:part.
    Embed the video Ref from the first response comment with ![=](ai:partN), or
    link to it with [video](/ref/ai:partN). Normally omit plugin/video.url when
    the Ref's own URL is ai:partN; use the plugin url only when the media differs
    from the Ref URL. Never reference an ai:partN that was not actually returned.
    Claimed assets are uploaded and matching references are rewritten. Other URLs
    refer to existing resources and are not replaced.
    `,
    submit: $localize`🎞️ video`,
    icons: [{ label: $localize`🎞️`, order: 2 }],
    filters: [
      { query: 'plugin/video', label: $localize`🎞️ video`, title: $localize`Videos`, group: $localize`Media 🎬️` },
    ],
    extensions: ['.3gp', '.mpg', '.mpeg', '.mp4', '.m4v', '.m4p', '.webm', '.ogv', '.m3u8', '.mov'],
    description: $localize`Play in a video player.
 
Keyboard shortcuts (when viewer is focused):
Space / K: Play/pause
J / L: Seek ±10s
← / →: Seek ±5s
↑ / ↓: Volume ±5%
M: Mute toggle
Home / End: Jump to start/end
0–9: Percentage seek
F: Fullscreen toggle
, / .: Frame step back/forward (while paused)`,
    advancedForm: [{
      key: 'url',
      type: 'video',
      props: {
        label: $localize`URL:`,
      },
    }],
  },
  defaults: {},
  schema: {
    optionalProperties: {
      url: { type: 'string' },
    },
  },
};
 
export const videoMod: Mod = {
  plugin: [
    videoPlugin,
  ],
};