Skip to content

Bug: TypeError when calling fullscreen methods after tech is unloaded #9181

@ai-bughunter

Description

@ai-bughunter

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

  1. Create a player on a device without native Fullscreen API support
  2. Call player.unloadTech() or switch tech (which sets this.tech_ = false)
  3. Call player.requestFullscreen() or player.exitFullscreen()
  4. 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) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions