// MIT. Portable, typed React + TypeScript component for the published Media Studio film.
// Drop this file into any React project. React is the only dependency.
// The video, poster, English captions and credit are the exact approved release.
// Published media SHA-256: 187134b76dc0687d95e263d7b3bb2b7cf6507affb4204e61c2badaeff567d046
import * as React from 'react';

export const filmTitle = "Take it with you";
const watchUrl = "https://media.loftwah.com/p/PbvQYtyGG-YlF0Dh";
const videoUrl = "https://media.loftwah.com/p/PbvQYtyGG-YlF0Dh/media";
const posterUrl = "https://media.loftwah.com/p/PbvQYtyGG-YlF0Dh/thumb";
const captionTrackUrl = "data:text/vtt;charset=utf-8,WEBVTT%0A%0A00%3A00.000%20--%3E%2000%3A00.600%20line%3A12%25%0A%5BA%20sharp%20click%5D%0A%0A00%3A00.600%20--%3E%2000%3A02.050%20line%3A12%25%0ABring%20your%20AI%20agent.%0A%0A00%3A02.050%20--%3E%2000%3A03.650%20line%3A12%25%0ABuild%20an%20app.%0A%0A00%3A03.850%20--%3E%2000%3A07.700%20line%3A12%25%0A%5BPower-up%20chime%5D%0ATake%20it%20with%20you.%0A";

export interface TakeItWithYouFilmProps {
  className?: string;
  style?: React.CSSProperties;
  label?: string;
}

// Plain render function: no effects, no browser globals, so it is identical on
// the server and in the browser. Native controls play the source on request.
export function TakeItWithYouFilm({
  className,
  style,
  label = filmTitle + ', an App Composer commercial',
}: TakeItWithYouFilmProps = {}): React.ReactElement {
  return (
    <figure className={className} style={{ margin: 0, ...style }}>
      <video
        controls
        playsInline
        preload="none"
        width={1280}
        height={720}
        poster={posterUrl}
        aria-label={label}
        style={{ display: 'block', maxWidth: '100%', height: 'auto', background: '#000' }}
      >
        <source src={videoUrl} type="video/mp4" />
        <track kind="captions" src={captionTrackUrl} srcLang="en" label="English captions" default />
        Your browser does not support HTML video. <a href={watchUrl}>Watch {filmTitle} on Media Studio</a>.
      </video>
      <figcaption>
        Produced in ElevenCreative from App Composer and Woodhouse references.{' '}
        <a href={watchUrl}>Watch the published film on Media Studio</a>.
      </figcaption>
    </figure>
  );
}

export default TakeItWithYouFilm;
