Bug: TypeError when calling fullscreen methods after tech is unloaded
Severity: Medium
Files: src/js/player.js
Lines: 3038, 3096
Description
In requestFullscreenHelper_() and exitFullscreenHelper_(), the code calls this.tech_.supportsFullScreen() without checking if this.tech_ is a valid tech instance.
After unloadTech_() is called, this.tech_ is set to false (line 1338). On devices/browsers that don't support the native Fullscreen API (e.g., older iOS Safari), the code falls through to the tech fullscreen check, which throws:
TypeError: this.tech_.supportsFullScreen is not a function
Affected code
Line 3038:
} else if (this.tech_.supportsFullScreen() && !this.options_.preferFullWindow === true) {
Line 3096:
} else if (this.tech_.supportsFullScreen() && !this.options_.preferFullWindow === true) {
Reproduction
- Create a player on a device without native Fullscreen API support
- Call
player.unloadTech() or switch tech (which sets this.tech_ = false)
- Call
player.requestFullscreen() or player.exitFullscreen()
- Result: TypeError
Suggested fix
// Change from:
} else if (this.tech_.supportsFullScreen() && !this.options_.preferFullWindow === true) {
// To:
} else if (this.tech_ && this.tech_.supportsFullScreen() && this.options_.preferFullWindow !== true) {
Bug: TypeError when calling fullscreen methods after tech is unloaded
Severity: Medium
Files:
src/js/player.jsLines: 3038, 3096
Description
In
requestFullscreenHelper_()andexitFullscreenHelper_(), the code callsthis.tech_.supportsFullScreen()without checking ifthis.tech_is a valid tech instance.After
unloadTech_()is called,this.tech_is set tofalse(line 1338). On devices/browsers that don't support the native Fullscreen API (e.g., older iOS Safari), the code falls through to the tech fullscreen check, which throws:Affected code
Line 3038:
Line 3096:
Reproduction
player.unloadTech()or switch tech (which setsthis.tech_ = false)player.requestFullscreen()orplayer.exitFullscreen()Suggested fix