From f1634b260e30562b94c9f3a033d83fd2e07bbac4 Mon Sep 17 00:00:00 2001 From: tsukumi Date: Sat, 31 Dec 2022 05:45:21 +0900 Subject: [PATCH] update: adjust error message when Picture-in-Picture failed to start --- src/js/controller.js | 9 +++++++-- src/js/i18n.js | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/js/controller.js b/src/js/controller.js index 3989f7f72..a07ccbb08 100644 --- a/src/js/controller.js +++ b/src/js/controller.js @@ -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(); diff --git a/src/js/i18n.js b/src/js/i18n.js index 8f237f62f..ab41a6dfb 100644 --- a/src/js/i18n.js +++ b/src/js/i18n.js @@ -169,7 +169,7 @@ const tranTxt = { 'Setting': '設定', 'Full screen': 'フルスクリーン', 'Web full screen': 'ブラウザフルスクリーン', - 'Picture-in-Picture': 'ピクチャーインピクチャー', + 'Picture-in-Picture': 'Picture-in-Picture', 'Send': 'コメントする', 'Screenshot': 'スクリーンショット', 's': '秒',