@kangsicj/nexussync 1.2.1 โ†’ 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  <br>
6
6
 
7
- [![Version](https://img.shields.io/badge/version-1.2.1-7C4DFF?style=for-the-badge)](./CHANGELOG.md)
7
+ [![Version](https://img.shields.io/badge/version-1.3.0-7C4DFF?style=for-the-badge)](./CHANGELOG.md)
8
8
  [![Tampermonkey](https://img.shields.io/badge/Tampermonkey-PC%20%C2%B7%20Android-00485B?style=for-the-badge&logo=tampermonkey&logoColor=white)](https://www.tampermonkey.net/)
9
9
  [![iOS Safari](https://img.shields.io/badge/Userscripts-iPhone%20%C2%B7%20iPad-0A84FF?style=for-the-badge&logo=safari&logoColor=white)](https://apps.apple.com/app/userscripts/id1463298887)
10
10
  [![Sponsor](https://img.shields.io/badge/Fairy-Sponsor-FF6FB5?style=for-the-badge&logo=githubsponsors&logoColor=white)](https://fairy.hada.io/@jinny)
@@ -61,7 +61,7 @@ Draw a quick circle around that actor and it glows on everyone's screen โ€” on t
61
61
  <td valign="top">
62
62
 
63
63
  ### ๐Ÿง  Live AI subtitles
64
- No subtitles on that video? Turn on live speech recognition with translation into your language, with a glossary for names and terms so characters are always spelled right.
64
+ No subtitles on that video? Pick your language, choose **video sound** and press Start โ€” NexusSync listens to the video itself and writes live, translated subtitles, with a glossary so names are always spelled right.
65
65
 
66
66
  </td>
67
67
  </tr>
@@ -8,7 +8,7 @@
8
8
  // @icon https://cdn.jsdelivr.net/npm/@kangsicj/nexussync@latest/assets/icon.svg
9
9
  // @updateURL https://cdn.jsdelivr.net/npm/@kangsicj/nexussync@latest/dist/NexusSync.meta.js
10
10
  // @downloadURL https://cdn.jsdelivr.net/npm/@kangsicj/nexussync@latest/dist/NexusSync.user.js
11
- // @version 1.2.1
11
+ // @version 1.3.0
12
12
  // @description Watch any web video together in perfect sync: cinema mode, live AI subtitles & translation, chat bubbles with auto-translation, quick ink, cover, go-together to the next episode.
13
13
  // @description:ko ์–ด๋–ค ์›น ์˜์ƒ์ด๋“  ์™„๋ฒฝํ•œ ์‹ฑํฌ๋กœ ํ•จ๊ป˜ ๋ณด๊ธฐ: ์‹œ๋„ค๋งˆ ๋ชจ๋“œ, ์‹ค์‹œ๊ฐ„ AI ์ž๋ง‰ยท๋ฒˆ์—ญ, ์ž๋™ ๋ฒˆ์—ญ ๋งํ’์„  ์ฑ„ํŒ…, ์ž ๊น ๊ทธ๋ฆฌ๊ธฐ, ๊ฐ€๋ฆฌ๊ธฐ, ๋‹ค์Œ ํ™”๋„ ํ•จ๊ป˜.
14
14
  // @match *://*/*
@@ -8,7 +8,7 @@
8
8
  // @icon https://cdn.jsdelivr.net/npm/@kangsicj/nexussync@latest/assets/icon.svg
9
9
  // @updateURL https://cdn.jsdelivr.net/npm/@kangsicj/nexussync@latest/dist/NexusSync.meta.js
10
10
  // @downloadURL https://cdn.jsdelivr.net/npm/@kangsicj/nexussync@latest/dist/NexusSync.user.js
11
- // @version 1.2.1
11
+ // @version 1.3.0
12
12
  // @description Watch any web video together in perfect sync: cinema mode, live AI subtitles & translation, chat bubbles with auto-translation, quick ink, cover, go-together to the next episode.
13
13
  // @description:ko ์–ด๋–ค ์›น ์˜์ƒ์ด๋“  ์™„๋ฒฝํ•œ ์‹ฑํฌ๋กœ ํ•จ๊ป˜ ๋ณด๊ธฐ: ์‹œ๋„ค๋งˆ ๋ชจ๋“œ, ์‹ค์‹œ๊ฐ„ AI ์ž๋ง‰ยท๋ฒˆ์—ญ, ์ž๋™ ๋ฒˆ์—ญ ๋งํ’์„  ์ฑ„ํŒ…, ์ž ๊น ๊ทธ๋ฆฌ๊ธฐ, ๊ฐ€๋ฆฌ๊ธฐ, ๋‹ค์Œ ํ™”๋„ ํ•จ๊ป˜.
14
14
  // @match *://*/*
@@ -43,12 +43,12 @@
43
43
 
44
44
  // The version of the code that is actually running (the manager's metadata can lag
45
45
  // behind when an old copy is still installed).
46
- const NXU_VERSION = '1.2.1';
46
+ const NXU_VERSION = '1.3.0';
47
47
  // Rank used by the one-instance guard below and to tell newer builds apart in a room.
48
48
  // It is independent of the public version (1.0.0 is the first public release, after
49
49
  // private builds that reached ranks up to 10.2.0), so every older copy still installed
50
50
  // steps aside instead of this release.
51
- const NXU_RANK = '11.2.1';
51
+ const NXU_RANK = '11.3.0';
52
52
  const NXU_SESSION = Math.random().toString(36).slice(2, 10); // this page load // raise with every release
53
53
  // App icon (same artwork as assets/icon.svg / @icon), inlined so it shows offline too.
54
54
  const NXU_ICON = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTYgMjU2IiByb2xlPSJpbWciIGFyaWEtbGFiZWw9Ik5leHVzU3luYyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJueGJnIiB4MT0iMCIgeTE9IjAiIHgyPSIxIiB5Mj0iMSI+PHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSIjNWIyZWZmIi8+PHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjZmY0ZmEzIi8+PC9saW5lYXJHcmFkaWVudD48cmFkaWFsR3JhZGllbnQgaWQ9Im54Z2xvdyIgY3g9IjAuODIiIGN5PSIwLjE0IiByPSIwLjciPjxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iIzdjZjlmZiIgc3RvcC1vcGFjaXR5PSIwLjU1Ii8+PHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjN2NmOWZmIiBzdG9wLW9wYWNpdHk9IjAiLz48L3JhZGlhbEdyYWRpZW50PjxsaW5lYXJHcmFkaWVudCBpZD0ibnhwbGF5IiB4MT0iMCIgeTE9IjAiIHgyPSIxIiB5Mj0iMSI+PHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSIjZmZmZmZmIi8+PHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjZmZlM2YxIi8+PC9saW5lYXJHcmFkaWVudD48Y2xpcFBhdGggaWQ9Im54ciI+PHJlY3Qgd2lkdGg9IjI1NiIgaGVpZ2h0PSIyNTYiIHJ4PSI1OCIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNueHIpIj48cmVjdCB3aWR0aD0iMjU2IiBoZWlnaHQ9IjI1NiIgZmlsbD0idXJsKCNueGJnKSIvPjxyZWN0IHdpZHRoPSIyNTYiIGhlaWdodD0iMjU2IiBmaWxsPSJ1cmwoI254Z2xvdykiLz48ZyBmaWxsPSJub25lIiBzdHJva2U9IiNmZmZmZmYiIHN0cm9rZS13aWR0aD0iMTUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCI+PHBhdGggZD0iTTYwIDExNiBBNzAgNzAgMCAwIDEgMTc4IDcyIi8+PHBhdGggZD0iTTE5NiAxNDAgQTcwIDcwIDAgMCAxIDc4IDE4NCIvPjwvZz48cGF0aCBkPSJNMTg2IDUwIEwyMDAgOTIgTDE1NyA4NiBaIiBmaWxsPSIjZmZmZmZmIi8+PHBhdGggZD0iTTcwIDIwNiBMNTYgMTY0IEw5OSAxNzAgWiIgZmlsbD0iI2ZmZmZmZiIvPjxwYXRoIGQ9Ik0xMTAgOTIgUTEwNCA4OCAxMDQgOTYgTDEwNCAxNjAgUTEwNCAxNjggMTEwIDE2NCBMMTYyIDEzMiBRMTY4IDEyOCAxNjIgMTI0IFoiIGZpbGw9InVybCgjbnhwbGF5KSIvPjwvZz48L3N2Zz4=';
@@ -671,17 +671,28 @@
671
671
  subtitleLanguage: 'Translate subtitles to', audioSource: 'Audio source', audioAuto: 'Auto (video audio when possible + mic)', audioMic: 'Microphone only',
672
672
  audioMedia: 'Video / tab audio only', audioDual: 'Microphone + video audio',
673
673
  audioHelp: 'Auto listens to the page video directly when the browser allows it, otherwise through the microphone (turn the speaker volume up).',
674
+ heardSound: 'What to listen to', srcMedia: '๐ŸŽฌ Video sound (recommended)', srcMic: '๐ŸŽค Microphone',
675
+ srcMediaHelp: 'Listens to the video itself โ€” no speakers needed. If the browser asks what to share, pick this tab and turn on โ€œShare tab audioโ€.',
676
+ srcMicHelp: 'Listens through the microphone: play the video out loud through the speakers (not headphones).',
677
+ srcIosHelp: 'On iPhone and iPad, Safari can only listen through the microphone โ€” play the video through the speaker.',
678
+ videoLanguage: 'Language spoken in the video', subtitleLanguageReq: 'Subtitle language (required)', chooseLanguage: 'โ€” Choose a language โ€”',
679
+ subPickLanguage: 'Choose the subtitle language first.', subAskMic: '๐ŸŽค Tap โ€œAllowโ€ when the browser asks for the microphone.',
680
+ subAskTab: '๐ŸŽฌ Choose this tab and turn on โ€œShare tab audioโ€, then press Share.',
681
+ subMicBlockedSite: 'This site does not allow the microphone โ€” listening to the video sound instead.',
682
+ subMicBlockedNoMedia: 'This site does not allow the microphone, and the video sound cannot be captured here.',
683
+ subUsingMicFallback: 'The video sound could not be heard directly โ€” listening through the microphone (turn the speakers up).',
684
+ subTabShareEnded: 'Tab audio sharing stopped, so subtitles were turned off.',
674
685
  subPosition: 'Subtitle position', posVideo: 'Over the video', posScreen: 'Bottom of the screen', subSize: 'Size', subOpacity: 'Opacity',
675
686
  advanced: 'Advanced', translationEngine: 'Translation engine', providerAuto: 'Google first, on-device as backup (best quality)', providerBrowser: 'On-device only (private)',
676
687
  providerGoogle: 'Google only', providerHelp: 'Online translation reads whole sentences far better; the on-device model shows the live line and steps in when offline.',
677
688
  localFirst: 'Prefer on-device speech recognition', localFirstHelp: 'Uses the offline speech model when the browser has it installed.',
678
689
  hotkeyHelp: 'Shortcuts: Alt+Shift+T subtitles ยท Alt+Shift+C cinema ยท Alt+Shift+N menu ยท in cinema: Space, โ†/โ†’, โ†‘/โ†“, M, F',
679
- subStart: 'Start subtitles', subStop: 'Stop subtitles', subStarting: 'Startingโ€ฆ', subStatusIdle: 'Ready. Press Start, then allow microphone access if asked.',
690
+ subStart: 'Start subtitles', subStop: 'Stop subtitles', subStarting: 'Startingโ€ฆ', subStatusIdle: 'Ready. Choose the languages, then press Start.',
680
691
  subStatusStarting: 'Preparing audio inputโ€ฆ', subListening: 'Listening', auto: 'Auto', inputMic: 'mic', inputMedia: 'video audio',
681
692
  engineLocal: 'on-device', engineOnline: 'online', translation: 'Translation', recognition: 'Recognition', speaker: 'Speaker', time: 'Time', confidence: 'Confidence',
682
693
  speakerMic: 'Mic', speakerMedia: 'Video', speakerMixed: 'Mixed',
683
694
  subOn: '๐ŸŽ™๏ธ AI subtitles ON', subOff: '๐Ÿ”‡ AI subtitles OFF', subUnsupported: 'This browser has no speech recognition. Use Chrome, Edge or Safari.',
684
- subNeedsHttps: 'Subtitles need a secure (https) page.', subMicDenied: '๐ŸŽ™๏ธ Microphone access was blocked. Allow it in the site settings and try again.',
695
+ subNeedsHttps: 'Subtitles need a secure (https) page.', subMicDenied: '๐ŸŽค Microphone access is off. Click the ๐Ÿ”’ icon left of the address bar, set Microphone to โ€œAllowโ€, then try again.',
685
696
  subMicUnavailable: '๐ŸŽ™๏ธ No audio input available.', subNoMic: '๐ŸŽ™๏ธ No microphone found.', subServiceBlocked: 'The speech service is not available in this browser.',
686
697
  subNetworkFailed: 'Speech service unreachable. Check the connection and start again.', subLangUnsupported: 'This language is not supported for recognition.',
687
698
  subStalled: 'Speech recognition keeps failing. Please start again.', subWebAudioUnavailable: 'Video audio unavailable here โ€” using the microphone.',
@@ -754,17 +765,28 @@
754
765
  subtitleLanguage: '์ž๋ง‰ ๋ฒˆ์—ญ ์–ธ์–ด', audioSource: '์˜ค๋””์˜ค ์ž…๋ ฅ', audioAuto: '์ž๋™ (๊ฐ€๋Šฅํ•˜๋ฉด ์˜์ƒ ์†Œ๋ฆฌ + ๋งˆ์ดํฌ)', audioMic: '๋งˆ์ดํฌ๋งŒ',
755
766
  audioMedia: '์˜์ƒ/ํƒญ ์†Œ๋ฆฌ๋งŒ', audioDual: '๋งˆ์ดํฌ + ์˜์ƒ ์†Œ๋ฆฌ',
756
767
  audioHelp: '์ž๋™์€ ๋ธŒ๋ผ์šฐ์ €๊ฐ€ ํ—ˆ์šฉํ•˜๋ฉด ํŽ˜์ด์ง€ ์˜์ƒ ์†Œ๋ฆฌ๋ฅผ ์ง์ ‘ ๋“ฃ๊ณ , ์•„๋‹ˆ๋ฉด ๋งˆ์ดํฌ๋กœ ๋“ฃ์Šต๋‹ˆ๋‹ค (์Šคํ”ผ์ปค ๋ณผ๋ฅจ์„ ๋†’์—ฌ ์ฃผ์„ธ์š”).',
768
+ heardSound: '๋“ค์„ ์†Œ๋ฆฌ', srcMedia: '๐ŸŽฌ ์˜์ƒ ์†Œ๋ฆฌ (๊ถŒ์žฅ)', srcMic: '๐ŸŽค ๋งˆ์ดํฌ',
769
+ srcMediaHelp: '์˜์ƒ ์†Œ๋ฆฌ๋ฅผ ์ง์ ‘ ๋“ค์–ด์š”. ๋ธŒ๋ผ์šฐ์ €๊ฐ€ ๊ณต์œ ํ•  ํ™”๋ฉด์„ ๋ฌผ์œผ๋ฉด ์ด ํƒญ์„ ๊ณ ๋ฅด๊ณ  โ€œํƒญ ์˜ค๋””์˜ค ๊ณต์œ โ€๋ฅผ ์ผœ ์ฃผ์„ธ์š”.',
770
+ srcMicHelp: '๋งˆ์ดํฌ๋กœ ๋“ค์–ด์š”. ์˜์ƒ ์†Œ๋ฆฌ๋ฅผ ์ด์–ดํฐ์ด ์•„๋‹Œ ์Šคํ”ผ์ปค๋กœ ํฌ๊ฒŒ ํ‹€์–ด ์ฃผ์„ธ์š”.',
771
+ srcIosHelp: '์•„์ดํฐยท์•„์ดํŒจ๋“œ์˜ Safari๋Š” ๋งˆ์ดํฌ๋กœ๋งŒ ๋“ค์„ ์ˆ˜ ์žˆ์–ด์š”. ์˜์ƒ์„ ์Šคํ”ผ์ปค๋กœ ์žฌ์ƒํ•ด ์ฃผ์„ธ์š”.',
772
+ videoLanguage: '์˜์ƒ ์† ์–ธ์–ด', subtitleLanguageReq: '์ž๋ง‰ ์–ธ์–ด (ํ•„์ˆ˜)', chooseLanguage: 'โ€” ์–ธ์–ด๋ฅผ ์„ ํƒํ•˜์„ธ์š” โ€”',
773
+ subPickLanguage: '๋จผ์ € ์ž๋ง‰ ์–ธ์–ด๋ฅผ ์„ ํƒํ•ด ์ฃผ์„ธ์š”.', subAskMic: '๐ŸŽค ๋ธŒ๋ผ์šฐ์ €๊ฐ€ ๋งˆ์ดํฌ ๊ถŒํ•œ์„ ๋ฌผ์œผ๋ฉด โ€œํ—ˆ์šฉโ€์„ ๋ˆŒ๋Ÿฌ ์ฃผ์„ธ์š”.',
774
+ subAskTab: '๐ŸŽฌ ์ด ํƒญ์„ ๊ณ ๋ฅด๊ณ  โ€œํƒญ ์˜ค๋””์˜ค ๊ณต์œ โ€๋ฅผ ์ผ  ๋’ค ๊ณต์œ ๋ฅผ ๋ˆŒ๋Ÿฌ ์ฃผ์„ธ์š”.',
775
+ subMicBlockedSite: '์ด ์‚ฌ์ดํŠธ๋Š” ๋งˆ์ดํฌ ์‚ฌ์šฉ์„ ๋ง‰์•„ ๋‘์—ˆ์–ด์š”. ์˜์ƒ ์†Œ๋ฆฌ๋กœ ๋“ค์„๊ฒŒ์š”.',
776
+ subMicBlockedNoMedia: '์ด ์‚ฌ์ดํŠธ๋Š” ๋งˆ์ดํฌ ์‚ฌ์šฉ์„ ๋ง‰์•„ ๋‘์—ˆ๊ณ , ์˜์ƒ ์†Œ๋ฆฌ๋„ ๋ฐ›์„ ์ˆ˜ ์—†์–ด์š”.',
777
+ subUsingMicFallback: '์˜์ƒ ์†Œ๋ฆฌ๋ฅผ ์ง์ ‘ ๋“ค์„ ์ˆ˜ ์—†์–ด ๋งˆ์ดํฌ๋กœ ๋“ค์–ด์š”. ์Šคํ”ผ์ปค ์†Œ๋ฆฌ๋ฅผ ํ‚ค์›Œ ์ฃผ์„ธ์š”.',
778
+ subTabShareEnded: 'ํƒญ ์˜ค๋””์˜ค ๊ณต์œ ๊ฐ€ ๋๋‚˜์„œ ์ž๋ง‰์„ ๊ป์–ด์š”.',
757
779
  subPosition: '์ž๋ง‰ ์œ„์น˜', posVideo: '์˜์ƒ ์œ„', posScreen: 'ํ™”๋ฉด ํ•˜๋‹จ', subSize: 'ํฌ๊ธฐ', subOpacity: '๋ถˆํˆฌ๋ช…๋„',
758
780
  advanced: '๊ณ ๊ธ‰', translationEngine: '๋ฒˆ์—ญ ์—”์ง„', providerAuto: 'Google ์šฐ์„ , ๊ธฐ๊ธฐ ๋‚ด ๋ฒˆ์—ญ ๋ณด์กฐ (์ตœ๊ณ  ํ’ˆ์งˆ)', providerBrowser: '๊ธฐ๊ธฐ ๋‚ด ๋ฒˆ์—ญ๋งŒ (๊ฐœ์ธ์ •๋ณด ๋ณดํ˜ธ)',
759
781
  providerGoogle: 'Google๋งŒ', providerHelp: '๋ฌธ์žฅ ๋ฒˆ์—ญ ํ’ˆ์งˆ์€ ์˜จ๋ผ์ธ(Google)์ด ํ›จ์”ฌ ์ข‹์Šต๋‹ˆ๋‹ค. ๊ธฐ๊ธฐ ๋‚ด ๋ชจ๋ธ์€ ์‹ค์‹œ๊ฐ„ ์ž„์‹œ ์ค„๊ณผ ์˜คํ”„๋ผ์ธ ์ƒํ™ฉ์„ ๋งก์Šต๋‹ˆ๋‹ค.',
760
782
  localFirst: '๊ธฐ๊ธฐ ๋‚ด ์Œ์„ฑ ์ธ์‹ ์šฐ์„ ', localFirstHelp: '๋ธŒ๋ผ์šฐ์ €์— ์˜คํ”„๋ผ์ธ ์Œ์„ฑ ๋ชจ๋ธ์ด ์„ค์น˜๋˜์–ด ์žˆ์œผ๋ฉด ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.',
761
783
  hotkeyHelp: '๋‹จ์ถ•ํ‚ค: Alt+Shift+T ์ž๋ง‰ ยท Alt+Shift+C ์‹œ๋„ค๋งˆ ยท Alt+Shift+N ๋ฉ”๋‰ด ยท ์‹œ๋„ค๋งˆ ์ค‘: Space, โ†/โ†’, โ†‘/โ†“, M, F',
762
- subStart: '์ž๋ง‰ ์‹œ์ž‘', subStop: '์ž๋ง‰ ์ค‘์ง€', subStarting: '์‹œ์ž‘ํ•˜๋Š” ์ค‘โ€ฆ', subStatusIdle: '์ค€๋น„๋จ. ์‹œ์ž‘์„ ๋ˆ„๋ฅด๊ณ , ์š”์ฒญ๋˜๋ฉด ๋งˆ์ดํฌ ๊ถŒํ•œ์„ ํ—ˆ์šฉํ•˜์„ธ์š”.',
784
+ subStart: '์ž๋ง‰ ์‹œ์ž‘', subStop: '์ž๋ง‰ ์ค‘์ง€', subStarting: '์‹œ์ž‘ํ•˜๋Š” ์ค‘โ€ฆ', subStatusIdle: '์ค€๋น„๋จ. ์–ธ์–ด๋ฅผ ๊ณ ๋ฅธ ๋’ค ์‹œ์ž‘์„ ๋ˆ„๋ฅด์„ธ์š”.',
763
785
  subStatusStarting: '์˜ค๋””์˜ค ์ž…๋ ฅ ์ค€๋น„ ์ค‘โ€ฆ', subListening: '๋“ฃ๋Š” ์ค‘', auto: '์ž๋™', inputMic: '๋งˆ์ดํฌ', inputMedia: '์˜์ƒ ์†Œ๋ฆฌ',
764
786
  engineLocal: '๊ธฐ๊ธฐ ๋‚ด', engineOnline: '์˜จ๋ผ์ธ', translation: '๋ฒˆ์—ญ', recognition: '์ธ์‹', speaker: 'ํ™”์ž', time: '์‹œ๊ฐ„', confidence: '์‹ ๋ขฐ๋„',
765
787
  speakerMic: '๋งˆ์ดํฌ', speakerMedia: '์˜์ƒ', speakerMixed: 'ํ˜ผํ•ฉ',
766
788
  subOn: '๐ŸŽ™๏ธ AI ์ž๋ง‰ ์ผœ์ง', subOff: '๐Ÿ”‡ AI ์ž๋ง‰ ๊บผ์ง', subUnsupported: '์ด ๋ธŒ๋ผ์šฐ์ €๋Š” ์Œ์„ฑ ์ธ์‹์„ ์ง€์›ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. Chrome, Edge, Safari๋ฅผ ์‚ฌ์šฉํ•˜์„ธ์š”.',
767
- subNeedsHttps: '์ž๋ง‰์€ ๋ณด์•ˆ(https) ํŽ˜์ด์ง€์—์„œ๋งŒ ๋™์ž‘ํ•ฉ๋‹ˆ๋‹ค.', subMicDenied: '๐ŸŽ™๏ธ ๋งˆ์ดํฌ ๊ถŒํ•œ์ด ์ฐจ๋‹จ๋˜์—ˆ์Šต๋‹ˆ๋‹ค. ์‚ฌ์ดํŠธ ์„ค์ •์—์„œ ํ—ˆ์šฉํ•œ ๋’ค ๋‹ค์‹œ ์‹œ๋„ํ•˜์„ธ์š”.',
789
+ subNeedsHttps: '์ž๋ง‰์€ ๋ณด์•ˆ(https) ํŽ˜์ด์ง€์—์„œ๋งŒ ๋™์ž‘ํ•ฉ๋‹ˆ๋‹ค.', subMicDenied: '๐ŸŽค ๋งˆ์ดํฌ ๊ถŒํ•œ์ด ๊บผ์ ธ ์žˆ์–ด์š”. ์ฃผ์†Œ์ฐฝ ์™ผ์ชฝ ๐Ÿ”’(์‚ฌ์ดํŠธ ์ •๋ณด)์—์„œ ๋งˆ์ดํฌ๋ฅผ โ€œํ—ˆ์šฉโ€์œผ๋กœ ๋ฐ”๊พผ ๋’ค ๋‹ค์‹œ ๋ˆŒ๋Ÿฌ ์ฃผ์„ธ์š”.',
768
790
  subMicUnavailable: '๐ŸŽ™๏ธ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ์˜ค๋””์˜ค ์ž…๋ ฅ์ด ์—†์Šต๋‹ˆ๋‹ค.', subNoMic: '๐ŸŽ™๏ธ ๋งˆ์ดํฌ๋ฅผ ์ฐพ์„ ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.', subServiceBlocked: '์ด ๋ธŒ๋ผ์šฐ์ €์—์„œ๋Š” ์Œ์„ฑ ์ธ์‹ ์„œ๋น„์Šค๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค.',
769
791
  subNetworkFailed: '์Œ์„ฑ ์ธ์‹ ์„œ๋ฒ„์— ์—ฐ๊ฒฐํ•  ์ˆ˜ ์—†์Šต๋‹ˆ๋‹ค. ์—ฐ๊ฒฐ์„ ํ™•์ธํ•˜๊ณ  ๋‹ค์‹œ ์‹œ์ž‘ํ•˜์„ธ์š”.', subLangUnsupported: '์ด ์–ธ์–ด๋Š” ์Œ์„ฑ ์ธ์‹์„ ์ง€์›ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.',
770
792
  subStalled: '์Œ์„ฑ ์ธ์‹์ด ๊ณ„์† ์‹คํŒจํ•ฉ๋‹ˆ๋‹ค. ๋‹ค์‹œ ์‹œ์ž‘ํ•ด ์ฃผ์„ธ์š”.', subWebAudioUnavailable: '์ด ํŽ˜์ด์ง€์—์„œ๋Š” ์˜์ƒ ์†Œ๋ฆฌ๋ฅผ ์ง์ ‘ ๋ฐ›์„ ์ˆ˜ ์—†์–ด ๋งˆ์ดํฌ๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.',
@@ -2225,14 +2247,21 @@
2225
2247
  // โ”€โ”€ settings & language helpers
2226
2248
  _settings() {
2227
2249
  return {
2228
- audioMode: STORE.get('nxu_audio_mode', 'auto'),
2250
+ audioMode: this._audioMode(),
2229
2251
  provider: STORE.get('nxu_translation_provider', 'auto'),
2230
2252
  localFirst: STORE.get('nxu_stt_local_first', true) !== false
2231
2253
  };
2232
2254
  },
2255
+ // Two sources only: the video's own sound (default) or the microphone. Older saved
2256
+ // values (auto / dual) mean "video sound". iPhone/iPad Safari can only use the mic.
2257
+ _audioMode() {
2258
+ if (this._isAppleMobile()) return 'mic';
2259
+ return STORE.get('nxu_audio_mode', 'media') === 'mic' ? 'mic' : 'media';
2260
+ },
2261
+ // The subtitle language is always chosen by the user (no guessing): empty until set.
2233
2262
  loadLanguageSettings() {
2234
- const out = baseLang(STORE.get('nxu_subtitle_language', '') || defaultOutputLanguage());
2235
- this.outLang = LANG_BY_CODE.has(out) ? out : defaultOutputLanguage();
2263
+ const out = baseLang(STORE.get('nxu_subtitle_language', '') || '');
2264
+ this.outLang = out && LANG_BY_CODE.has(out) ? out : '';
2236
2265
  const saved = STORE.get('nxu_speaker_language', '');
2237
2266
  this.inLang = this._localeFor(saved) || this._defaultSpeakerLocale();
2238
2267
  },
@@ -2377,11 +2406,66 @@
2377
2406
  if (!audio.length) throw new Error('no audio was shared');
2378
2407
  return new MediaStream(audio);
2379
2408
  },
2409
+ // Is the microphone switched off for this page by the site itself (Permissions-Policy)?
2410
+ // Then the browser refuses at once, without ever asking the user.
2411
+ _micBlockedByPolicy() {
2412
+ try {
2413
+ const pp = document.permissionsPolicy || document.featurePolicy;
2414
+ return !!(pp && typeof pp.allowsFeature === 'function' && !pp.allowsFeature('microphone'));
2415
+ } catch (_) { return false; }
2416
+ },
2417
+ async _micPermissionState() {
2418
+ try { return (await withTimeout(navigator.permissions.query({ name: 'microphone' }), 800)).state || 'unknown'; } catch (_) { return 'unknown'; }
2419
+ },
2420
+ // Does a captured stream carry any sound? Cross-origin or protected media gives a
2421
+ // track of pure digital silence. Only judged while the video is audibly playing.
2422
+ async _hasSignal(stream) {
2423
+ const v = STATE.video;
2424
+ if (!v || v.paused || v.muted || !(v.volume > 0) || typeof v.captureStream !== 'function') return true;
2425
+ const Ctx = window.AudioContext || window.webkitAudioContext;
2426
+ if (!Ctx) return true;
2427
+ let ctx = null;
2428
+ try {
2429
+ ctx = new Ctx();
2430
+ const src = ctx.createMediaStreamSource(stream);
2431
+ const an = ctx.createAnalyser();
2432
+ an.fftSize = 512;
2433
+ src.connect(an);
2434
+ if (ctx.state === 'suspended') { try { await ctx.resume(); } catch (_) { } }
2435
+ const buf = new Float32Array(an.fftSize);
2436
+ let peak = 0;
2437
+ for (let i = 0; i < 12 && peak < 0.0008; i++) {
2438
+ await new Promise(r => setTimeout(r, 120));
2439
+ an.getFloatTimeDomainData(buf);
2440
+ for (let j = 0; j < buf.length; j++) { const x = Math.abs(buf[j]); if (x > peak) peak = x; }
2441
+ }
2442
+ return peak >= 0.0008;
2443
+ } catch (_) { return true; } finally { try { ctx?.close(); } catch (_) { } }
2444
+ },
2445
+ // The video's own sound: the element itself when it gives real audio, otherwise (on a
2446
+ // computer) the tab's audio, which the browser lets the user share in one dialog.
2447
+ async _captureMediaAudio(token) {
2448
+ let web = this._captureElementAudio();
2449
+ if (web && !(await this._hasSignal(web))) {
2450
+ web.getTracks().forEach(tr => tr.stop());
2451
+ web = null;
2452
+ logDebug('AI Sub: the video element gives no sound here (protected or cross-origin media).', 'info');
2453
+ }
2454
+ if (web) { this._webFromElement = true; return web; }
2455
+ if (token !== this._startToken) return null;
2456
+ if (this._isAppleMobile() || this._isAndroid() || !navigator.mediaDevices?.getDisplayMedia) return null;
2457
+ showToast(t('subAskTab'));
2458
+ try { return await this._captureDisplayAudio(); } catch (err) {
2459
+ logDebug('AI Sub: tab audio not shared: ' + (err.message || err.name), 'warn');
2460
+ return null;
2461
+ }
2462
+ },
2380
2463
  async _startAudioCapture(token) {
2381
2464
  this._stopAudioCapture();
2382
- const mode = this._settings().audioMode;
2465
+ const mode = this._audioMode();
2383
2466
  this.audioMode = mode;
2384
2467
  this._webFromElement = false;
2468
+ this._micMixed = false;
2385
2469
  this._mediaPeak = 0;
2386
2470
  this._trackSince = 0;
2387
2471
  this._levels = { mic: 0, media: 0 };
@@ -2392,36 +2476,36 @@
2392
2476
  this.captureMode = 'ios-mic';
2393
2477
  return;
2394
2478
  }
2479
+ const stopAll = (...streams) => streams.forEach(st => st?.getTracks().forEach(tr => tr.stop()));
2480
+ const policyBlocked = this._micBlockedByPolicy();
2395
2481
  let web = null, mic = null;
2396
- if (mode === 'auto' || mode === 'media' || mode === 'dual') {
2397
- web = this._captureElementAudio();
2398
- if (web) this._webFromElement = true;
2399
- else if (mode !== 'auto') {
2400
- try { web = await this._captureDisplayAudio(); } catch (err) {
2401
- logDebug('AI Sub: tab audio unavailable: ' + (err.message || err.name), 'warn');
2402
- if (mode === 'media') showToast(t('subWebAudioUnavailable'));
2403
- }
2482
+ if (mode === 'media' || policyBlocked) {
2483
+ if (policyBlocked && mode === 'mic') showToast(t('subMicBlockedSite'));
2484
+ web = await this._captureMediaAudio(token);
2485
+ if (token !== this._startToken) { stopAll(web); throw new Error('cancelled'); }
2486
+ if (!web && policyBlocked) { const e = new Error('microphone blocked by the site'); e.name = 'PolicyBlocked'; throw e; }
2487
+ }
2488
+ // The microphone is asked for explicitly (so the permission prompt shows up right
2489
+ // away): always in mic mode, as the fallback when the video sound is unavailable,
2490
+ // and alongside video sound for browser recognition, which may still need it.
2491
+ if (!policyBlocked && (!web || this._useWebSpeech)) {
2492
+ if (!web && (await this._micPermissionState()) === 'prompt') showToast(t('subAskMic'));
2493
+ try {
2494
+ // Echo cancellation would erase the very speaker sound we want to hear.
2495
+ mic = await this._requestMic(!web);
2496
+ } catch (err) {
2497
+ if (!web) throw err;
2498
+ logDebug('AI Sub: microphone unavailable, using the video sound only.', 'info');
2404
2499
  }
2405
2500
  }
2406
- if (token !== this._startToken) { web?.getTracks().forEach(tr => tr.stop()); throw new Error('cancelled'); }
2407
- const trackRecognition = !!web && this._supportsTrackInput();
2408
- try {
2409
- mic = await this._requestMic(!trackRecognition);
2410
- } catch (err) {
2411
- if (!web) throw err;
2412
- logDebug('AI Sub: microphone unavailable, using media audio only.', 'warn');
2413
- }
2414
- if (token !== this._startToken) {
2415
- [web, mic].forEach(s => s?.getTracks().forEach(tr => tr.stop()));
2416
- throw new Error('cancelled');
2417
- }
2501
+ if (token !== this._startToken) { stopAll(web, mic); throw new Error('cancelled'); }
2502
+ if (mode === 'media' && !web && mic) showToast(t('subUsingMicFallback'));
2418
2503
  this.mediaStream = mic;
2419
2504
  this.webMediaStream = web;
2420
- const prefix = mode === 'auto' ? 'auto-' : '';
2421
- this.captureMode = web && mic && mode !== 'media' ? prefix + 'dual' : web ? prefix + 'media' : 'mic';
2505
+ this.captureMode = web ? 'media' : 'mic';
2422
2506
 
2423
2507
  const AudioCtx = window.AudioContext || window.webkitAudioContext;
2424
- const micForMix = mode === 'media' && web ? null : mic;
2508
+ const micForMix = web ? null : mic;
2425
2509
  if (!AudioCtx || (!micForMix && !web)) return;
2426
2510
  try {
2427
2511
  let ctx;
@@ -2455,7 +2539,8 @@
2455
2539
  connect(web, 'media');
2456
2540
  this.audioContext = ctx;
2457
2541
  this.audioNodes = nodes;
2458
- this.recognitionAudioStream = web ? dest.stream : null;
2542
+ // Recognition hears exactly this mix (video sound, or the echo-free microphone).
2543
+ this.recognitionAudioStream = dest.stream;
2459
2544
  this._levelTimer = setInterval(() => { if (!document.hidden) this._refreshLevels(); }, 400);
2460
2545
  } catch (err) {
2461
2546
  logDebug('AI Sub: audio analysis unavailable: ' + (err.message || err.name), 'info');
@@ -2652,6 +2737,9 @@
2652
2737
  if (!this.active) return;
2653
2738
  if (!document.hidden) this._checkAudio();
2654
2739
  if (!this.active) return;
2740
+ // The user stopped sharing the tab's audio from the browser's bar.
2741
+ const shared = this.webMediaStream && !this._webFromElement ? this.webMediaStream.getAudioTracks() : [];
2742
+ if (shared.length && shared.every(tr => tr.readyState === 'ended')) { this.stop(t('subTabShareEnded')); return; }
2655
2743
  if (!this._useWebSpeech) { updateAIBtnUX(); return; }
2656
2744
  const now = Date.now();
2657
2745
  if (!this._restartTimer && !this._waitOnline && now - this._lastEventAt > 25000) {
@@ -2663,11 +2751,14 @@
2663
2751
  this._scheduleRestart('watchdog', 100, true);
2664
2752
  } else if (this._recognitionInput === 'track' && !this._trackDisabled && this._trackSince && (
2665
2753
  // Captured video audio is silent (e.g. cross-origin media) while the video plays,
2666
- (now - this._trackSince > 6000 && this._mediaPeak < 0.003 && STATE.video && !STATE.video.paused && !STATE.video.muted && STATE.video.volume > 0) ||
2754
+ (this.webMediaStream && !this._micMixed && now - this._trackSince > 6000 && this._mediaPeak < 0.003 && STATE.video && !STATE.video.paused && !STATE.video.muted && STATE.video.volume > 0) ||
2667
2755
  // or sound is present but the engine never returns words from the track.
2668
2756
  (now - this._trackSince > 12000 && this._lastResultAt < this._trackSince && Math.max(this._levels.media, this._levels.mic) >= SPEECH_LEVEL))) {
2757
+ // First try: keep feeding the recognizer, now from the echo-free microphone.
2758
+ if (this.webMediaStream && !this._micMixed && this._mixInMic()) { updateAIBtnUX(); return; }
2669
2759
  this._trackDisabled = true;
2670
- logDebug('AI Sub: captured video audio unusable, switching to microphone input.', 'warn');
2760
+ logDebug('AI Sub: captured audio unusable, switching to the recognizerโ€™s own microphone.', 'warn');
2761
+ if (!this._micMixed) showToast(t('subUsingMicFallback'));
2671
2762
  this._preparePlaybackMic();
2672
2763
  this._destroyRecognizer();
2673
2764
  this._createRecognizer();
@@ -2675,6 +2766,27 @@
2675
2766
  }
2676
2767
  updateAIBtnUX();
2677
2768
  },
2769
+ _mixInMic() {
2770
+ const ctx = this.audioContext, nodes = this.audioNodes;
2771
+ if (!this.mediaStream || !ctx || !nodes?.mix) return false;
2772
+ try {
2773
+ const src = ctx.createMediaStreamSource(this.mediaStream);
2774
+ const an = ctx.createAnalyser();
2775
+ an.fftSize = 512;
2776
+ an.smoothingTimeConstant = 0.3;
2777
+ src.connect(an);
2778
+ src.connect(nodes.mix);
2779
+ nodes.list.push(src, an);
2780
+ nodes.analysers.mic = an;
2781
+ this._micMixed = true;
2782
+ this._preparePlaybackMic();
2783
+ this._trackSince = Date.now();
2784
+ this.captureMode = 'mic';
2785
+ showToast(t('subUsingMicFallback'));
2786
+ logDebug('AI Sub: the video sound is silent here, listening through the microphone.', 'warn');
2787
+ return true;
2788
+ } catch (_) { return false; }
2789
+ },
2678
2790
  _preparePlaybackMic() {
2679
2791
  const track = this.mediaStream?.getAudioTracks?.()[0];
2680
2792
  if (!track || typeof track.applyConstraints !== 'function') return;
@@ -3412,6 +3524,8 @@
3412
3524
  },
3413
3525
  async start({ silent = false } = {}) {
3414
3526
  if (this.state !== 'idle') return;
3527
+ this.loadLanguageSettings();
3528
+ if (!this.outLang) { this._askLanguage(); return; }
3415
3529
  const SR = window.SpeechRecognition || window.webkitSpeechRecognition;
3416
3530
  this._cloud = AI.asrProvider() !== 'browser' && !!(window.AudioContext || window.webkitAudioContext);
3417
3531
  // With cloud recognition on iPhone/iPad, Safari's own recognizer stays off
@@ -3421,7 +3535,6 @@
3421
3535
  if (window.isSecureContext === false) { showToast(t('subNeedsHttps')); return; }
3422
3536
  const token = ++this._startToken;
3423
3537
  this.state = 'starting';
3424
- this.loadLanguageSettings();
3425
3538
  this._resetRuntime();
3426
3539
  this._abortCtrl = new AbortController();
3427
3540
  this._syncUI();
@@ -3435,7 +3548,7 @@
3435
3548
  this._syncUI();
3436
3549
  const denied = err?.name === 'NotAllowedError' || err?.name === 'SecurityError';
3437
3550
  logDebug('AI Sub: audio input failed: ' + (err?.message || err?.name), 'error');
3438
- showToast(t(denied ? 'subMicDenied' : 'subMicUnavailable'));
3551
+ showToast(t(err?.name === 'PolicyBlocked' ? 'subMicBlockedNoMedia' : err?.name === 'NotFoundError' ? 'subNoMic' : denied ? 'subMicDenied' : 'subMicUnavailable'));
3439
3552
  return;
3440
3553
  }
3441
3554
  if (token !== this._startToken) return;
@@ -3516,6 +3629,19 @@
3516
3629
  if (wasActive && message) showToast(message);
3517
3630
  if (wasActive) logDebug('AI Sub stopped.', 'info');
3518
3631
  },
3632
+ // No subtitle language yet: open the settings with the language picker highlighted.
3633
+ _askLanguage() {
3634
+ showToast(t('subPickLanguage'));
3635
+ const modal = shadow?.getElementById('trans-modal');
3636
+ if (modal && modal.style.display !== 'flex') openPanel(modal);
3637
+ const sel = shadow?.getElementById('stt-out');
3638
+ if (sel) {
3639
+ sel.classList.remove('need');
3640
+ void sel.offsetWidth;
3641
+ sel.classList.add('need');
3642
+ try { sel.focus({ preventScroll: true }); } catch (_) { }
3643
+ }
3644
+ },
3519
3645
  toggle() {
3520
3646
  if (this.state === 'idle') this.start();
3521
3647
  else this.stop(t('subOff'));
@@ -3532,7 +3658,7 @@
3532
3658
  updateAIBtnUX();
3533
3659
  },
3534
3660
  setOutputLanguage(value) {
3535
- this.outLang = LANG_BY_CODE.has(value) ? value : 'en';
3661
+ this.outLang = value && LANG_BY_CODE.has(value) ? value : '';
3536
3662
  this._recentQueued = [];
3537
3663
  if (this.active) this._warmBrowserTranslator(baseLang(this._recognitionLanguage()), this.outLang);
3538
3664
  updateAIBtnUX();
@@ -6331,10 +6457,26 @@
6331
6457
  const label = text => createEl('div', 'field-label', text);
6332
6458
  const help = text => createEl('div', 'trans-help', text);
6333
6459
  const speakerSelect = createSelect('stt-in', LANGS.map(l => ({ value: l.locale, label: l.label })));
6334
- const subtitleSelect = createSelect('stt-out', LANGS.map(l => ({ value: l.code, label: l.label })));
6335
- const audioSelect = createSelect('stt-audio-mode', [
6336
- { value: 'auto', label: t('audioAuto') }, { value: 'mic', label: t('audioMic') },
6337
- { value: 'media', label: t('audioMedia') }, { value: 'dual', label: t('audioDual') }]);
6460
+ const subtitleSelect = createSelect('stt-out', [{ value: '', label: t('chooseLanguage') }, ...LANGS.map(l => ({ value: l.code, label: l.label }))]);
6461
+ // What to listen to: two clear choices instead of a list of capture modes.
6462
+ const ios = TRANSLATOR._isAppleMobile();
6463
+ const sourceRow = createEl('div', 'seg', '', { id: 'stt-source', role: 'radiogroup' });
6464
+ const srcMedia = createEl('button', 'seg-btn', t('srcMedia'), { type: 'button', 'data-mode': 'media', role: 'radio' });
6465
+ const srcMic = createEl('button', 'seg-btn', t('srcMic'), { type: 'button', 'data-mode': 'mic', role: 'radio' });
6466
+ const sourceHelp = help('');
6467
+ sourceRow.append(srcMedia, srcMic);
6468
+ const paintSource = () => {
6469
+ const mode = TRANSLATOR._audioMode();
6470
+ [srcMedia, srcMic].forEach(b => { const on = b.dataset.mode === mode; b.classList.toggle('on', on); b.setAttribute('aria-checked', String(on)); });
6471
+ srcMedia.disabled = ios;
6472
+ sourceHelp.textContent = ios ? t('srcIosHelp') : mode === 'mic' ? t('srcMicHelp') : t('srcMediaHelp');
6473
+ };
6474
+ [srcMedia, srcMic].forEach(b => b.addEventListener('click', () => {
6475
+ if (b.disabled || TRANSLATOR._audioMode() === b.dataset.mode) return;
6476
+ STORE.set('nxu_audio_mode', b.dataset.mode);
6477
+ paintSource();
6478
+ TRANSLATOR.restart('audio source changed');
6479
+ }));
6338
6480
  const positionSelect = createSelect('stt-position', [{ value: 'video', label: t('posVideo') }, { value: 'screen', label: t('posScreen') }]);
6339
6481
  const asrSelect = createSelect('stt-asr-provider', [
6340
6482
  { value: 'browser', label: t('asrBrowser') }, { value: 'openai', label: t('asrOpenAI') },
@@ -6411,17 +6553,17 @@
6411
6553
  const advanced = createEl('div', 'ai-advanced-body');
6412
6554
  const offlineBtn = createEl('button', 'btn subtle', 'โฌ‡๏ธ ' + t('offlineDownload'));
6413
6555
  offlineBtn.onclick = () => TRANSLATOR.downloadOfflineModels();
6414
- advanced.append(label(t('glossary')), glossaryInput, help(t('glossaryHelp')), label(t('aiKeys')), keyRows, help(t('aiKeysHelp')), modelRow('anthropic', 'claude-haiku-4-5'), modelRow('openai', 'gpt-4.1-mini'),
6556
+ advanced.append(label(t('translationEngine')), providerSelect, engineHint,
6557
+ label(t('asrEngine')), asrSelect,
6558
+ label(t('subPosition')), positionSelect,
6559
+ label(t('glossary')), glossaryInput, help(t('glossaryHelp')), label(t('aiKeys')), keyRows, help(t('aiKeysHelp')), modelRow('anthropic', 'claude-haiku-4-5'), modelRow('openai', 'gpt-4.1-mini'),
6415
6560
  help(t('modelHelp')), localRow, help(t('localFirstHelp')), offlineBtn, help(t('offlineHelp')));
6416
6561
  details.append(createEl('summary', '', t('advanced')), advanced);
6417
6562
 
6418
6563
  body.append(
6419
- label(t('speakerLanguage')), speakerSelect, help(t('speakerHelp')),
6420
- label(t('subtitleLanguage')), subtitleSelect,
6421
- label(t('audioSource')), audioSelect, help(t('audioHelp')),
6422
- label(t('asrEngine')), asrSelect,
6423
- label(t('translationEngine')), providerSelect, engineHint,
6424
- label(t('subPosition')), positionSelect,
6564
+ label(t('heardSound')), sourceRow, sourceHelp,
6565
+ label(t('videoLanguage')), speakerSelect,
6566
+ label(t('subtitleLanguageReq')), subtitleSelect,
6425
6567
  sizeRow, opacityRow,
6426
6568
  details,
6427
6569
  createEl('div', 'ai-status', t('subStatusIdle'), { id: 'nxu-ai-status' }),
@@ -6430,8 +6572,8 @@
6430
6572
  );
6431
6573
 
6432
6574
  speakerSelect.value = TRANSLATOR._recognitionLanguage();
6433
- subtitleSelect.value = TRANSLATOR.outLang;
6434
- audioSelect.value = STORE.get('nxu_audio_mode', 'auto');
6575
+ subtitleSelect.value = TRANSLATOR.outLang || '';
6576
+ paintSource();
6435
6577
  positionSelect.value = STORE.get('nxu_sub_position', 'video');
6436
6578
  providerSelect.value = STORE.get('nxu_translation_provider', 'auto');
6437
6579
  asrSelect.value = STORE.get('nxu_asr_provider', 'browser');
@@ -6441,8 +6583,12 @@
6441
6583
  opacitySlider.value = SUB_PREFS.opacity; opacityVal.textContent = SUB_PREFS.opacity + '%';
6442
6584
 
6443
6585
  speakerSelect.addEventListener('change', () => { STORE.set('nxu_speaker_language', speakerSelect.value); TRANSLATOR.setSpeakerLanguage(speakerSelect.value); });
6444
- subtitleSelect.addEventListener('change', () => { STORE.set('nxu_subtitle_language', subtitleSelect.value); TRANSLATOR.setOutputLanguage(subtitleSelect.value); });
6445
- audioSelect.addEventListener('change', () => { STORE.set('nxu_audio_mode', audioSelect.value); TRANSLATOR.restart('audio source changed'); });
6586
+ subtitleSelect.addEventListener('change', () => {
6587
+ if (!subtitleSelect.value) return;
6588
+ subtitleSelect.classList.remove('need');
6589
+ STORE.set('nxu_subtitle_language', subtitleSelect.value);
6590
+ TRANSLATOR.setOutputLanguage(subtitleSelect.value);
6591
+ });
6446
6592
  positionSelect.addEventListener('change', () => { STORE.set('nxu_sub_position', positionSelect.value); SUB_LAYOUT.schedule(); });
6447
6593
  providerSelect.addEventListener('change', () => { STORE.set('nxu_translation_provider', providerSelect.value); TRANSLATOR._cache.clear(); TRANSLATOR._llmHistory = []; refreshEngineHint(); });
6448
6594
  asrSelect.addEventListener('change', () => { STORE.set('nxu_asr_provider', asrSelect.value); refreshEngineHint(); TRANSLATOR.restart('recognition engine changed'); });
@@ -6597,6 +6743,12 @@
6597
6743
  .trans-check { width:18px; height:18px; accent-color:var(--accent); }
6598
6744
  .trans-help { font-size:11px; line-height:1.45; color:rgba(255,255,255,0.55); }
6599
6745
  .trans-help.center { text-align:center; margin-top:4px; }
6746
+ .seg { display:flex; gap:6px; }
6747
+ .seg-btn { flex:1; min-height:38px; padding:8px 6px; border-radius:10px; border:1px solid rgba(255,255,255,0.16); background:rgba(255,255,255,0.06); color:inherit; font:inherit; font-size:13px; font-weight:700; cursor:pointer; }
6748
+ .seg-btn.on { background:rgba(124,77,255,0.38); border-color:rgba(160,130,255,0.95); }
6749
+ .seg-btn:disabled { opacity:0.4; cursor:default; }
6750
+ .trans-select.need { outline:2px solid #ffca28; outline-offset:1px; animation:nxNeed 0.9s ease 3; }
6751
+ @keyframes nxNeed { 50% { outline-color:transparent; } }
6600
6752
  .range-row { display:flex; align-items:center; gap:8px; font-size:12px; margin-top:6px; }
6601
6753
  .range-row input { flex:1; accent-color:var(--accent); }
6602
6754
  .range-val { min-width:42px; text-align:right; color:rgba(255,255,255,0.7); }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kangsicj/nexussync",
3
- "version": "1.2.1",
3
+ "version": "1.3.0",
4
4
  "description": "Watch-together userscript: media sync, cinema mode, live AI subtitles, chat bubbles and quick ink for Tampermonkey and iOS Userscripts.",
5
5
  "keywords": [
6
6
  "userscript",