Skip to main content

overwolf.media API

Use this API to capture a screenshot of the currently running game.

Permissions required: Media

Methods Reference

Events Reference

Types Reference

In-memory screenshot overview

Some methods in the overwold.media API allows you to take in-memory screenshot.

For example, the takeScreenshot(callback) method returns in a callback argument a screenshot URL that looks like this:

overwolf://media/screenshots/custom/E:/Desktop%20Capture-07-15-2018%2014-15-22-793.jpg

You can use the retrieved URL later in order to serve the stated screenshot: for example, to upload it to remote server, you can use HTML canvas.

Sample app

Download here a Sample app for using the In-Memory Screenshot API.

takeScreenshot(callback)

Version added: 0.78

Takes a screenshot and calls the callback with the success status and the screenshot URL. The screenshot is saved to the screenshots folder.

ParameterTypeDescription
callback (Optional)(Result: FileResult) => voidA function called after the screenshot was taken

takeScreenshot(targetFolder, callback)

Version added: 0.117

Takes a screenshot and calls the callback with the success status and the screenshot URL. The screenshot is saved to the screenshots folder.

ParameterTypeDescription
targetFolderstringTarget screen shot folder path
callback(Result: FileResult) => voidA callback function which will be called with the status of the request and the screenshot URL.

takeScreenshotEx(targetPath, options, callback)

Version added: 0.226

Takes a screenshot and calls the callback with the success status and the screenshot URL. The screenshot is saved to the screenshots folder.

ParameterTypeDescription
targetPathstringTarget screen shot file path
options (Optional)ScreenshotOptionsExtra settings controlling the screenshot
callback (Optional)(Result: FileResult) => voidA callback function which will be called with the status of the request and the screenshot URL.

takeWindowsScreenshotByHandle(windowHandle, postMediaEvent, callback)

Version added: 0.115

Takes a window screenshot and calls the callback with the success status and the screenshot URL. The screenshot is saved to the screenshots folder.

ParameterTypeDescription
windowHandleintThe window handle number. The handle number can retrieved from overwolf.games.launchers.getRunningLaunchersInfo()
postMediaEventboolset true to post (onMediaEvent)
callback(Result: FileResult) => voidA function called after the screenshot was taken

takeWindowsScreenshotByHandle(windowHandle, postMediaEvent, targetFolder, callback)

Version added: 0.115

Takes a window screenshot and calls the callback with the success status and the screenshot URL. The screenshot is saved to the screenshots folder.

ParameterTypeDescription
windowHandleintThe window handle number. The handle number can retrieved from overwolf.games.launchers.getRunningLaunchersInfo()
postMediaEventboolset true to post (onMediaEvent)
targetFolderstringSet target folder path for screenshot
callback(Result: FileResult) => voidA function called after the screenshot was taken

takeWindowsScreenshotByName(windowTitle, postMediaEvent, callback)

Version added: 0.115

Takes a window screenshot and calls the callback with the success status and the screenshot URL. The screenshot is saved to the screenshots folder.

This function is to capture a native OS window by it's OS window Title - for example - "Untitled - Notepad".
To capture one of your app's windows you should use HTML5 Canvas.toDataURL().

ParameterTypeDescription
windowTitlestringThe OS window title
postMediaEventboolset true to post (onMediaEvent)
callback(Result: FileResult) => voidA function called after the screenshot was taken

takeWindowsScreenshotByName(windowTitle, postMediaEvent, targetFolder, callback)

Version added: 0.117

Takes a window screenshot and calls the callback with the success status and the screenshot URL. The screenshot is saved to the targetFolder folder.

This function is to capture a native OS window by it's OS window Title - for example - "Untitled - Notepad".
To capture one of your app's windows you should use HTML5 Canvas.toDataURL().

ParameterTypeDescription
windowTitlestringThe OS window title
postMediaEventboolset true to post (onMediaEvent)
targetFolderstringSet target folder path for screenshot
callback(Result: FileResult) => voidA function called after the screenshot was taken

getScreenshotUrl(screenshotParams, callback)

Version added: 0.85

