Adaptive Streaming

WebViewer Video utilizes Shaka Player to allow for adaptive streaming. In order to utilize adaptive streaming, a dash file must be passed when loading the video. Adaptive streaming allows users to load lower resolution videos on slower networks.

What is Adaptive Streaming

Adaptive streaming is a streaming technique that takes into account the user's network and CPU usage to determine the optimal quality of media to pass through to the end user. This allows WebViewer Video to work more effectively on lower end computers/networks, and can also react to any network latency issues that may arise while using WebViewer Video.

Creating a Dash File

Please see more on how to create a DASH file to pass to WebViewer Video. In order to create a DASH file you must have multiple videos with different resolutions and link them in a manifest file. After you can simply pass the file as you would pass any video file to WebViewer Video.

JavaScript (v8.0+)

1import WebViewer from '@pdftron/webviewer';
2import { initializeVideoViewer, renderControlsToDOM } from '@pdftron/webviewer-video';
3
4WebViewer({
5 path: '/webviewer/lib',
6 },
7 viewer.current,
8).then(async instance => {
9 // Extends WebViewer to allow loading HTML5 videos (.mp4, ogg, webm).
10 const {
11 getVideo,
12 loadVideo,
13 } = await initializeVideoViewer(
14 instance,
15 {
16 license: '---- Insert commercial license key here after purchase ----',
17 }
18 );
19 // Load a video at a specific url. Can be a local or public link
20 // If local it needs to be relative to lib/ui/index.html.
21 // Or at the root. (eg '/video.mp4')
22
23 // Dash file url
24 const videoUrl = 'https://dash.akamaized.net/dash264/TestCasesHD/2b/qualcomm/1/MultiResMPEG2.mpd';
25 loadVideo(videoUrl);
26});

Did you find this helpful?

Trial setup questions?

Ask experts on Discord

Need other help?

Contact Support

Pricing or product questions?

Contact Sales