Device
Audio
<static> Audio
Determines the audio playback capabilities of the device running this Phaser Game instance.
These values are read-only and populated during the boot sequence of the game.
They are then referenced by internal game systems and are available for you to access
via this.sys.game.device.audio from within any Scene.
| name | type | optional | description |
|---|---|---|---|
| audioData | boolean | No | Can this device play HTML Audio tags? |
| dolby | boolean | No | Can this device play EC-3 Dolby Digital Plus files? |
| m4a | boolean | No | Can this device play m4a files? |
| aac | boolean | No | Can this device play aac files? |
| flac | boolean | No | Can this device play flac files? |
| mp3 | boolean | No | Can this device play mp3 files? |
| ogg | boolean | No | Can this device play ogg files? |
| opus | boolean | No | Can this device play opus files? |
| wav | boolean | No | Can this device play wav files? |
| webAudio | boolean | No | Does this device have the Web Audio API? |
| webm | boolean | No | Can this device play webm files? |
Type: object
Member of: Phaser.Device
Source: src/device/Audio.js#L9
Since: 3.0.0
Browser
<static> Browser
Determines the browser type and version running this Phaser Game instance.
These values are read-only and populated during the boot sequence of the game.
They are then referenced by internal game systems and are available for you to access
via this.sys.game.device.browser from within any Scene.
| name | type | optional | description |
|---|---|---|---|
| chrome | boolean | No | Set to true if running in Chrome. |
| edge | boolean | No | Set to true if running in Microsoft Edge browser. |
| firefox | boolean | No | Set to true if running in Firefox. |
| ie | boolean | No | Set to true if running in Internet Explorer 11 or less (not Edge). |
| mobileSafari | boolean | No | Set to true if running in Mobile Safari. |
| opera | boolean | No | Set to true if running in Opera. |
| safari | boolean | No | Set to true if running in Safari. |
| silk | boolean | No | Set to true if running in the Silk browser (as used on the Amazon Kindle). |
| trident | boolean | No | Set to true if running a Trident version of Internet Explorer (IE11 or earlier). |
| es2019 | boolean | No | Set to true if the browser appears to support ES2019 features. |
| chromeVersion | number | No | If running in Chrome this will contain the major version number. |
| firefoxVersion | number | No | If running in Firefox this will contain the major version number. |
| ieVersion | number | No | If running in Internet Explorer this will contain the major version number. Beyond IE10 you should use Browser.trident and Browser.tridentVersion. |
| safariVersion | number | No | If running in Safari this will contain the major version number. |
| tridentVersion | number | No | If running in Internet Explorer 11 this will contain the major version number. See {@link http://msdn.microsoft.com/en-us/library/ie/ms537503(v=vs.85).aspx} |
Type: object
Member of: Phaser.Device
Source: src/device/Browser.js#L9
Since: 3.0.0
CanvasFeatures
<static> CanvasFeatures
Determines the canvas features of the browser running this Phaser Game instance.
These values are read-only and populated during the boot sequence of the game.
They are then referenced by internal game systems and are available for you to access
via this.sys.game.device.canvasFeatures from within any Scene.
| name | type | optional | description |
|---|---|---|---|
| supportInverseAlpha | boolean | No | Set to true if the browser supports inverted alpha. |
| supportNewBlendModes | boolean | No | Set to true if the browser supports new canvas blend modes. |
Type: object
Member of: Phaser.Device
Source: src/device/CanvasFeatures.js#L9
Since: 3.0.0
Features
<static> Features
Determines the features of the browser running this Phaser Game instance.
These values are read-only and populated during the boot sequence of the game.
They are then referenced by internal game systems and are available for you to access
via this.sys.game.device.features from within any Scene.
| name | type | optional | description |
|---|---|---|---|
| canvas | boolean | No | Indicates whether the HTML5 Canvas API (CanvasRenderingContext2D) is available in this browser. Required for the Canvas renderer to function. |
| canvasBitBltShift | boolean | No | True if canvas supports a 'copy' bitblt onto itself when the source and destination regions overlap. This is used for fast pixel copy operations. Will be null if it could not be determined, false on iOS and Safari where it is known not to work. |
| file | boolean | No | Indicates whether the File, FileReader, FileList, and Blob APIs are all available, enabling file reading operations within the browser. |
| fileSystem | boolean | No | Indicates whether the FileSystem API (requestFileSystem) is available, allowing sandboxed local file storage access. |
| getUserMedia | boolean | No | Indicates whether the getUserMedia API is available and functional. Used for accessing camera and microphone input. Note: older versions of Firefox (below 21) may report support but not actually work correctly. |
| littleEndian | boolean | No | Indicates whether the device uses little-endian byte ordering. Only detected if the browser supports TypedArrays. Will be null if endianness could not be determined. |
| localStorage | boolean | No | Indicates whether the Web Storage localStorage API is available for persisting key-value data between browser sessions. |
| pointerLock | boolean | No | Indicates whether the Pointer Lock API is available, which allows the mouse cursor to be hidden and locked to the game canvas for first-person style input. |
| stableSort | boolean | No | Indicates whether the browser's Array.sort implementation is stable, meaning equal elements retain their original relative order after sorting. |
| support32bit | boolean | No | Indicates whether the device supports 32-bit pixel manipulation of canvas image data using ArrayBuffer and typed array views (Uint8ClampedArray / Int32Array). Requires little-endian byte ordering. |
| vibration | boolean | No | Indicates whether the Vibration API is available, enabling haptic feedback on supported mobile devices. |
| webGL | boolean | No | Indicates whether WebGL is available in this browser. Required for the WebGL renderer to function. |
| worker | boolean | No | Indicates whether Web Workers are available, enabling background JavaScript execution on a separate thread. |
Type: object
Member of: Phaser.Device
Source: src/device/Features.js#L11
Since: 3.0.0
Fullscreen
<static> Fullscreen
Determines the full screen support of the browser running this Phaser Game instance.
These values are read-only and populated during the boot sequence of the game.
They are then referenced by internal game systems and are available for you to access
via this.sys.game.device.fullscreen from within any Scene.
| name | type | optional | description |
|---|---|---|---|
| available | boolean | No | Does the browser support the Full Screen API? |
| keyboard | boolean | No | Does the browser support access to the Keyboard during Full Screen mode? |
| active | boolean | No | Is the browser currently in fullscreen mode? This is a read-only getter that checks the various vendor-prefixed fullscreen element properties on the document. |
| cancel | string | No | If the browser supports the Full Screen API, this holds the name of the method to call on the document in order to exit fullscreen mode. |
| request | string | No | If the browser supports the Full Screen API, this holds the name of the method to call on a DOM element in order to request fullscreen mode. |
Type: object
Member of: Phaser.Device
Source: src/device/Fullscreen.js#L7
Since: 3.0.0
Input
<static> Input
Determines the input support of the browser running this Phaser Game instance.
These values are read-only and populated during the boot sequence of the game.
They are then referenced by internal game systems and are available for you to access
via this.sys.game.device.input from within any Scene.
| name | type | optional | description |
|---|---|---|---|
| wheelEvent | string | No | The most modern wheel/scroll event type supported by the browser: 'wheel' (DOM3), 'mousewheel' (legacy Chrome/IE/Safari), or 'DOMMouseScroll' (legacy Firefox). null if no wheel event is supported. |
| gamepads | boolean | No | Whether the Gamepad API (navigator.getGamepads) is available in this browser, allowing gamepad input to be read. |
| mspointer | boolean | No | Whether the Microsoft Pointer API (navigator.msPointerEnabled or navigator.pointerEnabled) is available, used for pointer input on older IE/Edge browsers. |
| touch | boolean | No | Whether touch input is supported, detected via the ontouchstart event or navigator.maxTouchPoints. |
Type: object
Member of: Phaser.Device
Source: src/device/Input.js#L9
Since: 3.0.0
OS
<static> OS
Determines the operating system of the device running this Phaser Game instance.
These values are read-only and populated during the boot sequence of the game.
They are then referenced by internal game systems and are available for you to access
via this.sys.game.device.os from within any Scene.
| name | type | optional | description |
|---|---|---|---|
| android | boolean | No | Is running on Android? |
| chromeOS | boolean | No | Is running on chromeOS? |
| cordova | boolean | No | Is the game running under Apache Cordova? |
| crosswalk | boolean | No | Is the game running under the Intel Crosswalk XDK? |
| desktop | boolean | No | Is running on a desktop? |
| ejecta | boolean | No | Is the game running under Ejecta? |
| electron | boolean | No | Is the game running under GitHub Electron? |
| iOS | boolean | No | Is running on iOS? |
| iPad | boolean | No | Is running on iPad? |
| iPhone | boolean | No | Is running on iPhone? |
| kindle | boolean | No | Is running on an Amazon Kindle? |
| linux | boolean | No | Is running on Linux? |
| macOS | boolean | No | Is running on macOS? |
| node | boolean | No | Is the game running under Node.js? |
| nodeWebkit | boolean | No | Is the game running under Node-Webkit? |
| webApp | boolean | No | Set to true if running as a WebApp, i.e. within a WebView |
| windows | boolean | No | Is running on Windows? |
| windowsPhone | boolean | No | Is running on a Windows Phone? |
| iOSVersion | number | No | If running in iOS this will contain the major version number. |
| pixelRatio | number | No | The pixel ratio of the host device. |
Type: object
Member of: Phaser.Device
Source: src/device/OS.js#L7
Since: 3.0.0
Video
<static> Video
Determines the video support of the browser running this Phaser Game instance.
These values are read-only and populated during the boot sequence of the game.
They are then referenced by internal game systems and are available for you to access
via this.sys.game.device.video from within any Scene.
| name | type | optional | description |
|---|---|---|---|
| h264 | boolean | No | Can this device play h264 mp4 video files? |
| hls | boolean | No | Can this device play hls video files? |
| mov | boolean | No | Can this device play mov video files? |
| mp4 | boolean | No | Can this device play h264 mp4 video files? |
| m4v | boolean | No | Can this device play m4v (typically mp4) video files? |
| ogg | boolean | No | Can this device play ogg video files? |
| vp9 | boolean | No | Can this device play vp9 video files? |
| webm | boolean | No | Can this device play webm video files? |
| hasRequestVideoFrame | boolean | No | Does this device support the requestVideoFrameCallback API? |
| getVideoURL | function | No | Given an array of video URLs (or a single URL string), returns an object with url and type properties for the first entry that can be played by this browser, or null if none of the provided formats are supported. |
Type: object
Member of: Phaser.Device
Source: src/device/Video.js#L9
Since: 3.0.0