Takes a memory screenshot and calls the callback with the success status and the screenshot URL.

  • The screenshot will only be placed in the memory and will not be saved to a file (better performance).
  • Can only be used while in a game.
  • You can take a look at the in-memory screenshot sample app.
  • You can read more about the in-memory screenshot here.
ParameterTypeDescription
screenshotParamsMemoryScreenshotParams objectA JSON containing the parameters of the screenshot
callback (optional)(Result: FileResult) => voidA function called after the screenshot was taken

Usage Example

overwolf.media.getScreenshotUrl(
{
//Recommended for better rounding.
roundAwayFromZero : "true",
//Optional - Crop the screen (happens before the rescale, if both are used).
//Positive values are absolute, negative values are relative (-1.0 - 0)
crop: {
x: -0.5, //Start cropping at the middle of the screen
y: 0,
width: 400,
height: -0.5
},
//Optional - Rescale the final image to these dimensions
rescale: {
width: 1920,
height: -0.4
}
},
function(result) {
if (result.status == "success")
{
console.log(result.url);
}
}
);

shareImage(image, description, callback)

Version added: 0.78

Opens the social network sharing console to allow the user to share a picture.

ParameterTypeDescription
imageObjectA URL or image object to be shared
descriptionstringThe description to be used when posting to social networks
callback(Result) => voidReports success or failure

postMediaEvent(mediaType, jsonInfo, callback)

Version added: 0.91

Posts a media event for other apps to receive.

ParameterTypeDescription
mediaTypeeMediaType enumThe type of the event
jsonInfoJObjectA json with additional info about the events
callback(Result) => voidReports success or failure

getAppVideoCaptureFolderSize(callback)

Version added: 0.106

Returns the total size of the video capture folder created by the app. This includes all video/thumbnail and other files that are under the apps video folder.

  • The apps video folder is located inside the configured Overwolf video capture folder.
  • This function can take a long time to return if the folder contains a large amount of files (on some computers) – therefore, try to reduce the amount of times you call it.
ParameterTypeDescription
callback(Result: GetAppVideoCaptureFolderSizeResult) => void A callback with the size in MB

getAppScreenCaptureFolderSize(callback)

Version added: 0.106

Returns the total size of the screen capture folder created by the app. This includes all images/thumbnail and other files that are under the apps images folder.

  • The apps imagee folder is located inside the configured Overwolf image capture folder.
  • This function can take a long time to return if the folder contains a large amount of files (on some computers) – therefore, try to reduce the amount of times you call it.
ParameterTypeDescription
callback(Result: GetAppScreenCaptureFolderSizeResult) => void A callback with the size in MB

getWebcams(callback)

Version added: 0.159

Get all connected Webcams.

ParameterTypeDescription
callback(Result: GetWebcamsResult) => void A callback with the connected Webcams

onMediaEvent

Version added: 0.78

Fired when a media event has been posted.

Event Data Example: Success

 {
"origin": "nafihghfcpikebhfhdhljejkcifgbdahdhngepfb",
"triggerTime": "2018-10-22T16:56:39.000Z",
"events": [
"death"
],
"rawEvents": [
{
"type": "death",
"time": 15000
}
],
"mediaUrl": "overwolf://media/replays/Game+Summary/Fortnite/Fortnite_22-10-2018_19-53-40-1/Fortnite+10-22-2018+19-56-39-385.mp4",
"thumbnailUrl": "overwolf://media/thumbnails/Game+Summary/Fortnite/Fortnite_22-10-2018_19-53-40-1/Fortnite+10-22-2018+19-56-39-385.mp4",
"fullDuration": 20015,
"eventsDuration": 5015
}

onScreenshotTaken

Version added: 0.78

Fired when a screenshot was taken, with the following structure: ScreenshotTakenEvent Object

ScreenshotOptions Object

Version added: 0.226

Container for file screenshot settings.

ParameterTypeDescription
imageFormatImageFormatThe file format to use for the taken image

MemoryScreenshotParams Object

Version added: 0.78

Container for memory screenshot settings.

ParameterTypeDescription
roundAwayFromZeroboolWhen a number is halfway between two others, it is rounded toward the nearest number that is away from zero. Recommended for better precision
rescaleRescaleParams ObjectThe rescale settings
cropCropParams ObjectThe crop settings

