### Install npm Source: https://ruffle.rs/js-docs/master/media/README.md Command to upgrade npm to a compatible version for older Node.js installations. ```bash npm install -g npm ``` -------------------------------- ### InstallationOptions Source: https://ruffle.rs/js-docs/master/interfaces/Setup.InstallationOptions.html Configuration options for the Ruffle installation process. ```APIDOC ## Interface: InstallationOptions ### Description Options to use with this specific installation of Ruffle. This is used to configure environmental settings, such as running a callback prior to loading WASM files. ### Properties - **onFirstLoad** (function) - Optional - A callback to be run before the very first time Ruffle is loaded. This may be used to configure a bundler prior to asset loading. ``` -------------------------------- ### init Source: https://ruffle.rs/js-docs/master/classes/Setup.PublicAPI.html Negotiates and starts the Ruffle player based on the current configuration. ```APIDOC ## init() ### Description Negotiates and starts Ruffle. It reads the config parameter to determine which polyfills should be enabled, falling back to built-in defaults if no configuration is provided. ``` -------------------------------- ### installRuffle(sourceName: string, options?: InstallationOptions): void Source: https://ruffle.rs/js-docs/master/functions/Setup.installRuffle.html Installs a version of Ruffle into the current page. Multiple versions can be installed simultaneously, and unique source names allow for managing different installation sources. ```APIDOC ## installRuffle(sourceName: string, options?: InstallationOptions): void ### Description Installs this version of Ruffle into the current page. Multiple (or zero) versions of Ruffle may be installed at the same time. ### Parameters - **sourceName** (string) - Required - The name of this particular Ruffle source (e.g., "local", "extension"). Names are unique; last-installed will replace earlier installations with the same name. - **options** (InstallationOptions) - Optional - Any options used to configure this specific installation of Ruffle. Defaults to {}. ### Returns - **void** ``` -------------------------------- ### Install wasm-bindgen-cli Source: https://ruffle.rs/js-docs/master/media/README.md Command to install the specific version of wasm-bindgen-cli required by Ruffle. ```bash cargo install wasm-bindgen-cli --version 0.2.127 ``` -------------------------------- ### InstallationOptions Interface Definition Source: https://ruffle.rs/js-docs/master/interfaces/Setup.InstallationOptions.html The interface definition for configuring Ruffle installation options. ```typescript interface InstallationOptions { onFirstLoad?: () => void; } ``` -------------------------------- ### volume Source: https://ruffle.rs/js-docs/master/interfaces/Player.LegacyRuffleAPI.html Gets or sets the master volume of the player. ```APIDOC ## get volume() / set volume(value: number) ### Description Returns or sets the master volume of the player. The volume is linear and 1.0 represents 100% volume. ### Parameters - **value** (number) - The volume level to set. ### Returns - **number** - The current volume level. ### Deprecation Notice Please use ruffle() to access a versioned API. This method may be replaced by Flash and is not guaranteed to exist. A direct replacement is PlayerV1.volume ``` -------------------------------- ### readyState Source: https://ruffle.rs/js-docs/master/interfaces/Player.LegacyRuffleAPI.html Retrieves the current readiness state of the playing movie. ```APIDOC ## get readyState() ### Description Indicates the readiness of the playing movie. ### Returns - **ReadyState** - The ReadyState of the player. ### Deprecation Notice Please use ruffle() to access a versioned API. This method may be replaced by Flash and is not guaranteed to exist. A direct replacement is PlayerV1.readyState ``` -------------------------------- ### downloadSwf() Source: https://ruffle.rs/js-docs/master/interfaces/Player.LegacyRuffleAPI.html Fetches the loaded SWF and downloads it. ```APIDOC ## downloadSwf() ### Description Fetches the loaded SWF and downloads it. ### Returns - **Promise** ``` -------------------------------- ### Update Rust toolchain Source: https://ruffle.rs/js-docs/master/media/README.md Command to update the installed Rust toolchain to the latest stable version. ```bash rustup update ``` -------------------------------- ### enterFullscreen() Source: https://ruffle.rs/js-docs/master/interfaces/Player.LegacyRuffleAPI.html Requests the browser to make this player fullscreen. ```APIDOC ## enterFullscreen() ### Description Requests the browser to make this player fullscreen. This is not guaranteed to succeed, please check fullscreenEnabled first. ### Returns - **void** ``` -------------------------------- ### config Source: https://ruffle.rs/js-docs/master/interfaces/Player.PlayerElement.html Sets the configuration for the specific player instance. ```APIDOC ## Property: config ### Description Any configuration that should apply to this specific player. This will be defaulted with any global configuration. This property is deprecated; please use PlayerV1.config instead. ### Type object | URLLoadOptions | DataLoadOptions ``` -------------------------------- ### constructor Source: https://ruffle.rs/js-docs/master/classes/Setup.PublicAPI.html Constructs a new PublicAPI instance. Note that this should generally not be called directly; use the public_api mechanism to register sources. ```APIDOC ## constructor(prev?: PublicAPILike | null) ### Description Construct the Ruffle public API. This triggers initialization of Ruffle once the page loads, provided the API has not been superseded. ### Parameters - **prev** (PublicAPILike | null) - Optional - The previous object in the public API slot, used for upgrading from prior versions. ``` -------------------------------- ### RufflePlayer.createPlayer() Source: https://ruffle.rs/js-docs/master/index.html Creates a new Ruffle player instance and loads a SWF file into a specified container. ```APIDOC ## Javascript API: RufflePlayer ### Description Controls the Ruffle player instance to load and display Flash content. ### Usage ```javascript window.RufflePlayer = window.RufflePlayer || {}; window.addEventListener("DOMContentLoaded", () => { let ruffle = window.RufflePlayer.newest(); let player = ruffle.createPlayer(); let container = document.getElementById("container"); container.appendChild(player); player.ruffle().load("movie.swf"); }); ``` ### Methods - **newest()**: Returns the newest Ruffle instance. - **createPlayer()**: Creates a new player element. - **load(url)**: Loads the SWF file from the provided URL. ``` -------------------------------- ### load(options) Source: https://ruffle.rs/js-docs/master/interfaces/Player.LegacyRuffleAPI.html Loads a specified movie into the player, replacing any existing content. ```APIDOC ## load(options) ### Description Loads a specified movie into this player. This will replace any existing movie that may be playing. ### Parameters - **options** (string | URLLoadOptions | DataLoadOptions) - Required - The URL or load options for the movie. ### Returns - **Promise** ``` -------------------------------- ### setFullscreen(isFull) Source: https://ruffle.rs/js-docs/master/interfaces/Player.LegacyRuffleAPI.html Requests the browser to change the fullscreen state. ```APIDOC ## setFullscreen(isFull) ### Description Exported function that requests the browser to change the fullscreen state if it is allowed. ### Parameters - **isFull** (boolean) - Required - Whether to set to fullscreen or return to normal. ### Returns - **void** ``` -------------------------------- ### Default autoplay Source: https://ruffle.rs/js-docs/master/interfaces/Config.BaseLoadOptions.html The default value for autoplay. ```text AutoPlay.Auto ``` -------------------------------- ### play() Source: https://ruffle.rs/js-docs/master/interfaces/Player.LegacyRuffleAPI.html Resumes the movie from suspension. ```APIDOC ## play() ### Description Resumes the movie from suspension. The movie will now resume executing any frames, scripts and sounds. If the movie is not suspended or no movie is loaded, this method will do nothing. ### Returns - **void** ``` -------------------------------- ### requestFullscreen Source: https://ruffle.rs/js-docs/master/interfaces/Player.PlayerV1.html Requests the browser to enter fullscreen mode. ```APIDOC ## requestFullscreen() ### Description Requests the browser to make this player fullscreen. This is not guaranteed to succeed; check fullscreenEnabled first. ``` -------------------------------- ### Default contextMenu Source: https://ruffle.rs/js-docs/master/interfaces/Config.BaseLoadOptions.html The default value for contextMenu. ```text ContextMenu.On ``` -------------------------------- ### DataLoadOptions Interface Source: https://ruffle.rs/js-docs/master/interfaces/Config.DataLoadOptions.html Configuration options for customizing the Ruffle player instance. ```APIDOC ## DataLoadOptions ### Description Configuration object used to define the behavior and environment of the Ruffle player. ### Properties - **forceScale** (boolean) - Optional - If true, prevents movies from changing the stage scale mode. Default: false. - **allowFullscreen** (boolean) - Optional - If true, allows the Stage's displayState to be changed. Default: false. - **frameRate** (number | null) - Optional - Sets and locks the player's frame rate. Default: null. - **wmode** (WindowMode) - Optional - Controls how the Ruffle container is layered and rendered. Default: WindowMode.Window. - **playerVersion** (number | null) - Optional - The emulated version of the player reported to the movie. Default: null. - **preferredRenderer** (RenderBackend | null) - Optional - The preferred render backend (e.g., "webgpu", "webgl"). Default: null. - **publicPath** (string | null) - Optional - The URL at which Ruffle can load its extra files. Default: null. - **polyfills** (boolean) - Optional - Whether to enable polyfills for legacy flash content. Default: true. - **openUrlMode** (OpenURLMode) - Optional - The handling mode for links opening a new website. Default: OpenURLMode.Allow. - **allowNetworking** (NetworkingAccessMode) - Optional - Defines which flash networking APIs may be accessed. Default: NetworkingAccessMode.All. - **openInNewTab** (function) - Optional - Callback for opening content in a new tab. Default: null. - **socketProxy** (SocketProxy[]) - Optional - Array of SocketProxy objects for tunneling Socket connections. Default: []. - **fontSources** (string[]) - Optional - Array of font URLs to eagerly load. Default: []. - **defaultFonts** (DefaultFonts) - Optional - Font names to use for "default" Flash device fonts. Default: {}. - **credentialAllowList** (string[]) - Optional - Origins that credentials may be sent to. Default: []. - **playerRuntime** (PlayerRuntime) - Optional - The player runtime to emulate (e.g., Adobe AIR or Adobe Flash Player). ``` -------------------------------- ### Initialize Ruffle player via JavaScript API Source: https://ruffle.rs/js-docs/master/index.html Use the RufflePlayer API to programmatically create a player instance and load a specific SWF file into a container element. ```html ``` -------------------------------- ### Default parameters Source: https://ruffle.rs/js-docs/master/interfaces/Config.BaseLoadOptions.html The default value for parameters. ```text {} ``` -------------------------------- ### Default upgradeToHttps Source: https://ruffle.rs/js-docs/master/interfaces/Config.BaseLoadOptions.html The default value for upgradeToHttps. ```text true ``` -------------------------------- ### load Source: https://ruffle.rs/js-docs/master/interfaces/Player.PlayerV1.html Loads a specified movie into the player. ```APIDOC ## load(options: string | URLLoadOptions | DataLoadOptions) ### Description Loads a specified movie into this player, replacing any existing movie that may be playing. ### Parameters - **options** (string | URLLoadOptions | DataLoadOptions) - Required - The source URL or load options for the movie. ``` -------------------------------- ### SourceAPI polyfill Method Source: https://ruffle.rs/js-docs/master/interfaces/Setup.SourceAPI.html Initializes polyfills. Ensure that polyfills are not run for more than one Ruffle source simultaneously. ```typescript polyfill(): void ``` -------------------------------- ### localCompatible Source: https://ruffle.rs/js-docs/master/classes/Setup.PublicAPI.html Retrieves the newest Ruffle version compatible with the local source. ```APIDOC ## localCompatible() ### Description Look up the newest Ruffle version compatible with the `local` source, if it's installed. Otherwise, use the latest version. ### Returns - **SourceAPI | null** - An instance of the Source API. ``` -------------------------------- ### LegacyRuffleAPI Interface Source: https://ruffle.rs/js-docs/master/interfaces/Player.LegacyRuffleAPI.html The LegacyRuffleAPI interface provides legacy methods for controlling the Ruffle player. Users are advised to use the versioned ruffle() API instead. ```APIDOC ## LegacyRuffleAPI ### Description Legacy interface for controlling a Ruffle player instance. This interface is deprecated and may be removed in future versions. ### Methods - **load(options)**: Loads a movie into the player. - **play()**: Starts playback. - **pause()**: Pauses playback. - **reload()**: Reloads the current movie. - **setFullscreen(isFull)**: Toggles fullscreen mode. - **enterFullscreen()**: Enters fullscreen mode. - **exitFullscreen()**: Exits fullscreen mode. - **downloadSwf()**: Triggers a download of the current SWF. - **displayMessage(message)**: Displays a message in the player. ### Properties - **onFSCommand**: Handler for Flash fscommand events. - **config**: Configuration object for the player. - **loadedConfig**: The configuration used for the last load operation. ### Accessors - **readyState**: Returns the current state of the player. - **metadata**: Returns metadata for the loaded movie. - **isPlaying**: Returns true if the movie is currently playing. - **volume**: Gets or sets the player volume. - **fullscreenEnabled**: Returns true if fullscreen is supported. - **isFullscreen**: Returns true if the player is in fullscreen mode. - **traceObserver**: Sets an observer for ActionScript trace messages. ``` -------------------------------- ### SourceAPI pluginPolyfill Method Source: https://ruffle.rs/js-docs/master/interfaces/Setup.SourceAPI.html Polyfills plugin detection. This must be executed before any plugin detection scripts run. ```typescript pluginPolyfill(): void ``` -------------------------------- ### PlayerV1 Interface Methods and Properties Source: https://ruffle.rs/js-docs/master/interfaces/Player.PlayerV1.html The PlayerV1 interface exposes various methods for player control, such as loading content, managing volume, and handling fullscreen requests. ```APIDOC ## PlayerV1 Interface ### Methods - **addFSCommandHandler(handler: (command: string, args: string) => void): void** - Registers a handler for FSCommand events. - **reload(): Promise** - Reloads the current movie. - **load(options: string | URLLoadOptions | DataLoadOptions): Promise** - Loads a movie with the specified options. - **requestFullscreen(): void** - Requests the player to enter fullscreen mode. - **exitFullscreen(): void** - Exits fullscreen mode. - **suspend(): void** - Suspends the player. - **resume(): void** - Resumes the player. - **downloadSwf(): Promise** - Downloads the current SWF file. - **displayMessage(message: string): void** - Displays a message in the player. - **callExternalInterface(name: string, ...args: unknown[]): unknown** - Calls an external interface function. ### Properties - **config** (object | URLLoadOptions | DataLoadOptions) - Configuration applied to the player. - **loadedConfig** (URLLoadOptions | DataLoadOptions | null) - The effective configuration from the last load call. ### Accessors - **readyState** (ReadyState) - The current ready state of the player. - **metadata** (MovieMetadata | null) - Metadata for the loaded movie. - **volume** (number) - Gets or sets the player volume. - **fullscreenEnabled** (boolean) - Indicates if fullscreen is enabled. - **isFullscreen** (boolean) - Indicates if the player is currently in fullscreen. - **suspended** (boolean) - Indicates if the player is suspended. - **traceObserver** (((message: string) => void) | null) - Sets an observer for trace messages. ``` -------------------------------- ### PercentLoaded() Source: https://ruffle.rs/js-docs/master/interfaces/Player.FlashAPI.html Returns the loading progress of the movie as a percentage. ```APIDOC ## PercentLoaded() ### Description Returns the movie's loading progress as a percentage value from 0 to 100. Note that Ruffle may return only 0 or 100 depending on the state. ### Signature `PercentLoaded(): number` ### Returns - **number** - A value from 0 to 100, inclusive, representing the loading progress. ``` -------------------------------- ### resume Source: https://ruffle.rs/js-docs/master/interfaces/Player.PlayerV1.html Resumes the movie from suspension. ```APIDOC ## resume() ### Description Resumes the movie from suspension. The movie will now resume executing any frames, scripts and sounds. ``` -------------------------------- ### BaseLoadOptions Interface Source: https://ruffle.rs/js-docs/master/interfaces/Config.BaseLoadOptions.html Configuration properties for the Ruffle player. ```APIDOC ## BaseLoadOptions ### Description Configuration object used to define the behavior of the Ruffle player instance. ### Properties - **frameRate** (number | null) - Optional - Sets and locks the player's frame rate. - **wmode** (WindowMode) - Optional - Controls how the Ruffle container is layered and rendered. - **playerVersion** (number | null) - Optional - The emulated version of the player reported to the movie. - **preferredRenderer** (RenderBackend | null) - Optional - The preferred render backend (e.g., "webgpu", "webgl"). - **publicPath** (string | null) - Optional - The URL at which Ruffle can load its extra files. - **polyfills** (boolean) - Optional - Whether to enable polyfills for legacy Flash content. - **openUrlMode** (OpenURLMode) - Optional - Handling mode for links opening a new website. - **allowNetworking** (NetworkingAccessMode) - Optional - Defines which flash networking APIs may be accessed. - **openInNewTab** ((swf: URL) => void | null) - Optional - Function to call for opening content in a new tab. - **socketProxy** (SocketProxy[]) - Optional - Array of SocketProxy objects for WebSocket tunneling. - **fontSources** (string[]) - Optional - Array of font URLs to eagerly load. - **defaultFonts** (DefaultFonts) - Optional - Font names to use for "default" Flash device fonts. - **credentialAllowList** (string[]) - Optional - Origins that credentials may be sent to. - **playerRuntime** (PlayerRuntime) - Optional - The player runtime to emulate (Adobe AIR or Flash Player). - **gamepadButtonMapping** (Partial>) - Optional - Mapping of gamepad buttons to ActionScript key codes. ``` -------------------------------- ### addFSCommandHandler Source: https://ruffle.rs/js-docs/master/interfaces/Player.PlayerV1.html Registers a handler to receive fscommand events from the loaded movie. ```APIDOC ## addFSCommandHandler(handler: (command: string, args: string) => void) ### Description Adds a handler for arbitrary "fs commands" from a movie in this player. If script access is allowed, a movie may communicate to the page through the ActionScript method fscommand(name, args). ### Parameters - **handler** (function) - Required - A callback function (command: string, args: string) => void to receive fscommands. ``` -------------------------------- ### local Source: https://ruffle.rs/js-docs/master/classes/Setup.PublicAPI.html Retrieves the newest Ruffle version matching the local source version. ```APIDOC ## local() ### Description Look up the newest Ruffle version with the exact same version as the `local` source, if it's installed. Otherwise, use the latest version. ### Returns - **SourceAPI | null** - An instance of the Source API. ``` -------------------------------- ### BaseLoadOptions Source: https://ruffle.rs/js-docs/master/interfaces/Config.BaseLoadOptions.html The BaseLoadOptions interface provides configuration options for loading a movie. These properties control various aspects of the player's behavior, such as security, display settings, and resource handling. ```APIDOC ## Interface: BaseLoadOptions ### Description Configuration options used for loading a movie in Ruffle. ### Properties - **allowScriptAccess** (boolean) - Optional - **parameters** (string | URLSearchParams | Record | null) - Optional - **autoplay** (AutoPlay) - Optional - **backgroundColor** (string | null) - Optional - **letterbox** (Letterbox) - Optional - **unmuteOverlay** (UnmuteOverlay) - Optional - **upgradeToHttps** (boolean) - Optional - **compatibilityRules** (boolean) - Optional - **favorFlash** (boolean) - Optional - **warnOnUnsupportedContent** (boolean) - Optional - **logLevel** (LogLevel) - Optional - **showSwfDownload** (boolean) - Optional - **contextMenu** (boolean | ContextMenu) - Optional - **preloader** (boolean) - Optional - **splashScreen** (boolean) - Optional - **maxExecutionDuration** (Duration) - Optional - **base** (string | null) - Optional - **menu** (boolean) - Optional - **salign** (string) - Optional - **fullScreenAspectRatio** (string) - Optional - **forceAlign** (boolean) - Optional - **quality** (string | null) - Optional - **scale** (string) - Optional - **forceScale** (boolean) - Optional - **allowFullscreen** (boolean) - Optional - **frameRate** (number | null) - Optional - **wmode** (WindowMode) - Optional - **playerVersion** (number | null) - Optional - **preferredRenderer** (RenderBackend | null) - Optional - **publicPath** (string | null) - Optional - **polyfills** (boolean) - Optional - **openUrlMode** (OpenURLMode) - Optional - **allowNetworking** (NetworkingAccessMode) - Optional - **openInNewTab** ((swf: URL) => void | null) - Optional - **socketProxy** (SocketProxy[]) - Optional - **fontSources** (string[]) - Optional - **defaultFonts** (DefaultFonts) - Optional - **credentialAllowList** (string[]) - Optional - **playerRuntime** (PlayerRuntime) - Optional - **gamepadButtonMapping** (Partial>) - Optional - **urlRewriteRules** ([string | RegExp, string][]) - Optional - **scrollingBehavior** (ScrollingBehavior) - Optional - **deviceFontRenderer** (DeviceFontRenderer) - Optional - **backgroundExecutionMode** (BackgroundExecutionMode) - Optional ``` -------------------------------- ### Default allowScriptAccess Source: https://ruffle.rs/js-docs/master/interfaces/Config.BaseLoadOptions.html The default value for allowScriptAccess. ```text false ``` -------------------------------- ### openUrlMode Default Value Source: https://ruffle.rs/js-docs/master/interfaces/Config.BaseLoadOptions.html The default handling mode for opening URLs. ```text OpenURLMode.Allow ``` -------------------------------- ### reload() Source: https://ruffle.rs/js-docs/master/interfaces/Player.LegacyRuffleAPI.html Reloads the player using the configuration from the last load call. ```APIDOC ## reload() ### Description Reloads the player, as if you called load with the same config as the last time it was called. If this player has never been loaded, this method will return an error. ### Returns - **Promise** ``` -------------------------------- ### URLLoadOptions Interface Source: https://ruffle.rs/js-docs/master/interfaces/Config.URLLoadOptions.html Configuration properties for the Ruffle player instance. ```APIDOC ## URLLoadOptions ### Properties - **allowFullscreen** (boolean) - Optional - If set to true, the Stage's displayState can be changed. Default: false. - **frameRate** (number | null) - Optional - Sets and locks the player's frame rate, overriding the movie's frame rate. Default: null. - **wmode** (WindowMode) - Optional - The window mode of the Ruffle player. Default: WindowMode.Window. - **playerVersion** (number | null) - Optional - The emulated version of the player. Default: null. - **preferredRenderer** (RenderBackend | null) - Optional - The preferred render backend of the Ruffle player. Default: null. - **publicPath** (string | null) - Optional - The URL at which Ruffle can load its extra files (i.e. .wasm). Default: null. - **polyfills** (boolean) - Optional - Whether or not to enable polyfills on the page. Default: true. - **openUrlMode** (OpenURLMode) - Optional - The handling mode of links opening a new website. Default: OpenURLMode.Allow. - **allowNetworking** (NetworkingAccessMode) - Optional - Which flash networking APIs may be accessed. Default: NetworkingAccessMode.All. - **openInNewTab** ((swf: URL) => void | null) - Optional - A function to call for opening content in a new tab. Default: null. - **socketProxy** (SocketProxy[]) - Optional - An array of SocketProxy objects for tunneling socket connections. Default: []. - **fontSources** (string[]) - Optional - An array of font URLs to eagerly load. Default: []. - **defaultFonts** (DefaultFonts) - Optional - The font names to use for each "default" Flash device font. Default: {}. - **credentialAllowList** (string[]) - Optional - An array of origins that credentials may be sent to. Default: []. - **playerRuntime** (PlayerRuntime) - Optional - The player runtime to emulate (Adobe AIR or Adobe Flash Player). - **gamepadButtonMapping** (Partial>) - Optional - An object mapping gamepad button names to ActionScript key codes. Default: {}. ``` -------------------------------- ### Default logLevel Source: https://ruffle.rs/js-docs/master/interfaces/Config.BaseLoadOptions.html The default value for logLevel. ```text LogLevel.Error ``` -------------------------------- ### BaseLoadOptions Interface Source: https://ruffle.rs/js-docs/master/interfaces/Config.BaseLoadOptions.html Configuration properties available for customizing the Ruffle player behavior. ```APIDOC ## BaseLoadOptions ### urlRewriteRules - **Type**: `[string | RegExp, string][]` (Optional) - **Description**: A set of rules that rewrite URLs in both network requests and links. Rules are scanned in order, and the first match is used. RegExp replacements support `$...` syntax. ### scrollingBehavior - **Type**: `ScrollingBehavior` (Optional) - **Description**: Defines how scrolling Flash content affects the web page. Defaults to `ScrollingBehavior.Smart`. ### deviceFontRenderer - **Type**: `DeviceFontRenderer` (Optional) - **Description**: Specifies how device fonts should be rendered. Defaults to `DeviceFontRenderer.Embedded`. ### backgroundExecutionMode - **Type**: `BackgroundExecutionMode` (Optional) - **Description**: Controls how Ruffle behaves when the browser tab is hidden. Defaults to `BackgroundExecutionMode.MainThread`. ``` -------------------------------- ### satisfying Source: https://ruffle.rs/js-docs/master/classes/Setup.PublicAPI.html Retrieves a Ruffle source API that satisfies specific version requirements. ```APIDOC ## satisfying(requirementString: string) ### Description Look up a specific Ruffle version (or any version satisfying a given set of requirements) and return its API. ### Parameters - **requirementString** (string) - Required - A set of semantic version requirement strings that the player version must satisfy. ### Returns - **SourceAPI | null** - An instance of the Source API, if one or more sources satisfied the requirement. ``` -------------------------------- ### Default salign Source: https://ruffle.rs/js-docs/master/interfaces/Config.BaseLoadOptions.html The default value for salign. ```text "" ``` -------------------------------- ### traceObserver Source: https://ruffle.rs/js-docs/master/interfaces/Player.LegacyRuffleAPI.html Sets an observer function to receive trace messages from the movie. ```APIDOC ## set traceObserver(observer: ((message: string) => void) | null) ### Description Sets a trace observer on this flash player. The observer will be called for each message that the playing movie will trace. ### Parameters - **observer** ((message: string) => void | null) - The function to call for each trace message. ### Deprecation Notice Please use ruffle() to access a versioned API. This method may be replaced by Flash and is not guaranteed to exist. A direct replacement is PlayerV1.traceObserver ``` -------------------------------- ### OpenURLMode Enumeration Source: https://ruffle.rs/js-docs/master/enums/Config.OpenURLMode.html Defines the available modes for handling URL opening requests. ```APIDOC ## OpenURLMode ### Description An enumeration representing the handling mode for links attempting to open a new website. ### Members - **Allow** ("allow"): Allow all links to open a new website. - **Confirm** ("confirm"): A confirmation dialog opens with every link trying to open a new website. - **Deny** ("deny"): Deny all links to open a new website. ``` -------------------------------- ### URLLoadOptions Interface Source: https://ruffle.rs/js-docs/master/interfaces/Config.URLLoadOptions.html Configuration properties for customizing the behavior of the Ruffle player during URL loading and execution. ```APIDOC ## URLLoadOptions ### Properties - **urlRewriteRules** ([string | RegExp, string][]) - Optional - A set of rules that rewrite URLs in both network requests and links. Rules are scanned in order; the first match is used. - **scrollingBehavior** (ScrollingBehavior) - Optional - Defines how scrolling Flash content affects the web page. Defaults to `ScrollingBehavior.Smart`. - **deviceFontRenderer** (DeviceFontRenderer) - Optional - Specifies how device fonts should be rendered. Defaults to `DeviceFontRenderer.Embedded`. - **backgroundExecutionMode** (BackgroundExecutionMode) - Optional - Controls how Ruffle behaves when the browser tab is hidden. Defaults to `BackgroundExecutionMode.MainThread`. ``` -------------------------------- ### newest Source: https://ruffle.rs/js-docs/master/classes/Setup.PublicAPI.html Retrieves the API for the newest registered Ruffle source. ```APIDOC ## newest() ### Description Look up the newest Ruffle source and return its API. ### Returns - **SourceAPI | null** - An instance of the Source API. ``` -------------------------------- ### DataLoadOptions Interface Source: https://ruffle.rs/js-docs/master/interfaces/Config.DataLoadOptions.html The DataLoadOptions interface provides a comprehensive set of configuration options for loading movie data streams. ```APIDOC ## DataLoadOptions ### Description Configuration options for loading a movie by a data stream. ### Properties - **data** (ArrayLike | ArrayBuffer) - Required - The movie data to load. - **swfFileName** (string) - Optional - The filename of the SWF. - **allowScriptAccess** (boolean) - Optional - Controls script access. - **parameters** (string | URLSearchParams | Record | null) - Optional - Flash parameters. - **autoplay** (AutoPlay) - Optional - Autoplay behavior. - **backgroundColor** (string | null) - Optional - Background color of the player. - **letterbox** (Letterbox) - Optional - Letterboxing behavior. - **unmuteOverlay** (UnmuteOverlay) - Optional - Unmute overlay settings. - **upgradeToHttps** (boolean) - Optional - Whether to upgrade requests to HTTPS. - **compatibilityRules** (boolean) - Optional - Enable compatibility rules. - **favorFlash** (boolean) - Optional - Whether to favor Flash content. - **warnOnUnsupportedContent** (boolean) - Optional - Warn if content is unsupported. - **logLevel** (LogLevel) - Optional - Logging verbosity. - **showSwfDownload** (boolean) - Optional - Show download button. - **contextMenu** (boolean | ContextMenu) - Optional - Context menu configuration. - **preloader** (boolean) - Optional - Enable preloader. - **splashScreen** (boolean) - Optional - Enable splash screen. - **maxExecutionDuration** (Duration) - Optional - Maximum execution time. - **base** (string | null) - Optional - Base URL for relative paths. - **menu** (boolean) - Optional - Enable menu. - **salign** (string) - Optional - Alignment settings. - **fullScreenAspectRatio** (string) - Optional - Fullscreen aspect ratio. - **forceAlign** (boolean) - Optional - Force alignment. - **quality** (string | null) - Optional - Rendering quality. - **scale** (string) - Optional - Scaling mode. - **forceScale** (boolean) - Optional - Force scaling. - **allowFullscreen** (boolean) - Optional - Allow fullscreen mode. - **frameRate** (number | null) - Optional - Override frame rate. - **wmode** (WindowMode) - Optional - Window mode. - **playerVersion** (number | null) - Optional - Player version emulation. - **preferredRenderer** (RenderBackend | null) - Optional - Preferred rendering backend. - **publicPath** (string | null) - Optional - Public path for assets. - **polyfills** (boolean) - Optional - Enable polyfills. - **openUrlMode** (OpenURLMode) - Optional - URL opening behavior. - **allowNetworking** (NetworkingAccessMode) - Optional - Networking access level. - **openInNewTab** ((swf: URL) => void | null) - Optional - Callback for opening in a new tab. - **socketProxy** (SocketProxy[]) - Optional - Socket proxy configuration. - **fontSources** (string[]) - Optional - List of font sources. - **defaultFonts** (DefaultFonts) - Optional - Default font settings. - **credentialAllowList** (string[]) - Optional - List of allowed credentials. - **playerRuntime** (PlayerRuntime) - Optional - Player runtime configuration. - **gamepadButtonMapping** (Partial>) - Optional - Gamepad button mappings. - **urlRewriteRules** ([string | RegExp, string][]) - Optional - URL rewrite rules. - **scrollingBehavior** (ScrollingBehavior) - Optional - Scrolling behavior. - **deviceFontRenderer** (DeviceFontRenderer) - Optional - Device font renderer. - **backgroundExecutionMode** (BackgroundExecutionMode) - Optional - Background execution mode. ``` -------------------------------- ### PublicAPILike Property: sources Source: https://ruffle.rs/js-docs/master/interfaces/Setup.PublicAPILike.html Optional record of SourceAPI instances. ```typescript sources?: Record ``` -------------------------------- ### exitFullscreen() Source: https://ruffle.rs/js-docs/master/interfaces/Player.LegacyRuffleAPI.html Requests the browser to no longer make this player fullscreen. ```APIDOC ## exitFullscreen() ### Description Requests the browser to no longer make this player fullscreen. ### Returns - **void** ``` -------------------------------- ### displayMessage(message) Source: https://ruffle.rs/js-docs/master/interfaces/Player.LegacyRuffleAPI.html Show a dismissible message in front of the player. ```APIDOC ## displayMessage(message) ### Description Show a dismissible message in front of the player. ### Parameters - **message** (string) - Required - The message shown to the user. ### Returns - **void** ``` -------------------------------- ### URLLoadOptions Interface Source: https://ruffle.rs/js-docs/master/interfaces/Config.URLLoadOptions.html The URLLoadOptions interface provides a comprehensive set of configuration options for loading SWF files or other content into the Ruffle player. ```APIDOC ## Interface: URLLoadOptions ### Description Configuration object used to define how a movie is loaded and executed within the Ruffle player. ### Properties - **url** (string) - Required - The URL of the movie to load. - **allowScriptAccess** (boolean) - Optional - Whether the movie is allowed to access scripts. - **parameters** (string | URLSearchParams | Record | null) - Optional - FlashVars or other parameters to pass to the movie. - **autoplay** (AutoPlay) - Optional - Configuration for autoplay behavior. - **backgroundColor** (string | null) - Optional - The background color of the player. - **letterbox** (Letterbox) - Optional - Letterboxing configuration. - **unmuteOverlay** (UnmuteOverlay) - Optional - Configuration for the unmute overlay. - **upgradeToHttps** (boolean) - Optional - Whether to force HTTPS for requests. - **compatibilityRules** (boolean) - Optional - Whether to apply compatibility rules. - **favorFlash** (boolean) - Optional - Whether to favor Flash content. - **warnOnUnsupportedContent** (boolean) - Optional - Whether to show warnings for unsupported content. - **logLevel** (LogLevel) - Optional - The logging level for the player. - **showSwfDownload** (boolean) - Optional - Whether to show the SWF download option. - **contextMenu** (boolean | ContextMenu) - Optional - Configuration for the context menu. - **preloader** (boolean) - Optional - Whether to use a preloader. - **splashScreen** (boolean) - Optional - Whether to show a splash screen. - **maxExecutionDuration** (Duration) - Optional - Maximum execution duration for scripts. - **base** (string | null) - Optional - Base URL for relative paths. - **menu** (boolean) - Optional - Whether to show the Flash menu. - **salign** (string) - Optional - Alignment settings. - **fullScreenAspectRatio** (string) - Optional - Aspect ratio for full screen mode. - **forceAlign** (boolean) - Optional - Whether to force alignment. - **quality** (string | null) - Optional - Rendering quality. - **scale** (string) - Optional - Scaling mode. - **forceScale** (boolean) - Optional - Whether to force scaling. - **allowFullscreen** (boolean) - Optional - Whether to allow full screen mode. - **frameRate** (number | null) - Optional - Override frame rate. - **wmode** (WindowMode) - Optional - Window mode configuration. - **playerVersion** (number | null) - Optional - The Flash player version to emulate. - **preferredRenderer** (RenderBackend | null) - Optional - The preferred rendering backend. - **publicPath** (string | null) - Optional - The public path for assets. - **polyfills** (boolean) - Optional - Whether to enable polyfills. - **openUrlMode** (OpenURLMode) - Optional - Mode for opening URLs. - **allowNetworking** (NetworkingAccessMode) - Optional - Networking access restrictions. - **openInNewTab** ((swf: URL) => void | null) - Optional - Callback for opening URLs in a new tab. - **socketProxy** (SocketProxy[]) - Optional - Configuration for socket proxies. - **fontSources** (string[]) - Optional - List of font source URLs. - **defaultFonts** (DefaultFonts) - Optional - Default font configuration. - **credentialAllowList** (string[]) - Optional - List of allowed credentials. - **playerRuntime** (PlayerRuntime) - Optional - Runtime configuration. - **gamepadButtonMapping** (Partial>) - Optional - Custom gamepad button mappings. - **urlRewriteRules** ([string | RegExp, string][]) - Optional - Rules for rewriting URLs. - **scrollingBehavior** (ScrollingBehavior) - Optional - Scrolling behavior configuration. - **deviceFontRenderer** (DeviceFontRenderer) - Optional - Device font renderer configuration. - **backgroundExecutionMode** (BackgroundExecutionMode) - Optional - Execution mode when in the background. ``` -------------------------------- ### PlayerElement Interface Source: https://ruffle.rs/js-docs/master/interfaces/Player.PlayerElement.html The PlayerElement interface allows direct interaction with a Ruffle player instance. It provides methods for loading content, controlling playback, and managing player state. ```APIDOC ## PlayerElement Interface ### Methods - **ruffle(version?: V)**: Access a versioned API interface. - **reload()**: Reloads the player instance. - **load(options)**: Loads a new SWF or configuration. - **play()**: Starts playback. - **pause()**: Pauses playback. - **setFullscreen(isFull: boolean)**: Toggles fullscreen mode. - **enterFullscreen()**: Enters fullscreen mode. - **exitFullscreen()**: Exits fullscreen mode. - **downloadSwf()**: Downloads the current SWF. - **displayMessage(message: string)**: Displays a message in the player. - **PercentLoaded()**: Returns the percentage of the movie loaded. ### Properties - **onFSCommand**: Callback for FSCommand events. - **config**: Configuration object for the player. - **loadedConfig**: The currently active configuration. - **traceObserver**: Setter for a message observer function. ### Accessors - **readyState**: Returns the current ready state of the player. - **metadata**: Returns metadata for the loaded movie. - **isPlaying**: Boolean indicating if the movie is playing. - **volume**: Gets or sets the player volume. - **fullscreenEnabled**: Boolean indicating if fullscreen is supported. - **isFullscreen**: Boolean indicating if the player is in fullscreen mode. ``` -------------------------------- ### onFSCommand Source: https://ruffle.rs/js-docs/master/interfaces/Player.PlayerElement.html Sets a handler for fscommands triggered by the Flash movie. This is a deprecated method for communication between Flash and JavaScript. ```APIDOC ## Property: onFSCommand ### Description Adds a handler for arbitrary "fs commands" from a movie in this player. This method is deprecated; please use PlayerV1.addFSCommandHandler instead. ### Signature (command: string, args: string) => void | null ### Parameters - **command** (string) - An arbitrary name of a command. - **args** (string) - An arbitrary argument to the command. ``` -------------------------------- ### PublicAPILike Property: config Source: https://ruffle.rs/js-docs/master/interfaces/Setup.PublicAPILike.html Optional configuration property for the API, accepting objects, URLLoadOptions, or DataLoadOptions. ```typescript config?: object | URLLoadOptions | DataLoadOptions ``` -------------------------------- ### Default backgroundColor Source: https://ruffle.rs/js-docs/master/interfaces/Config.BaseLoadOptions.html The default value for backgroundColor. ```text null ``` -------------------------------- ### SourceAPI version Property Source: https://ruffle.rs/js-docs/master/interfaces/Setup.SourceAPI.html Represents the version of the API as a semver compatible string. ```typescript version: string ``` -------------------------------- ### socketProxy Default Value Source: https://ruffle.rs/js-docs/master/interfaces/Config.BaseLoadOptions.html The default array for socket proxy configurations. ```text [] ``` -------------------------------- ### Config.DataLoadOptions Interface Source: https://ruffle.rs/js-docs/master/interfaces/Config.DataLoadOptions.html The DataLoadOptions interface provides configuration properties to control the runtime behavior of the Ruffle player. ```APIDOC ## DataLoadOptions ### Properties - **gamepadButtonMapping** (Partial>) - Optional - An object mapping gamepad button names to ActionScript key codes to simulate key presses. - **urlRewriteRules** ([string | RegExp, string][]) - Optional - A set of rules that rewrite URLs in network requests and links. - **scrollingBehavior** (ScrollingBehavior) - Optional - Defines how scrolling Flash content affects the web page. Default: ScrollingBehavior.Smart. - **deviceFontRenderer** (DeviceFontRenderer) - Optional - Specifies how device fonts should be rendered. Default: DeviceFontRenderer.Embedded. - **backgroundExecutionMode** (BackgroundExecutionMode) - Optional - Controls Ruffle behavior when the browser tab is hidden. Default: BackgroundExecutionMode.MainThread. ```