Skip to main content

overwolf.media.videos API

Use this API to create video composition, delete video files, and get details of video files that were created by the app.

info

Please read all the info about video capture usage and options on our video capture best practices guide.

Methods Reference

Types Reference

createVideoComposition(sourceVideoUrl, segments, callback)

Version added: 0.78

Creates a compilation video out of a source video and a list of segments. Listen to the event to determine when the compilation video is ready.

ParameterTypeDescription
sourceVideoUrlstringThe url of the source video in an overwolf://media form
segmentsVideoCompositionSegment[]A JSON containing a list of segments. See notes below
callback[(Result: FileResult)]/ow-native/reference/media/ow-media#fileresult-object) => voidCalled with the status of the request and the url to the target video

segments notes

The JSON containing a list of segments, each segment has a start time and an end time in milliseconds. The segments must be sorted in acsending order. Example:

{
"segments": [
{ "startTime": 2000, "endTime": 4000 },
{ "startTime": 8000, "endTime": 10000 },
{ "startTime": 14000, "endTime": 18000 }
]
}

createVideoCompositionFiles(files, outputFile, callback)

Version added: 0.112

Creates a compilation video out of a list of video files.

ParameterTypeDescription
filesstring[]List of video files (the url of each video is in the form of overwolf://media or file://)
outputFilestringThe name of the output video file
callback[(Result: FileResult)]/ow-native/reference/media/ow-media#fileresult-object) => voidCalled with the status of the request and the url to the output video

getVideos(callback)

Version added: 0.89

Gets a list of all of the videos created by this app.

Note that getVideos() returns only the files located in the current OW video folder, without files from different/past locations, if they exist.

ParameterTypeDescription
callback(Result: GetVideosResult) => voidCalled with the status of the request

getVideosSize(callback)

Version added: 0.91

Returns the total size of the video files created by this app in gigabytes.

ParameterTypeDescription
callback(Result: GetVideosSizeResult) => voidCalled with the status of the request and the videos size

deleteOldVideos(keepNewestXGbs, callback)

Version added: 0.89

Deletes all videos created by this app with an option to keep the newest X GBs (use with care).

ParameterTypeDescription
keepNewestXGbsintKeep the newest X GBs of videos. Pass 0 to delete all videos
callback(Result) => voidA callback function which will be called with the status of the request
tip

To delete old gifs you can use [overwolf.media.videos.deleteOldGifs()]/ow-native/reference/media/ow-media#deleteoldgifskeepnewestxgbs-callback), and to delete old screenshots you can use overwolf.extensions.io.delete().

deleteVideo(videoUrl, callback)

Version added: 0.89

Deletes a specific video created by this app.

ParameterTypeDescription
videoUrlstringThe Overwolf URL of the video to delete
callback(Result) => voidA callback function which will be called with the status of the request

NOTE: If you are trying to delete a video which was already loaded into a video DOM element, deletion will fail since the file is locked by the Overwolf process. To avoid this error, set the video element's source to an empty string before trying to delete. See example below:

const url = "overwolf://media/videos/video.mp4"; // Sample URL
const videoElement = document.querySelector("#my-video");
if (!videoElement.paused) { // Optional, pause the video before deleting
videoElement.pause();
}
videoElement.src = ""; // Set the video element source to an empty string
overwolf.media.videos.deleteVideo(url);

deleteVideo(filePath, callback)

Version added: 0.89

Deletes a specific video created by this app.

ParameterTypeDescription
filePathstringThe file path of the video to delete
callback(Result) => voidA callback function which will be called with the status of the request

addWatermark(sourceVideoUrl, watermarkUrl, watermarkParams, callback)

Version added: 0.157

Adds a video/image watermark to a video.

ParameterTypeDescription
sourceVideoUrlstringThe url of the source video in an overwolf://media form.
watermarkUrlstringThe url of the watermark video/image. Supports absolute/local path to a file in the extension directory (or an overwolf://media form).
watermarkParamsWatermarkParams objectuse this object to mark the watermark
callback[(Result: FileResult)]/ow-native/reference/media/ow-media#fileresult-object) => voidCalled with the status of the request and the url to the output video

Usage example

const sourceVideoUrl = 'overwolf://media/videos/Settings/test.mp4'; // 'overwolf://media' scheme
const watermarkUrl = 'giphy.gif'; // relative path to a file in the extension directory
const params = {
location: overwolf.media.videos.enums.WatermarkLocation.BottomLeft,
scaleHeight: 300
};

overwolf.media.videos.addWatermark(sourceVideoUrl ,watermarkUrl, params ,console.log);

WatermarkParams Object

Version added: 0.157

A helper structure to describe watermark parameters.

ParameterTypeDescription
startTimeintSegment start time (in milliseconds)
endTimeintSegment end time (in milliseconds)
locationWatermarkLocation enumThe location of the watermark (in pixles)
scaleHeightintscale height in pixels

WatermarkLocation enum

Version added: 0.157

Watermark location to use.

OptionDescription
topLeft
topCenter
topRight
midLeft
center
midRight
bottomLeft
bottomCenter
bottomRight

VideoCompositionSegment Object

Version added: 0.78

A helper structure to describe video segments.

ParameterTypeDescription
startTimeintSegment start time (in milliseconds)
endTimeintSegment end time (in milliseconds)

GetVideosResult Object

Version added: 0.89

Container for get videos result.

ParameterTypeDescription
videosstring[]

GetVideosSizeResult Object

Version added: 0.91

Container for get videos size result.

ParameterTypeDescription
totalSizeGbsnumber