Skip to content

Commit

Permalink
re-fire contextmenu
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonocasey committed Oct 24, 2018
1 parent 33a5ca9 commit 388529f
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/js/resize-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class ResizeManager extends Component {
this.ResizeObserver = options.ResizeObserver || window.ResizeObserver;
this.loadListener_ = null;
this.resizeObserver_ = null;
this.handleContextmenu_ = this.handleContextmenu_.bind(this);
this.debouncedHandler_ = debounce(() => {
this.resizeHandler();
}, 100, false, this);
Expand All @@ -72,6 +73,7 @@ class ResizeManager extends Component {
}

Events.on(this.el_.contentWindow, 'resize', this.debouncedHandler_);
Events.on(this.el_.contentWindow, 'contextmenu', this.handleContextmenu_);
};

this.one('load', this.loadListener_);
Expand All @@ -84,6 +86,18 @@ class ResizeManager extends Component {
});
}

/**
* Due to an issue on safari, the iframe for this object takes over
* right clicks on the player. So we have to re-trigger them from the
* iframe to the player.
* @see https://github.com/videojs/video.js/pull/5522
*
* @param {Event} e the contextmenu event that fired
*/
handleContextmenu_(e) {
this.player_.trigger(e);
}

/**
* Called when a resize is triggered on the iframe or a resize is observed via the ResizeObserver
*
Expand Down Expand Up @@ -119,6 +133,7 @@ class ResizeManager extends Component {

if (this.el_ && this.el_.contentWindow) {
Events.off(this.el_.contentWindow, 'resize', this.debouncedHandler_);
Events.off(this.el_.contentWindow, 'contextmenu', this.handleContextmenu_);
}

if (this.loadListener_) {
Expand Down

0 comments on commit 388529f

Please sign in to comment.