> 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/video/adaptive-streaming.md).

# Adaptive Streaming

Enhance your video streaming experience with adaptive streaming using WebViewer Video and Shaka Player. Learn how to create a dash file to optimize media quality based on network conditions and CPU us

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

WebViewer Video utilizes [Shaka Player](https://github.com/shaka-project/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](https://ottverse.com/shaka-packager-for-mpeg-dash-packaging-live-and-vod/) 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.

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

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

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

  // Dash file url
  const videoUrl = 'https://dash.akamaized.net/dash264/TestCasesHD/2b/qualcomm/1/MultiResMPEG2.mpd';
  loadVideo(videoUrl);
});
```

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

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


---

# 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/video/adaptive-streaming.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.
