> For the complete documentation index, see [llms.txt](https://docs.apryse.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.apryse.com/web/get-started/readme/manually-video.md).

# Get started with WebViewer Video - Video Collaboration SDK

Collaborate and review videos frame by frame with WebViewer video. Annotate, comment, and collaborate on specific frames. Learn how to get started with a free trial and access the source code. The Apr

{% hint style="info" %}
New licenses for WebViewer Video are no longer offered.
{% endhint %}

Collaborate and review videos frame by frame. WebViewer video allows users to annotate video frames, comment on frames, collaborate and review videos.

Annotations will be tied to specific frames and will only be rendered, when the video is seeked to the specific frames. This guide will show you how to get started with a free trial.

The source code for this project is available in our [Git repo](https://github.com/ApryseSDK/webviewer-video-sample/).

{% embed url="<https://www.youtube.com/embed/xzvd9oN5Ngw>" %}

## Prerequisites

Prior to starting, you should have already installed [Node](https://nodejs.org/) and [npm](https://www.npmjs.com/).

Get your Apryse trial key.

{% @apryse-license-key/apryse-license-key platform="WEB\_VIEWER" variant="full" %}

## Initial setup

Clone the repo to a specific directory and then navigate to it:

{% tabs %}
{% tab title="Shell" %}
{% code lineNumbers="true" %}

```sh
git clone --depth=1 https://github.com/ApryseSDK/webviewer-samples.git
cd webviewer-samples/webviewer-video
```

{% endcode %}
{% endtab %}
{% endtabs %}

## How to run

1. Navigate to the `webviewer-video` directory and install the required dependencies to run the samples by executing:

{% tabs %}
{% tab title="Shell" %}
{% code lineNumbers="true" %}

```sh
npm install
```

{% endcode %}
{% endtab %}
{% endtabs %}

1. Next run the sample by executing:

{% tabs %}
{% tab title="Shell" %}
{% code lineNumbers="true" %}

```sh
npm start
```

{% endcode %}
{% endtab %}
{% endtabs %}

1. Navigate to `http://localhost:3000/` and you will see the sample WebViewer running with a video, similar to above.

## How it works

HTML5 Videos can be loaded into WebViewer with use of the [@pdftron/webviewer-video](https://www.npmjs.com/package/@pdftron/webviewer-video/) package.

### Install

{% tabs %}
{% tab title="Shell" %}
{% code lineNumbers="true" %}

```sh
npm install @pdftron/webviewer-video
```

{% endcode %}
{% endtab %}
{% endtabs %}

Below is a sample setup of the video package with webviewer.

[`initializeVideoViewer`](https://sdk.apryse.com/api/video/module-@pdftron_webviewer-video.html#.initializeVideoViewer__anchor) is called to give WebViewer the ability to handle the loading of video files. Afterwards, a video can be loaded with `loadVideo`. Lastly settings to customize the behavior of the controls can be passed in when calling [`initializeVideoViewer`](https://sdk.apryse.com/api/video/module-@pdftron_webviewer-video.html#.initializeVideoViewer__anchor).

{% tabs %}
{% tab title="JavaScript (SDK v8.0+)" %}
{% code lineNumbers="true" %}

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

WebViewer({
    path: '/webviewer/lib',
    selectAnnotationOnCreation: true,
  },
  viewer.current,
).then(async instance => {
  // Extends WebViewer to allow loading HTML5 videos (.mp4, ogg, webm).
  const {
      loadVideo,
  } = await initializeVideoViewer(
      instance,
      {
        license: '---- 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);
});
```

{% endcode %}

[WebViewerInstance](https://sdk.apryse.com/api/web/WebViewerInstance.html) [initializeVideoViewer](https://sdk.apryse.com/api/video/module-@pdftron_webviewer-video.html#~initializeVideoViewer__anchor)
{% endtab %}

{% tab title="JavaScript (SDK v7.0+)" %}
{% code lineNumbers="true" %}

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

WebViewer({
    path: '/webviewer/lib',
    selectAnnotationOnCreation: true,
  },
  viewer.current,
).then(async instance => {
  // Extends WebViewer to allow loading HTML5 videos (.mp4, ogg, webm).
  const {
    loadVideo,
  } = await initializeVideoViewer(
    instance,
    {
      license: '---- 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);
});
```

{% endcode %}

[WebViewerInstance](https://sdk.apryse.com/api/web/WebViewerInstance.html) [initializeVideoViewer](https://sdk.apryse.com/api/video/module-@pdftron_webviewer-video.html#.initializeVideoViewer__anchor)
{% endtab %}
{% endtabs %}

## Import and Exporting Annotations

[Importing and exporting annotations](/web/annotation/import-export.md) works the exact same way as it does on WebViewer, with the video annotations having additional the properties `start-time` and `end-time`.

## Server configuration

Make sure your server has [byte-range requests](/ios/viewer/view-online-pdfs.md#byterange-requests) enabled to allow video streaming.

## API

[@pdftron/webviewer-video](https://sdk.apryse.com/api/video/)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.apryse.com/web/get-started/readme/manually-video.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
