Interface BaseLoadOptions

Any options used for loading a movie.

interface BaseLoadOptions {
    allowScriptAccess?: boolean;
    parameters?: null | string | URLSearchParams | Record<string, string>;
    autoplay?: AutoPlay;
    backgroundColor?: null | string;
    letterbox?: Letterbox;
    unmuteOverlay?: UnmuteOverlay;
    upgradeToHttps?: boolean;
    compatibilityRules?: boolean;
    favorFlash?: boolean;
    warnOnUnsupportedContent?: boolean;
    logLevel?: LogLevel;
    showSwfDownload?: boolean;
    contextMenu?: boolean | ContextMenu;
    preloader?: boolean;
    splashScreen?: boolean;
    maxExecutionDuration?: Duration;
    base?: null | string;
    menu?: boolean;
    salign?: string;
    forceAlign?: boolean;
    quality?: string;
    scale?: string;
    forceScale?: boolean;
    allowFullscreen?: boolean;
    frameRate?: null | number;
    wmode?: WindowMode;
    playerVersion?: null | number;
    preferredRenderer?: null | RenderBackend;
    publicPath?: null | string;
    polyfills?: boolean;
    openUrlMode?: OpenURLMode;
    allowNetworking?: NetworkingAccessMode;
    openInNewTab?: null | ((swf) => void);
    socketProxy?: SocketProxy[];
    fontSources?: string[];
    defaultFonts?: DefaultFonts;
    credentialAllowList?: string[];
    playerRuntime?: PlayerRuntime;
}

Hierarchy (view full)

Properties

allowScriptAccess?: boolean

If set to true, the movie is allowed to interact with the page through JavaScript, using a flash concept called ExternalInterface.

This should only be enabled for movies you trust.

Default

false
parameters?: null | string | URLSearchParams | Record<string, string>

Also known as "flashvars" - these are values that may be passed to and loaded by the movie.

If a URL if specified when loading the movie, some parameters will be extracted by the query portion of that URL and then overwritten by any explicitly set here.

Default

{}
autoplay?: AutoPlay

Controls the auto-play behaviour of Ruffle.

Default

AutoPlay.Auto
backgroundColor?: null | string

Controls the background color of the player. Must be an HTML color (e.g. "#FFFFFF"). CSS colors are not allowed. null uses the background color of the SWF file.

Default

null
letterbox?: Letterbox

Controls letterbox behavior when the Flash container size does not match the movie size.

Default

Letterbox.Fullscreen
unmuteOverlay?: UnmuteOverlay

Controls the visibility of the unmute overlay when the player is started muted.

Default

UnmuteOverlay.Visible
upgradeToHttps?: boolean

Whether or not to auto-upgrade all embedded URLs to https.

Flash content that embeds http urls will be blocked from accessing those urls by the browser when Ruffle is loaded in a https context. Set to true to automatically change http:// to https:// for all embedded URLs when Ruffle is loaded in an https context.

Default

true
compatibilityRules?: boolean

Enable (true) or disable (false) Ruffle's built in compatibility rules.

These are rules that may make some content work by deliberately changing behaviour, for example by rewriting requests or spoofing SWF urls if they rely on websites that no longer exist.

Default

true
favorFlash?: boolean

Favor using the real Adobe Flash Player over Ruffle if the browser supports it.

Default

true
warnOnUnsupportedContent?: boolean

This is no longer used and does not affect anything. It is only kept for backwards compatibility.

Previously: "Whether or not to display an overlay with a warning when loading a movie with unsupported content."

Default

true

Deprecated

logLevel?: LogLevel

Console logging level.

Default

LogLevel.Error
showSwfDownload?: boolean

If set to true, the context menu has an option to download the SWF.

Default

false
contextMenu?: boolean | ContextMenu

Whether or not to show a context menu when right-clicking a Ruffle instance.

Default

ContextMenu.On
preloader?: boolean

Whether or not to show a splash screen before the SWF has loaded with Ruffle (backwards-compatibility).

Default

true
splashScreen?: boolean

