Some test text!

menu
Make your own UIkeyboard_arrow_down

Create new UI for WebViewer Video

You can create a custom UI by using the video object. See the API here. With it you can access the underlying HTML5 video element and all its APIs. See the example code below.

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

WebViewer({
    path: '/webviewer/lib',
    selectAnnotationOnCreation: true,
    disabledElements: [
      'searchButton',
      'pageNavOverlay',
      'viewControlsButton',
      'panToolButton',
    ],
  },
  viewer.current,
).then(async instance => {
  // Extends WebViewer to allow loading HTML5 videos (.mp4, ogg, webm).
  const {
      loadVideo,
  } = await initializeVideoViewer(
      instance,
      '---- Insert commercial license key here after purchase ----',
  );
  // Load a video at a specific url. Can be a local or public link
  // If local it needs to be relative to lib/ui/index.html.
  // Or at the root. (eg '/video.mp4')
  const videoUrl = 'https://pdftron.s3.amazonaws.com/downloads/pl/video/video.mp4';
  loadVideo(videoUrl);

  instance.docViewer.on('documentLoaded', () => {
    const doc = docViewer.getDocument();
    const video = doc.getVideo();
    const videoElement = video.getElement();
    // do stuff here
    ...
    ...
    const playButton = controls.querySelector('#playButton');

    playButton.addEventListener('click', () => {
      // play the video
      if (videoElement.paused || videoElement.ended) {
        videoElement.play();
      }
    });

    videoElement.addEventListener('timeupdate', async () => {
      const currentFrameNumber = video.getFrameFromTime(videoElement.currentTime);
      // do something with the frame number
    });
  });
});

Get the answers you need: Support

close

Free Trial

Get unlimited trial usage of PDFTron SDK to bring accurate, reliable, and fast document processing capabilities to any application or workflow.

Select a platform to get started with your free trial.

Unlimited usage. No email address required.

Join our upcoming webinar to find out about built-in, full-functioning document capabilities directly in Salesforce.

Save your seat
close