UNPKG

@microsoft/teams.cards

Version:

<p> <a href="https://www.npmjs.com/package/@microsoft/teams.cards" target="_blank"> <img src="https://img.shields.io/npm/v/@microsoft/teams.cards" /> </a> <a href="https://www.npmjs.com/package/@microsoft/teams.cards?activeTab=code" ta

87 lines (85 loc) 2.17 kB
import { Element } from '../base'; class Media extends Element { type; /** * Array of media sources to attempt to play. */ sources; /** * URL of an image to display before playing. Supports data URI in version 1.2+. If poster is omitted, the Media element will either use a default poster (controlled by the host application) or will attempt to automatically pull the poster from the target video service when the source URL points to a video from a Web provider such as YouTube. */ poster; /** * Alternate text describing the audio or video. */ altText; /** * Array of captions sources for the media element to provide. */ captionSources; constructor(...sources) { super(); this.type = "Media"; this.sources = sources; } static from(options) { const media = new Media(...options.sources); Object.assign(media, options); return media; } withPoster(value) { this.poster = value; return this; } withAltText(value) { this.altText = value; return this; } addSources(...value) { this.sources.push(...value); return this; } addCaptionSources(...value) { if (!this.captionSources) { this.captionSources = []; } this.captionSources.push(...value); return this; } } class MediaSource { /** * URL to media. Supports data URI in version 1.2+ */ url; /** * Mime type of associated media (e.g. "video/mp4"). For YouTube and other Web video URLs, mimeType can be omitted. */ mimeType; constructor(url, mimeType) { this.url = url; this.mimeType = mimeType; } } class CaptionSource { /** * Label of this caption to show to the user. */ label; /** * URL to captions. */ url; /** * Mime type of associated caption file (e.g. "vtt"). For rendering in JavaScript, only "vtt" is supported, for rendering in UWP, "vtt" and "srt" are supported. */ mimeType; constructor(label, url, mimeType) { this.label = label; this.url = url; this.mimeType = mimeType; } } export { CaptionSource, Media, MediaSource }; //# sourceMappingURL=media.mjs.map //# sourceMappingURL=media.mjs.map