JSPM

  • Created
  • Published
  • Downloads 4422
  • Score
    100M100P100Q140638F
  • License ISC

This is an addon for WebViewer that allows loading HTML5 videos (.mp4, ogg, webm) so that their video frames can be annotated.

Package Exports

  • @pdftron/webviewer-video

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@pdftron/webviewer-video) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

WebViewer Video

WebViewer is a powerful JavaScript-based PDF Library that's part of the PDFTron PDF SDK. It allows you to view and annotate PDF files on your web app with a fully customizable UI.

This is an addon for WebViewer that allows loading HTML5 videos (.mp4, ogg, webm) so that their video frames can be annotated. For more information, see this guide.

WebViewer

Also, try out the react sample here. This is a good starting point. It shows how to integrate WebViewer and video with react and server component for saving of annoations.

Initial setup

Before you begin, make sure your development environment includes Node.js and npm.

Install

npm install @pdftron/webviewer-video

How to use

import WebViewer from '@pdftron/webviewer';
import { initializeVideoViewer } from '@pdftron/webviewer-video';

WebViewer({
    path: 'lib',
    css: 'styles.css',
    disabledElements: [
        'searchButton',
        'pageNavOverlay',
        'viewControlsButton',
        'panToolButton',
    ],
}, document.getElementById('viewer'))
    .then(async(instance) => {
        // Extends WebViewer to allow loading HTML5 videos (.mp4, ogg, webm).
        const {
            loadVideo,
            loadVideoUI,
        } = await initializeVideoViewer(
            instance,
            '---- Insert commercial license key here after purchase ----',
        );

        // Attaches the video player UI
        loadVideoUI();

        // Load a video at a specific url
        // Can be a local or public link
        const videoUrl = './video.mp4';
        const thumbnail = './thumbnail.jpg';
        loadVideo(videoUrl, thumbnail);
    });

loadVideoUI attaches the video player UI to WebViewer. If you would like to modify this UI then copy the code from node_modules/@pdftron/webviewer-video/src/loadVideoUI.js, into your project.

Documentation

See @pdftron/webviewer-video API documentation.
See Video Class API documentation.

License

WebViewer Video will run in trial mode until a license is provided. For more information on licensing, please visit our website.