Skip to content

Commit

Permalink
Don't make it async
Browse files Browse the repository at this point in the history
  • Loading branch information
rsolomakhin committed Oct 22, 2024
1 parent f273851 commit c3bb1e1
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions pr/picture-in-picture/payment-handler/pr.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ function onBuyClicked() { // eslint-disable-line no-unused-vars
/**
* Toggles the picture-in-picture (on or off).
*/
async function togglePictureInPicture() {
function togglePictureInPicture() {
if (document.pictureInPictureElement) {
document.exitPictureInPicture();
} else if (document.pictureInPictureEnabled) {
Expand All @@ -96,10 +96,8 @@ async function togglePictureInPicture() {
error('Cannot find the video on the page.');
return;
}
try {
await video.requestPictureInPicture();
} catch (error) {
video.requestPictureInPicture().catch((e) => {
error('Failed to request picture-in-picture: \'' + e.message + '\'');
}
});
}
}

0 comments on commit c3bb1e1

Please sign in to comment.