RescaleParams Object

Version added: 0.78

Describes rescale parameters for memory screenshot.

ParameterTypeDescription
widthdoubleThe target width
heightdoubleThe target height

CropParams Object

Version added: 0.78

Describes rescale parameters for memory screenshot.

ParameterTypeDescription
xdoubleThe x offset. Positive value is considered absolute (0 – WIDTH) and negative is considered relative (-1.0 – 0)
ydoubleThe y offset. Positive value is considered absolute (0 – HEIGHT) and negative is considered relative (-1.0 – 0)
widthdoubleThe target width
heightdoubleThe target height

ImageFormat enum

Version added: 0.226

Image format to use for a file screenshot.

OptionDescription
Jpeg.jpeg
Bmp.bmp
Screenshot Formats

Screenshots taken before version 0.226 were always saved as a .jpg. If your app needs to handle those screenshots as well, make sure it can handle both .jpeg and .jpg images (as well as .bmp if relevant)

eMediaType enum

Version added: 0.78

Media type for the Media Event.

OptionDescription
Video
Image

eSourceType enum

Version added: 0.159

Video source type.

OptionDescription
Webcam

eVideoSourceTransform enum

Version added: 0.159

Video transform type.

OptionDescription
Stretch

FileResult Object

Version added: 0.149

Container for get file URL result.

ParameterTypeDescription
urlstring
pathstring

Example data: Success

{
"success": true,
"status": "success", //deprecated and kept only for backward compatibility
"url": "overwolf://media/replays/App+Name/Dota+2+06-28-2016+17-59-37-620.mp4",
"path": "E://Video/Overwolf/App Name/Dota 2 06-28-2016 17-59-37-620.mp4"
}

Note that the last part of the file name is the replayId. In the above example, it's 620.
The replayId is needed to finish capturing the replay by calling for example to overwolf.media.replays.stopCapture(). In the above example, it's 620.

GetAppVideoCaptureFolderSizeResult Object

Version added: 0.149

Container for get file getAppVideoCaptureFolderSize result.

ParameterTypeDescription
totalVideosSizeMBnumber

Example data: Success

{
"success": true,
"status": "success", //deprecated and kept only for backward compatibility
"totalVideosSizeMB": 12123,
}

GetWebcamsResult Object

Version added: 0.159

Container for get Webcams result.

ParameterTypeDescription
WebCamsoverwolf.media.Webcam[]

Example data: Success

{
"success": true,
"status": "success", //deprecated and kept only for backward compatibility
"webCams ": [
{
"name":"Webcam C170",
"path":"\\\\?\\usb#vid_046d&pid_082b&mi_00#7&2c79cd0&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\\global",
"id":"Webcam C170:\\\\?\\usb#vid_046d&pid_082b&mi_00#7&2c79cd0&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\\global"
},
{
"name":"USB2.0 HD UVC WebCam",
"path":"\\\\?\\usb#vid_13d3&pid_5666&mi_00#6&2f2fc667&1&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\\global",
"id":"USB2.0 HD UVC WebCam:\\\\?\\usb#vid_13d3&pid_5666&mi_00#6&2f2fc667&1&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\\global"
},
{
"name":"OBS Virtual Camera",
"path":"",
"id":"OBS Virtual Camera:"
}
],
}

Webcam Object

Version added: 0.159

Container for Webcam proporties.

ParameterTypeDescription
namestring
pathstring
idstring

Data example

{
"name":"Webcam C170",
"path":"\\\\?\\usb#vid_046d&pid_082b&mi_00#7&2c79cd0&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\\global",
"id":"Webcam C170:\\\\?\\usb#vid_046d&pid_082b&mi_00#7&2c79cd0&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\\global"
},

GetAppScreenCaptureFolderSizeResult Object

Version added: 0.149

Container for get file getAppVideoCaptureFolderSize result.

ParameterTypeDescription
screenCaptureSizeMBnumber

Example data: Success

{
"success": true,
"status": "success", //deprecated and kept only for backward compatibility
"screenCaptureSizeMB": 12123,
}

ScreenshotTakenEvent Object

ParameterTypeDescription
urlstring

Event data example: Success

{
"success": true,
"url": ""
}