overwolf.media

Use the overwolf.media API to capture a screenshot or create a GIF of the currently running game.

Methods

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.

You can use the retrieved URL later in order to serve the stated screenshot: overwolf://media/screenshots/<screenshot name>

  • Parameter: callback <function> — Optional

    A function called after the screenshot was taken.

Callback argument:
{
    "status": "success",
    "url": "overwolf://media/screenshots/Streamer%20Alerts/Desktop%20Capture-05-02-2016%2013-50-43.jpg"
}

getScreenshotUrl(screenshotParams, callback)

Version added: 0.85.0

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.

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);
        }
    }
);
  • Parameter: screenshotParams <MemoryScreenshotParams>

    A JSON containing the parameters of the screenshot.

  • Parameter: callback <function> — Optional

    A function called after the screenshot was taken.

Callback argument:
{
    "status": "success",
    "url": "overwolf://media/memoryscreenshots/74/Counter-Strike+Global+Offensive-05-02-2016+13-54-54"
}

shareImage(image, description, callback)

Version added: 0.78

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

  • Parameter: image <object>

    A URL or image object to be shared.
  • Parameter: description <string>

    The description to be used when posting to social networks.
  • Parameter: callback <function> — Optional

    A function called after the image was shared.

postMediaEvent(mediaType, jsonInfo, callback)

Version added: 0.91.0

Posts a media event for other apps to receive.

  • Parameter: mediaType <eMediaType>

    The type of the event. See eMediaType.

  • Parameter: jsonInfo <JObject>

    A json with additional info about the event.

  • Parameter: callback <function>

    A callback with the status if the call.

startGifBuffer(interval, duration, width, callback)

Version added: 0.91.100

Starts filling a buffer with frames for later creation of gif animations. The buffer will close in 30 secs.

  • Parameter: interval <int>

    The interval in milliseconds to captures frames in.

  • Parameter: duration <int>

    The duration in milliseconds in which to capture frames.

  • Parameter: width <int>

    The desired absolute width (rescale). Height will be determined by width while maintaining aspect ratio.

  • Parameter: callback <function>

    Called with the status of the request.

stopGifBuffer(callback)

Version added: 0.91.100

Stops filling the gif buffer.

  • Parameter: callback <function>

    Called with the status of the request.

generateGif(onGifReadyCallback, callback)

Version added: 0.91.100

Generates a gif. The gif buffer must be started first.

  • Parameter: onGifReadyCallback <function>

    Called when the gif is ready with a url to obtain it.

  • Parameter: callback <function>

    Called with the status of the request.

deleteOldGifs(keepNewestXGbs, callback)

Version added: 0.91.0

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

  • Parameter: keepNewestXGbs <int>

    Keep the newest X GBs of gifs. Pass 0 to delete all gifs.

  • Parameter: callback <function>

    A callback function which will be called with the status of the request.

getGifsSize(callback)

Version added: 0.91.0

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

  • Parameter: callback <function>

    A callback with the gifs size.

getAppVideoCaptureFolderSize(callback)

Version added: 0.106.2

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 – which is located inside the configured Overwolf video capture folder.
NOTE: 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.

  • Parameter: callback <function>

    A callback with the size in MB.

getAppScreenCaptureFolderSize(callback)

Version added: 0.106.2

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 – which is located inside the configured Overwolf image capture folder.
NOTE: 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

  • Parameter: callback <function>

    A callback with the size in MB.

Events How to use events

onMediaEvent

Version added: 0.91.0

Fired when a media event has been posted.

onScreenshotTaken

Version added: 0.78

Fired when a screenshot was taken.

onGifGenerationError

Version added: 0.91.200

Fired when there’s an error with the gif generation buffer.

Types

MemoryScreenshotParams

Memory screenshot settings container.

Properties

roundAwayFromZero

When a number is halfway between two others, it is rounded toward the nearest number that is away from zero. Recommended for better precision.

Type: bool

rescale

The rescale settings.

Type: RescaleParams

crop

The crop settings.

Type: CropParams

RescaleParams

Describes rescale parameters for memory screenshot.

Properties

width

The target width.

Type: double

height

The target height.

Type: double

CropParams

Describes crop parameters for memory screenshot.

Properties

x

The x offset. Positive value is considered absolute (0 – WIDTH) and negative is considered relative (-1.0 – 0).

Type: double

y

The y offset. Positive value is considered absolute (0 – HEIGHT) and negative is considered relative (-1.0 – 0).

Type: double

width

The width of the cropped image. Positive value is considered absolute (0 – WIDTH) and negative is considered relative (-1.0 – 0).

Type: double

height

The height of the cropped image. Positive value is considered absolute (0 – HEIGHT) and negative is considered relative (-1.0 – 0).

Type: double

eMediaType

Media type for the Media Event.

Options

Video

Image