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.
Please read all the info about video capture usage and options on our video capture best practices guide.
Methods Reference
- overwolf.media.videos.createVideoComposition()
- overwolf.media.videos.createVideoCompositionFiles()
- overwolf.media.videos.getVideos()
- overwolf.media.videos.getVideosSize()
- overwolf.media.videos.deleteOldVideos()
- overwolf.media.videos.deleteVideo()
- overwolf.media.videos.addWatermark ()
Types Reference
- VideoCompositionSegment Object
- WatermarkParams Object
- WatermarkLocation Enum
- overwolf.media.GetVideosResult Object
- overwolf.media.GetVideosSizeResult Object
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.
Parameter | Type | Description |
---|---|---|
sourceVideoUrl | string | The url of the source video in an overwolf://media form |
segments | VideoCompositionSegment[] | A JSON containing a list of segments. See notes below |
callback | (Result: FileResult) => void | Called 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.
Parameter | Type | Description |
---|---|---|
files | string[] | List of video files (the url of each video is in the form of overwolf://media or file:// ) |
outputFile | string | The name of the output video file |
callback | (Result: FileResult) => void | Called 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.
Parameter | Type | Description |
---|---|---|
callback | (Result: GetVideosResult) => void | Called 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.
Parameter | Type | Description |
---|---|---|
callback | (Result: GetVideosSizeResult) => void | Called 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).
Parameter | Type | Description |
---|---|---|
keepNewestXGbs | int | Keep the newest X GBs of videos. Pass 0 to delete all videos |
callback | (Result) => void | A callback function which will be called with the status of the request |
To delete old gifs you can use overwolf.media.videos.deleteOldGifs(), 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.
Parameter | Type | Description |
---|---|---|
videoUrl | string | The Overwolf URL of the video to delete |
callback | (Result) => void | A 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);
addWatermark(sourceVideoUrl, watermarkUrl, watermarkParams, callback)
Version added: 0.157
Adds a video/image watermark to a video.
Parameter | Type | Description |
---|---|---|
sourceVideoUrl | string | The url of the source video in an overwolf://media form. |
watermarkUrl | string | The url of the watermark video/image. Supports absolute/local path to a file in the extension directory (or an overwolf://media form). |
watermarkParams | WatermarkParams object | use this object to mark the watermark |
callback | (Result: FileResult) => void | Called 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.
Parameter | Type | Description |
---|---|---|
startTime | int | Segment start time (in milliseconds) |
endTime | int | Segment end time (in milliseconds) |
location | WatermarkLocation enum | The location of the watermark (in pixles) |
scaleHeight | int | scale height in pixels |
WatermarkLocation enum
Version added: 0.157
Watermark location to use.
Option | Description |
---|---|
topLeft | |
topCenter | |
topRight | |
midLeft | |
center | |
midRight | |
bottomLeft | |
bottomCenter | |
bottomRight |
VideoCompositionSegment Object
Version added: 0.78
A helper structure to describe video segments.
Parameter | Type | Description |
---|---|---|
startTime | int | Segment start time (in milliseconds) |
endTime | int | Segment end time (in milliseconds) |
GetVideosResult Object
Version added: 0.89
Container for get videos result.
Parameter | Type | Description |
---|---|---|
videos | string[] |
GetVideosSizeResult Object
Version added: 0.91
Container for get videos size result.
Parameter | Type | Description |
---|---|---|
totalSizeGbs | number |