# All files / src/components VideoDemo.tsx

11.53% Statements 3/26
0% Branches 0/6
0% Functions 0/3
11.53% Lines 3/26

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
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401

    1x

    1x

    1x

     import React from "react";
    import {
      AbsoluteFill,
      OffthreadVideo,
      staticFile,
      useCurrentFrame,
      useVideoConfig,
      interpolate,
      spring,
      Easing,
    } from "remotion";
    import { z } from "zod";
    import { getVideoMetadata } from "@remotion/media-utils";

    /**
     * VideoDemo - Terminal-first 10-second demo component
     *
     * Design Philosophy:
     * - Terminal is the HERO - never obscured, always center stage
     * - Overlays FRAME the terminal (top bar + bottom bar)
     * - Subtle glass morphism for professional look
     * - Video-driven duration via calculateMetadata
     *
     * Timeline (10s example):
     * ┌────────────────────────────────────────┐
     * │ TOP BAR: Skill name + hook (0-3s)      │
     * ├────────────────────────────────────────┤
     * │                                        │
     * │         TERMINAL VIDEO (0-10s)         │
     * │         Always visible, hero           │
     * │                                        │
     * ├────────────────────────────────────────┤
     * │ BOTTOM BAR: Results → CTA (7-10s)      │
     * └────────────────────────────────────────┘
     */

    export const videoDemoSchema = z.object({
      skillName: z.string(),
      hook: z.string(),
      terminalVideo: z.string(),
      problemPoints: z.array(z.string()).default([
        "Manual processes slow you down",
        "Context switching kills productivity",
      ]),
      results: z.object({
        before: z.string(),
        after: z.string(),
      }).default({
        before: "Hours of manual work",
        after: "Minutes with OrchestKit",
      }),
      stats: z.array(z.object({
        value: z.string(),
        label: z.string(),
        color: z.string().optional(),
      })).default([
        { value: "169", label: "skills", color: "#8b5cf6" },
        { value: "35", label: "agents", color: "#22c55e" },
        { value: "148", label: "hooks", color: "#f59e0b" },
      ]),
      cta: z.string().default("/plugin install ork"),
      primaryColor: z.string().default("#8b5cf6"),
      ccVersion: z.string().default("CC 2.1.16"),
    });

    type VideoDemoProps = z.infer<typeof videoDemoSchema>;

    // Calculate duration from video file (video is source of truth)
    export const calculateVideoDemoMetadata = async ({
      props,
    }: {
      props: VideoDemoProps;
    }) => {
      try {
        const metadata = await getVideoMetadata(staticFile(props.terminalVideo));
        // Video duration IS the composition duration (overlays happen DURING video)
        return {
          durationInFrames: Math.ceil(metadata.durationInSeconds * 30),
          fps: 30,
          width: 1920,
          height: 1080,
        };
      } catch {
        // Fallback to default duration if video metadata unavailable
        return {
          durationInFrames: 300, // 10s default
          fps: 30,
          width: 1920,
          height: 1080,
        };
      }
    };

    export const VideoDemo: React.FC<VideoDemoProps> = ({
      skillName,
      hook,
      terminalVideo,
      results,
      stats,
      cta,
      primaryColor,
      ccVersion,
    }) => {
      const frame = useCurrentFrame();
      const { durationInFrames, fps } = useVideoConfig();

      // Timeline for ~8-10s video:
      // FLOATING PANEL: 0-120 frames (0-4s) - slides in from right, holds, fades
      // STATS COUNTERS: Stagger in 30-90 frames on the left side
      // BOTTOM BAR: Last 3s - results then CTA
      const PANEL_IN = 0;
      const PANEL_VISIBLE = 20;
      const PANEL_OUT = 100;
      const PANEL_GONE = 120;

      const BOTTOM_BAR_IN = durationInFrames - 90;
      const BOTTOM_BAR_VISIBLE = BOTTOM_BAR_IN + 15;
      const CTA_SWAP = durationInFrames - 45;

      // Intro overlay opacity (fades in, holds, fades out)
      const panelOpacity = interpolate(
        frame,
        [PANEL_IN, PANEL_VISIBLE, PANEL_OUT, PANEL_GONE],
        [0, 1, 1, 0],
        { extrapolateLeft: "clamp", extrapolateRight: "clamp" }
      );

      // Bottom bar slide animation
      const bottomBarY = interpolate(
        frame,
        [BOTTOM_BAR_IN, BOTTOM_BAR_VISIBLE],
        [60, 0],
        { extrapolateLeft: "clamp", extrapolateRight: "clamp", easing: Easing.out(Easing.cubic) }
      );

      const bottomBarOpacity = interpolate(
        frame,
        [BOTTOM_BAR_IN, BOTTOM_BAR_VISIBLE],
        [0, 1],
        { extrapolateLeft: "clamp", extrapolateRight: "clamp" }
      );

      // Results → CTA transition
      const showCTA = frame >= CTA_SWAP;
      const resultsOpacity = interpolate(
        frame,
        [CTA_SWAP - 10, CTA_SWAP],
        [1, 0],
        { extrapolateLeft: "clamp", extrapolateRight: "clamp" }
      );
      const ctaOpacity = interpolate(
        frame,
        [CTA_SWAP, CTA_SWAP + 10],
        [0, 1],
        { extrapolateLeft: "clamp", extrapolateRight: "clamp" }
      );

      // Progress bar
      const progress = frame / durationInFrames;

      // Spring animation for skill badge
      const badgeScale = spring({
        frame,
        fps,
        config: { damping: 15, stiffness: 120 },
      });

      return (
        <AbsoluteFill style={{ backgroundColor: "#0a0a0f" }}>
          {/* Layer 0: Terminal Video - FULL SCREEN HERO */}
          <AbsoluteFill>
            <OffthreadVideo
              src={staticFile(terminalVideo)}
              style={{
                width: "100%",
                height: "100%",
                objectFit: "contain",
              }}
            />
          </AbsoluteFill>

          {/* Layer 1: INTRO OVERLAY - Center, fades with video start */}
          <AbsoluteFill
            style={{
              justifyContent: "center",
              alignItems: "center",
              opacity: panelOpacity,
              pointerEvents: "none",
            }}
          >
            <div
              style={{
                display: "flex",
                flexDirection: "column",
                alignItems: "center",
                gap: 16,
                padding: "32px 48px",
                backgroundColor: "rgba(10, 10, 20, 0.92)",
                borderRadius: 20,
                border: `1px solid ${primaryColor}40`,
                boxShadow: `0 24px 80px rgba(0,0,0,0.6), 0 0 60px ${primaryColor}20`,
                backdropFilter: "blur(16px)",
                transform: `scale(${badgeScale})`,
              }}
            >
              {/* Version badge */}
              <span
                style={{
                  fontSize: 11,
                  color: "#6b7280",
                  fontFamily: "Menlo, monospace",
                  letterSpacing: "0.15em",
                  textTransform: "uppercase",
                }}
              >
                {ccVersion}
              </span>

              {/* Skill name with glow */}
              <code
                style={{
                  fontSize: 36,
                  color: primaryColor,
                  fontFamily: "Menlo, monospace",
                  fontWeight: 700,
                  textShadow: `0 0 40px ${primaryColor}60`,
                }}
              >
                /{skillName}
              </code>

              {/* Hook text */}
              <span
                style={{
                  fontSize: 18,
                  color: "rgba(255,255,255,0.9)",
                  fontFamily: "Inter, system-ui",
                  fontWeight: 500,
                }}
              >
                {hook}
              </span>

              {/* Stats row */}
              <div
                style={{
                  display: "flex",
                  gap: 24,
                  marginTop: 8,
                }}
              >
                {stats.map((stat, i) => (
                  <div
                    key={i}
                    style={{
                      display: "flex",
                      alignItems: "baseline",
                      gap: 6,
                      opacity: interpolate(
                        frame,
                        [15 + i * 8, 25 + i * 8],
                        [0, 1],
                        { extrapolateLeft: "clamp", extrapolateRight: "clamp" }
                      ),
                    }}
                  >
                    <span
                      style={{
                        fontSize: 24,
                        fontWeight: 700,
                        color: stat.color || primaryColor,
                        fontFamily: "Menlo, monospace",
                      }}
                    >
                      {stat.value}
                    </span>
                    <span
                      style={{
                        fontSize: 12,
                        color: "#9ca3af",
                        fontFamily: "Inter, system-ui",
                      }}
                    >
                      {stat.label}
                    </span>
                  </div>
                ))}
              </div>
            </div>
          </AbsoluteFill>

          {/* Layer 2: BOTTOM BAR - Results then CTA (end of video) */}
          <div
            style={{
              position: "absolute",
              bottom: 4,
              left: 0,
              right: 0,
              transform: `translateY(${bottomBarY}px)`,
              opacity: bottomBarOpacity,
              display: "flex",
              alignItems: "center",
              justifyContent: "center",
              padding: "14px 40px",
              background: "linear-gradient(0deg, rgba(10,10,15,0.95) 0%, rgba(10,10,15,0.85) 60%, transparent 100%)",
            }}
          >
            {/* Results (fades out) */}
            <div
              style={{
                display: "flex",
                alignItems: "center",
                gap: 24,
                opacity: resultsOpacity,
                position: showCTA ? "absolute" : "relative",
              }}
            >
              <div style={{ display: "flex", alignItems: "center", gap: 10 }}>
                <span style={{ fontSize: 16, color: "#ef4444" }}>✗</span>
                <span style={{ fontSize: 17, color: "#9ca3af", fontFamily: "Inter, system-ui" }}>
                  {results.before}
                </span>
              </div>

              <span style={{ fontSize: 22, color: "#22c55e" }}>→</span>

              <div style={{ display: "flex", alignItems: "center", gap: 10 }}>
                <span style={{ fontSize: 16, color: "#22c55e" }}>✓</span>
                <span style={{ fontSize: 17, color: "#22c55e", fontFamily: "Inter, system-ui", fontWeight: 600 }}>
                  {results.after}
                </span>
              </div>
            </div>

            {/* CTA (fades in) */}
            <div
              style={{
                opacity: ctaOpacity,
                padding: "12px 32px",
                background: `linear-gradient(135deg, ${primaryColor} 0%, #6366f1 100%)`,
                borderRadius: 12,
                boxShadow: `0 12px 40px ${primaryColor}50`,
                position: showCTA ? "relative" : "absolute",
              }}
            >
              <code
                style={{
                  fontSize: 20,
                  color: "white",
                  fontFamily: "Menlo, monospace",
                  fontWeight: 600,
                }}
              >
                {cta}
              </code>
            </div>
          </div>

          {/* Layer 3: Watermark - top right, visible when overlay gone */}
          <div
            style={{
              position: "absolute",
              top: 16,
              right: 24,
              opacity: interpolate(frame, [PANEL_GONE, PANEL_GONE + 15], [0, 0.4], { extrapolateLeft: "clamp", extrapolateRight: "clamp" }),
            }}
          >
            <span
              style={{
                fontSize: 12,
                color: "rgba(255,255,255,0.6)",
                fontFamily: "Menlo, monospace",
              }}
            >
              OrchestKit
            </span>
          </div>

          {/* Layer 4: Progress Bar */}
          <div
            style={{
              position: "absolute",
              bottom: 0,
              left: 0,
              right: 0,
              height: 3,
              backgroundColor: "rgba(255,255,255,0.1)",
            }}
          >
            <div
              style={{
                height: "100%",
                width: `${progress * 100}%`,
                background: `linear-gradient(90deg, ${primaryColor}, #6366f1)`,
              }}
            />
          </div>
        </AbsoluteFill>
      );
    };