Skip to content

Commit

Permalink
update: adjust error message when Picture-in-Picture failed to start
Browse files Browse the repository at this point in the history
  • Loading branch information
tsukumijima committed Dec 30, 2022
1 parent 31b3412 commit f1634b2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions src/js/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,13 @@ class Controller {
if (document.pictureInPictureEnabled) {
this.player.template.pipButton.addEventListener('click', () => {
if (!document.pictureInPictureElement) {
this.player.video.requestPictureInPicture().catch(() => {
this.player.notice('Error: Picture-in-Picture is not supported.');
this.player.video.requestPictureInPicture().catch((reason) => {
console.error(reason);
if (this.player.options.lang === 'ja' || this.player.options.lang === 'ja-jp') {
this.player.notice('Picture-in-Picture を開始できませんでした。');
} else {
this.player.notice('Picture-in-Picture failed to start.');
}
});
} else {
document.exitPictureInPicture();
Expand Down
2 changes: 1 addition & 1 deletion src/js/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ const tranTxt = {
'Setting': '設定',
'Full screen': 'フルスクリーン',
'Web full screen': 'ブラウザフルスクリーン',
'Picture-in-Picture': 'ピクチャーインピクチャー',
'Picture-in-Picture': 'Picture-in-Picture',
'Send': 'コメントする',
'Screenshot': 'スクリーンショット',
's': '秒',
Expand Down

0 comments on commit f1634b2

Please sign in to comment.