- Version
- 1.1.0
- License
- MIT
- Requires
- DomSmith
- Source
- FullScreen.js, line 13
Constructor
new FullScreen(player, parent, optionsopt)
Creates an instance of the FullScreen component.
| Name | Type | Attributes | Description | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
player |
Player |
Reference to the VisionPlayer instance. |
|||||||||
parent |
Controller |
Reference to the parent instance. |
|||||||||
options |
Object | optional |
Additional options.
|
Members
private #config :Object
Holds the instance configuration for this component.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
orientationLock
|
string | optional | 'none' | Controls screen orientation behaviour while in fullscreen. Allowed values: 'none', 'auto', 'landscape', 'portrait'. |
- Type
- Object
- Source
- FullScreen.js, line 20
private #player :Player
Reference to the media player instance.
- Type
- Player
- Source
- FullScreen.js, line 28
private #subscriptions :Array<number>
Array of subscription callbacks for player events.
- Type
- Array<number>
- Source
- FullScreen.js, line 34
private #apiKey :symbol
Secret key only known to the player instance and initialized components. Used to be able to restrict access to API methods in conjunction with secure mode.
- Type
- symbol
- Source
- FullScreen.js, line 41
private #dom :DomSmith
The fullscreen button icon, created by DomSmith.
- Type
- DomSmith
- Source
- FullScreen.js, line 47
private #fsApi :FullScreen~fsApiNames
This object delivers an abstract interface to the browsers fullscreen API by mapping the standard method, event and property names to the ones the current browser actually understands. It is necessary to use such an abstraction, because some older browsers use special vendor prefixed names.
- Type
- FullScreen~fsApiNames
- Source
- FullScreen.js, line 54
private #isFullScreen :boolean
Flag indicating whether the player is in fullscreen mode.
- Type
- boolean
- Source
- FullScreen.js, line 60
private #isPlaying :boolean
Flag indicating whether the player is currently playing (used for certain iOS handling).
- Type
- boolean
- Source
- FullScreen.js, line 66
private #isPlayingDelay :number
Timer reference for delayed checks on iOS play/pause states.
- Type
- number
- Source
- FullScreen.js, line 72
private #previousOrientation :string|undefined
Stores the previous orientation before applying a lock.
- Type
- string | undefined
- Source
- FullScreen.js, line 78
private #orientationLocked :boolean
Tracks whether an orientation lock was applied successfully.
- Type
- boolean
- Source
- FullScreen.js, line 84
Methods
private #initFullScreenApi() → FullScreen~fsApiNames|false
Initializes the Fullscreen API based on the browser's support.
- Returns
-
Returns name map, or 'false' if no matches were found.
- Type FullScreen~fsApiNames | false
- Source
- FullScreen.js, line 144
private #onDataReady(mediaItem)
Sets up the component once the media data is available. Disables fullscreen for iOS audio, otherwise enables the fullscreen button.
| Name | Type | Description | ||||||
|---|---|---|---|---|---|---|---|---|
mediaItem |
Data~mediaItem |
Object containing media type info.
|
- Listens
- data/ready
- Source
- FullScreen.js, line 168
private #togglePlayPause(event, topic)
Toggles the internal isPlaying flag based on play/pause events.
On iOS, used to track whether the player was playing when fullscreen ended.
| Name | Type | Description |
|---|---|---|
event |
null |
No Payload. |
topic |
Event |
The event topic ('media/play' or 'media/pause'). |
- Listens
- media/play
- media/pause
- Source
- FullScreen.js, line 186
private #toggleFullScreen()
Toggles fullscreen mode on or off.
- Source
- FullScreen.js, line 211
private #launchFullScreen(elementopt)
Launches fullscreen mode using the fullscreen API or iOS-specific method.
| Name | Type | Attributes | Description |
|---|---|---|---|
element |
HTMLElement | optional |
The element to enter fullscreen (defaults to player root if not provided). |
- Throws
-
If fullscreen cannot be initiated.
Type Error - Source
- FullScreen.js, line 226
private #onFullScreen()
Handler for native fullscreen events.
- Type
- function
- Source
- FullScreen.js, line 243
private #cancelFullScreen()
Cancels fullscreen mode.
- Throws
-
If fullscreen cannot be exited.
Type Error - Source
- FullScreen.js, line 257
private #enterFullScreen()
Called when fullscreen mode is launched.
- Fires
- fullscreen/enter
- Listens
- media/webkitbeginfullscreen
- Source
- FullScreen.js, line 273
private #exitFullScreen()
Called when fullscreen mode is cancelled or exited. Handles iOS quirks regarding playback resumption.
- Fires
- fullscreen/leave
- Listens
- media/webkitendfullscreen
- Source
- FullScreen.js, line 290
destroy()
Removes all events, subscriptions and DOM nodes created by this component.
- Source
- FullScreen.js, line 311
private #lockOrientation()
Determines and applies the desired orientation lock when entering fullscreen.
- Source
- FullScreen.js, line 327
private #restoreOrientation(preExitopt)
Restores the previous orientation if a lock had been applied.
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
preExit |
boolean | optional | false |
If true, relock to previous orientation while still in fullscreen (before exiting). |
- Source
- FullScreen.js, line 356
private #getOrientationLockTarget() → string|null
Evaluates which orientation should be locked based on config, media and device orientation.
- Returns
-
Desired orientation lock or null if no lock should be applied.
- Type string | null
- Source
- FullScreen.js, line 377
Type Definitions
fsApiNames
The object used to map browser specific fullscreen API names to the 'official' ones.
| Name | Type | Description |
|---|---|---|
exitFullscreen
|
string | Name for the method which is used for exiting fullscreen mode. |
fullscreenElement
|
string | Returns the Element that is currently being presented in full-screen mode in this document, or null if full-screen mode is not currently in use. |
fullscreenEnabled
|
string | Name for the property which returns a Boolean that reports whether or not full-screen mode is available. |
fullscreenchange
|
string | Name for the onfullscreenchange event, which is fired when the browser is switched to/out-of fullscreen mode. |
fullscreenerror
|
string | Name for the fullscreenerror event, which is fired when the browser cannot switch to fullscreen mode. |
requestFullscreen
|
string | Name for the requestFullscreen method, which issues an asynchronous request to make the element be displayed full-screen. |
- Type
- Object<string>
- Source
- FullScreen.js, line 404
Events
fullscreen/enter
Fired when the player enters fullscreen mode.
- Listeners
- Subtitles#oniOSFullScreen
- Source
- FullScreen.js, line 415
fullscreen/leave
Fired when the player exits fullscreen mode.
- Listeners
- Subtitles#oniOSFullScreen
- Source
- FullScreen.js, line 420