UNPKG

imsc

Version:

Renders IMSC documents to HTML5 fragments

44 lines • 2.75 kB
/** * Function that maps <pre>smpte:background</pre> URIs to URLs resolving to image resource * @callback IMGResolver * @param {string} value <pre>smpte:background</pre> URI * @return {string} PNG resource URL */ /** * Renders an ISD object (returned by <pre>generateISD()</pre>) into a * parent element, that must be attached to the DOM. The ISD will be rendered * into a child <pre>div</pre> * with heigh and width equal to the clientHeight and clientWidth of the element, * unless explicitly specified otherwise by the caller. Images URIs specified * by <pre>smpte:background</pre> attributes are mapped to image resource URLs * by an <pre>imgResolver</pre> function. The latter takes the value of <code>smpte:background</code> * attribute and an <code>img</code> DOM element as input, and is expected to * set the <code>src</code> attribute of the <code>img</code> to the absolute URI of the image. * <pre>displayForcedOnlyMode</pre> sets the (boolean) * value of the IMSC1 displayForcedOnlyMode parameter. The function returns * an opaque object that should passed in <code>previousISDState</code> when this function * is called for the next ISD, otherwise <code>previousISDState</code> should be set to * <code>null</code>. * * @param {ISD} isd ISD to be rendered * @param {HTMLElement} element Element into which the ISD is rendered * @param {?IMGResolver} imgResolver Resolve <pre>smpte:background</pre> URIs into URLs. * @param {?number} eheight Height (in pixel) of the child <div>div</div> or null * to use clientHeight of the parent element * @param {?number} ewidth Width (in pixel) of the child <div>div</div> or null * to use clientWidth of the parent element * @param {?boolean} displayForcedOnlyMode Value of the IMSC1 displayForcedOnlyMode parameter, * or false if null * @param {?ErrorHandler} errorHandler Error callback * @param {ISD} previousISDState State saved during processing of the previous ISD, or null if initial call * @param {?boolean} enableRollUp Enables roll-up animations (see CEA 708) * @return {ISD} ISD state to be provided when this function is called for the next ISD */ export function renderHTML(isd: ISD, element: HTMLElement, imgResolver: IMGResolver | null, eheight: number | null, ewidth: number | null, displayForcedOnlyMode: boolean | null, errorHandler: ErrorHandler | null, previousISDState: ISD, enableRollUp: boolean | null): ISD; /** * Function that maps <pre>smpte:background</pre> URIs to URLs resolving to image resource */ export type IMGResolver = (value: string) => string; export type ISD = import("./isd").ISD; export type ErrorHandler = import("./error").ErrorHandler; //# sourceMappingURL=html.d.ts.map