Search.../

generateVideoStreamingUrl( )

Developer Preview

Generates a URL for streaming a specific video file in the Media Manager.

Description

The generateVideoStreamingUrl() function returns a Promise that resolves to a download URL and its asset key.

To stream different assets of the file, use the assetKeys parameter which generates a video streaming URL for each asset. If no asset key is specified, it defaults to src, which generates one video streaming URL in the original file's format and quality.

Admin Method

This function requires elevated permissions to run. This function is not universal and runs only on the backend.

Syntax

function generateVideoStreamingUrl(fileId: string, options: GenerateVideoStreamingUrlOptions): Promise<GenerateVideoStreamingUrlResponse>

generateVideoStreamingUrl Parameters

NAME
TYPE
DESCRIPTION
fileId
string

File ID.

options
Optional
GenerateVideoStreamingUrlOptions

Options to use when generating a video file's streaming URL.

Returns

Return Type:

Promise<
GenerateVideoStreamingUrlResponse
>
NAME
TYPE
DESCRIPTION
downloadUrl
DownloadUrl

URL for streaming a specific file in the Media Manager.

Was this helpful?

Generate a video streaming url

Copy Code
1import { files } from 'wix-media.v2';
2import { elevate } from 'wix-auth';
3
4/* Sample ID value: 'd4dde1_6ce66a7e99db49f5964ef9f3ef97eefc'
5 *
6 * Sample options value:
7 * {
8 * format: 'HLS'
9 * }
10 */
11
12async function myGenerateVideoStreamingUrlFunction(fileId, options) {
13 try {
14 const elevatedGenerateVideoStreamingUrl = elevate(files.generateVideoStreamingUrl);
15 const streamingUrl = await elevatedGenerateVideoStreamingUrl(fileId, options);
16
17 return streamingUrl;
18 } catch (error) {
19 console.error(error);
20 // Handle the error
21 }
22}
23
24/* Promise resolves to:
25 * {
26 * "downloadUrl": {
27 * "assetKey": "HLS",
28 * "url": "https://repackager.wixmp.com/video.wixstatic.com/video/d4dde1_6ce66a7e99db49f5964ef9f3ef97eefc/,720p,360p,1080p,480p,/mp4/file.mp4.urlset/master.m3u8"
29 * }
30 * }
31 */