Skip to content

Commit

Permalink
another solution
Browse files Browse the repository at this point in the history
  • Loading branch information
yairans committed Oct 18, 2020
1 parent 3ce5be8 commit 258050c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/engines/html5/html5.js
Original file line number Diff line number Diff line change
Expand Up @@ -530,12 +530,10 @@ export default class Html5 extends FakeEventTarget implements IEngine {
*/
exitPictureInPicture(): void {
try {
if (typeof this._el.webkitSetPresentationMode === 'function') {
this._el.webkitSetPresentationMode('inline');
} else if (document.pictureInPictureEnabled && typeof document.exitPictureInPicture === 'function') {
// Currently it's supported in chrome and in safari. So if we consider checking support before,
// we can use this flag to distinguish between the two. In the future we might need a different method.
// Second condition is because flow does not support this API yet
// Currently it's supported in chrome and in safari. So if we consider checking support before,
// we can use this flag to distinguish between the two. In the future we might need a different method.
// Second condition is because flow does not support this API yet
if (document.pictureInPictureEnabled && typeof document.exitPictureInPicture === 'function' && this._el === document.pictureInPictureElement) {
document.exitPictureInPicture().catch(error => {
this.dispatchEvent(
new FakeEvent(
Expand All @@ -544,6 +542,8 @@ export default class Html5 extends FakeEventTarget implements IEngine {
)
);
});
} else if (typeof this._el.webkitSetPresentationMode === 'function') {
this._el.webkitSetPresentationMode('inline');
}
} catch (error) {
this.dispatchEvent(
Expand Down

0 comments on commit 258050c

Please sign in to comment.