@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
91 lines (88 loc) • 2.23 kB
JavaScript
'use strict';
var base = require('../base');
class Media extends base.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;
}
}
exports.CaptionSource = CaptionSource;
exports.Media = Media;
exports.MediaSource = MediaSource;
//# sourceMappingURL=media.js.map
//# sourceMappingURL=media.js.map