> Portal Navigation:
>
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt
# GenerateVideoStreamingUrl
# Package: mediaManager
# Namespace: FilesService
# Method link: https://dev.wix.com/docs/api-reference/assets/media/media-manager/files/generate-video-streaming-url.md
## Permission Scopes:
Read Media Manager: SCOPE.DC-MEDIA.READ-MEDIAMANAGER
## Introduction
Generates a URL for streaming a specific video file in the Media Manager.
To stream different assets of the file, specify the `assetKeys` parameter which generates a video streaming URL for each asset. If no assetKey is specified, it defaults to `src`, which generates one video streaming URL in the original file's format and quality.
---
## REST API
### Schema
```
Method: generateVideoStreamingUrl
Description: Generates a URL for streaming a specific video file in the Media Manager.
To stream different assets of the file, specify the `assetKeys` parameter which generates a video streaming URL for each asset. If no assetKey is specified, it defaults to `src`, which generates one video streaming URL in the original file's format and quality.
URL: https://www.wixapis.com/site-media/v1/files/generate-video-stream-url
Method: POST
# Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
Required parameters: fileId
Method parameters:
param name: fileId | type: fileId | description: File GUID. You can also specify the file's Wix media URL. For example, `wix:image://v1/0abec0_b291a9349a0b4da59067f76287e386fb~mv2.jpg/leon.jpg#originWidth=3024&originHeight=4032`. Learn more [about the file GUID parameter](https://dev.wix.com/docs/api-reference/assets/media/media-manager/files/file-id.md). | required: true
param name: format | type: StreamFormat
- enum:
UNKNOWN -
HLS -
DASH -
Return type: GenerateVideoStreamingUrlResponse
- name: downloadUrl | type: DownloadUrl | description: URL for streaming a specific file in the Media Manager.
- name: url | type: string | description: The file download URL.
- name: assetKey | type: string | description: Key for downloading a different asset (format and quality) of a file. Default: `src`, key representing the original file's format and quality.
```
### Examples
### Generate a URL for streaming a specific video file
```curl
curl -X POST \
'https://www.wixapis.com/site-media/v1/files/generate-video-stream-url' \
-H 'Authorization: '
-H 'Content-Type: application/json' \
--data-binary '{
"fileId": "4acbb8_b1403cfa28c24a8091597de4d2b518b9",
"format": "HLS"
}'
```
---
## JavaScript SDK
### Schema
```
Method: wixClientAdmin.mediaManager.FilesService.generateVideoStreamingUrl(fileId, options)
Description: Generates a URL for streaming a specific video file in the Media Manager.
To stream different assets of the file, specify the `assetKeys` parameter which generates a video streaming URL for each asset. If no assetKey is specified, it defaults to `src`, which generates one video streaming URL in the original file's format and quality.
# Note: If the parameter `a.b` is listed under required parameters, `b` is only required if `a` is also present.
Required parameters: fileId
Method parameters:
param name: fileId | type: string | description: File GUID. You can also pass the files' Wix media URLs. For example, `["wix:image://v1/0abec0_b291a9349a0b4da59067f76287e386fb~mv2.jpg/leon.jpg#originWidth=3024&originHeight=4032"]`. Learn more in the File and Folder GUIDs article. | required: true
param name: options | type: GenerateVideoStreamingUrlOptions none
- name: format | type: StreamFormat | description: Video stream format.
- enum: UNKNOWN, HLS, DASH
Return type: PROMISE
- name: downloadUrl | type: DownloadUrl | description: URL for streaming a specific file in the Media Manager.
- name: url | type: string | description: The file download URL.
- name: assetKey | type: string | description: Key for downloading a different asset (format and quality) of a file. Default: `src`, key representing the original file's format and quality.
```
### Examples
### Generate a video streaming url (with elevated permissions)
```javascript
import { files } from '@wix/media';
import { auth } from '@wix/essentials';
const elevatedGenerateVideoStreamingUrl = auth.elevate(files.generateVideoStreamingUrl);
/* Sample ID value: 'd4dde1_6ce66a7e99db49f5964ef9f3ef97eefc'
*
* Sample options value:
* {
* format: 'HLS'
* }
*/
async function myGenerateVideoStreamingUrlFunction(fileId, options) {
try {
const streamingUrl = await elevatedGenerateVideoStreamingUrl(fileId, options);
return streamingUrl;
} catch (error) {
console.error(error);
// Handle the error
}
}
/* Promise resolves to:
* {
* "downloadUrl": {
* "assetKey": "HLS",
* "url": "https://repackager.wixmp.com/video.wixstatic.com/video/d4dde1_6ce66a7e99db49f5964ef9f3ef97eefc/,720p,360p,1080p,480p,/mp4/file.mp4.urlset/master.m3u8"
* }
* }
*/
```
### Generate a video streaming url
```javascript
import { files } from '@wix/media';
/* Sample ID value: 'd4dde1_6ce66a7e99db49f5964ef9f3ef97eefc'
*
* Sample options value:
* {
* format: 'HLS'
* }
*/
async function myGenerateVideoStreamingUrlFunction(fileId, options) {
try {
const streamingUrl = await files.generateVideoStreamingUrl(fileId, options);
return streamingUrl;
} catch (error) {
console.error(error);
// Handle the error
}
}
/* Promise resolves to:
* {
* "downloadUrl": {
* "assetKey": "HLS",
* "url": "https://repackager.wixmp.com/video.wixstatic.com/video/d4dde1_6ce66a7e99db49f5964ef9f3ef97eefc/,720p,360p,1080p,480p,/mp4/file.mp4.urlset/master.m3u8"
* }
* }
*/
```
### generateVideoStreamingUrl (self-hosted)
Self-hosted SDK calls require you to [create a client](https://dev.wix.com/docs/sdk/articles/work-with-the-sdk/about-the-wix-client.md).
```javascript
import { createClient } from '@wix/sdk';
import { files } from '@wix/media';
// Import the auth strategy for the relevant access type
// Import the relevant host module if needed
const myWixClient = createClient ({
modules: { files },
// Include the auth strategy and host as relevant
});
async function generateVideoStreamingUrl(fileId,options) {
const response = await myWixClient.files.generateVideoStreamingUrl(fileId,options);
};
```
---