UI namespace of WebViewer Video
Example
WebViewer(...)
.then(function(instance) {
const license = '---- Insert commercial license key here after purchase ----';
const videoInstance = await initializeVideoViewer(
instance,
{
license,
},
);
videoInstance.UI.updateElement('redactApplyButton', {
onClick: (redactAnnotations) => {
// custom code here
}
});
});
Methods
-
<static> enableCompareMode()
-
Enables frame by frame comparison of videos
Returns:
- Type
- void
Example
WebViewer(...) .then(function(instance) { const license = '---- Insert commercial license key here after purchase ----'; const videoInstance = await initializeVideoViewer( instance, { license, }, ); await videoInstance.UI.enableCompareMode(); }); -
<static> getFrames(framesToGet)
-
Asynchronously retrieves frames from the loaded video in WebViewer Video
Parameters:
Name Type Description framesToGetArray.<number> an array of frame numbers to retrieve Returns:
Returns a map of the frames as type HTMLCanvasElement.- Type
- Object
Example
WebViewer(...) .then(function(instance) { const license = '---- Insert commercial license key here after purchase ----'; const videoInstance = await initializeVideoViewer( instance, { license, }, ); const documentViewer = instance.Core.documentViewer; documentViewer.addEventListener('videoElementReady', async () => { const frames = await videoInstance.UI.getFrames([0, 125]); // YOUR CODE HERE }); }); -
<static> loadCompareVideoA(url, options)
-
Loads a video for the first video instance in compare mode
Parameters:
Name Type Description urlstring | Blob | File The video url or video file or video blob optionsObject Optional options object Properties
Name Type Argument Default Description fileNamestring <optional>
Name of the file. URLs without an extension need this property set headersObject <optional>
Custom headers to attach when making http requests to provided URL withCredentialsObject <optional>
false CORS requests for this element will have the credentials flag set to 'include' generatedPeaksArray <optional>
null An array of pre-generated peaks for corresponding video file useShakaPlayerboolean <optional>
true Runs shaka player integration instead of HTML video fpsnumber <optional>
null Sets the frames per second of the video. Usually retrieved automatically, but this option may be used incase that fails. Returns:
- Type
- void
Example
WebViewer(...) .then(function(instance) { const license = '---- Insert commercial license key here after purchase ----'; const videoInstance = await initializeVideoViewer( instance, { license, }, ); await videoInstance.UI.enableCompareMode(); videoInstance.UI.loadCompareVideoA(videoUrl); }); -
<static> loadCompareVideoB(url, options)
-
Loads a video for the second video instance in compare mode
Parameters:
Name Type Description urlstring | Blob | File The video url or video file or video blob optionsObject Optional options object Properties
Name Type Argument Default Description fileNamestring <optional>
Name of the file. URLs without an extension need this property set headersObject <optional>
Custom headers to attach when making http requests to provided URL withCredentialsObject <optional>
false CORS requests for this element will have the credentials flag set to 'include' generatedPeaksArray <optional>
null An array of pre-generated peaks for corresponding video file useShakaPlayerboolean <optional>
true Runs shaka player integration instead of HTML video fpsnumber <optional>
null Sets the frames per second of the video. Usually retrieved automatically, but this option may be used incase that fails. Returns:
- Type
- void
Example
WebViewer(...) .then(function(instance) { const license = '---- Insert commercial license key here after purchase ----'; const videoInstance = await initializeVideoViewer( instance, { license, }, ); await videoInstance.UI.enableCompareMode(); videoInstance.UI.loadCompareVideoA(videoUrl); window.addEventListener( 'documentViewer2Ready', () => { videoInstance.UI.loadCompareVideoB(videoUrl); }, { once: true }, ); }); -
<static> updateElement(dataElement, props)
-
Update an WebViewer Video element in the viewer. Valid options are 'redactApplyButton'.
Parameters:
Name Type Description dataElementstring the data element of the element that will be updated. propsobject an object that is used to override an existing item's properties. Example
WebViewer(...) .then(function(instance) { const license = '---- Insert commercial license key here after purchase ----'; const videoInstance = await initializeVideoViewer( instance, { license, }, ); videoInstance.UI.updateElement('redactApplyButton', { onClick: (redactAnnotations) => { // custom code here } }); });