mirror of
https://github.com/videojs/video.js.git
synced 2025-01-10 23:30:03 +02:00
fix(player): silence rejected fullscreen promise (#5970)
The fullscreen API now returns a promise. If the player is inside an iframe that doesn't allow fullscreen, the promise will reject and cause an error to be logged. Instead, we should silence this promise. Fixes #5918
This commit is contained in:
parent
1eb47f0690
commit
4585c08bdb
@ -2684,7 +2684,7 @@ class Player extends Component {
|
|||||||
// events
|
// events
|
||||||
Events.on(document, fsApi.fullscreenchange, this.boundDocumentFullscreenChange_);
|
Events.on(document, fsApi.fullscreenchange, this.boundDocumentFullscreenChange_);
|
||||||
|
|
||||||
this.el_[fsApi.requestFullscreen]();
|
silencePromise(this.el_[fsApi.requestFullscreen]());
|
||||||
|
|
||||||
} else if (this.tech_.supportsFullScreen()) {
|
} else if (this.tech_.supportsFullScreen()) {
|
||||||
// we can't take the video.js controls fullscreen but we can go fullscreen
|
// we can't take the video.js controls fullscreen but we can go fullscreen
|
||||||
@ -2714,7 +2714,7 @@ class Player extends Component {
|
|||||||
|
|
||||||
// Check for browser element fullscreen support
|
// Check for browser element fullscreen support
|
||||||
if (fsApi.requestFullscreen) {
|
if (fsApi.requestFullscreen) {
|
||||||
document[fsApi.exitFullscreen]();
|
silencePromise(document[fsApi.exitFullscreen]());
|
||||||
} else if (this.tech_.supportsFullScreen()) {
|
} else if (this.tech_.supportsFullScreen()) {
|
||||||
this.techCall_('exitFullScreen');
|
this.techCall_('exitFullScreen');
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user