Whether or not to show a splash screen before the SWF has loaded with Ruffle.

Default

true
maxExecutionDuration?: Duration

Maximum amount of time a script can take before scripting is disabled.

Default

15
base?: null | string

Specifies the base directory or URL used to resolve all relative path statements in the SWF file. null means the current directory.

Default

null
menu?: boolean

If set to true, the built-in context menu items are visible

This is equivalent to Stage.showMenu.

Default

true
salign?: string

This is equivalent to Stage.align.

Default

""
forceAlign?: boolean

If set to true, movies are prevented from changing the stage alignment.

Default

false
quality?: string

This is equivalent to Stage.quality.

Default

"high"
scale?: string

This is equivalent to Stage.scaleMode.

Default

"showAll"
forceScale?: boolean

If set to true, movies are prevented from changing the stage scale mode.

Default

false
allowFullscreen?: boolean

If set to true, the Stage's displayState can be changed

Default

false
frameRate?: null | number

Sets and locks the player's frame rate, overriding the movie's frame rate.

Default

null
wmode?: WindowMode

The window mode of the Ruffle player.

This setting controls how the Ruffle container is layered and rendered with other content on the page.

Default

WindowMode.Window
playerVersion?: null | number

The emulated version of the player.

This controls the version that is reported to the movie. null means latest version.

Default

null
preferredRenderer?: null | RenderBackend

The preferred render backend of the Ruffle player.

This option should only be used for testing; the available backends may change in future releases. By default, Ruffle chooses the most featureful backend supported by the user's system, falling back to more basic backends if necessary. The available values in order of default preference are: "webgpu", "wgpu-webgl", "webgl", "canvas".

Default

null
publicPath?: null | string

The URL at which Ruffle can load its extra files (i.e. .wasm).

Default

null
polyfills?: boolean

Whether or not to enable polyfills on the page.

Polyfills will look for "legacy" flash content like <object> and <embed> elements, and replace them with compatible Ruffle elements.

Default

true
openUrlMode?: OpenURLMode

The handling mode of links opening a new website.

Default

OpenURLMode.Allow
allowNetworking?: NetworkingAccessMode

Which flash networking APIs may be accessed.

Default

NetworkingAccessMode.All
openInNewTab?: null | ((swf) => void)

A function to call for opening content in a new tab.

This is only used if the content cannot be loaded due to CORS, and the Extension version of Ruffle will override this to provide a local player.

Type declaration

    • (swf): void
    • Parameters

      • swf: URL

      Returns void

Default

null
socketProxy?: SocketProxy[]

An array of SocketProxy objects.

When a SWF tries to establish a Socket connection, Ruffle will search for a matching SocketProxy object in this array and use it to establish a WebSocket connection, through which all communication is tunneled through.

When none are found, Ruffle will fail the connection gracefully. When multiple matching SocketProxy objects exist, the first one is used.

Default

[]
fontSources?: string[]

An array of font URLs to eagerly load and provide to Ruffle.

These will be fetched by the browser as part of the loading of Flash content, which may slow down load times.

Currently only SWFs are supported, and each font embedded within that SWF will be used as device font by Flash content.

If any URL fails to load (either it's an invalid file, or a network error occurs), Ruffle will log an error but continue without it.

Default

[]
defaultFonts?: DefaultFonts

The font names to use for each "default" Flash device font.

Default

{}
credentialAllowList?: string[]

An array of origins that credentials may be sent to. Credentials are cookies, authorization headers, or TLS client certificates.

Entries should include the protocol and host, for example https://example.org or http://subdomain.example.org.

Cookies will always be sent to the same origin as the page the content was loaded on. If you configure this to send cookies to an origin but that origin does not configure CORS to allow it, then requests will start failing due to CORS. See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Access-Control-Allow-Credentials.

This directly corresponds to https://developer.mozilla.org/en-US/docs/Web/API/fetch#credentials Every request will be same-origin unless specified here, in which case it will be include.

Default

[]
playerRuntime?: PlayerRuntime

The player runtime to emulate

This allows you to emulate Adobe AIR or Adobe Flash Player.