@kangsicj/nexussync 1.2.1 โ 1.3.1
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 +3 -2
- package/dist/NexusSync.meta.js +1 -1
- package/dist/NexusSync.user.js +589 -103
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
<br>
|
|
6
6
|
|
|
7
|
-
[](./CHANGELOG.md)
|
|
8
8
|
[](https://www.tampermonkey.net/)
|
|
9
9
|
[](https://apps.apple.com/app/userscripts/id1463298887)
|
|
10
10
|
[](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?
|
|
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>
|
|
@@ -71,6 +71,7 @@ No subtitles on that video? Turn on live speech recognition with translation int
|
|
|
71
71
|
|
|
72
72
|
- **Next episode, together** โ move on to the next episode and you stay in the room; friends follow with one tap. Near the end, an *Up next* card counts down and opens it for you.
|
|
73
73
|
- **Cinema by itself** โ open a page with one movie or episode and it switches to cinema as soon as the video is ready, keeping the site's player so you can still pick subtitles or a server. Turn it off per site.
|
|
74
|
+
- **See who's here** โ everyone in the room is listed by name and colour, with a ๐ค when someone's screen is off.
|
|
74
75
|
- **Make it yours** โ pick your name and colour; your bubbles and doodles wear it on every screen.
|
|
75
76
|
- **Calm, never jumpy** โ phones going to sleep, slow Wi-Fi or a player restarting on its own never pause the whole room.
|
|
76
77
|
- **No accidental pauses** โ tapping the chat, a doodle or a reaction never nudges the video for anyone.
|
package/dist/NexusSync.meta.js
CHANGED
|
@@ -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.
|
|
11
|
+
// @version 1.3.1
|
|
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 *://*/*
|
package/dist/NexusSync.user.js
CHANGED
|
@@ -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.
|
|
11
|
+
// @version 1.3.1
|
|
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.
|
|
46
|
+
const NXU_VERSION = '1.3.1';
|
|
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.
|
|
51
|
+
const NXU_RANK = '11.3.1';
|
|
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=';
|
|
@@ -322,7 +322,7 @@
|
|
|
322
322
|
const bool = v => v === undefined || typeof v === 'boolean';
|
|
323
323
|
switch (data.type) {
|
|
324
324
|
case 'NXU_VIDEO_FOUND':
|
|
325
|
-
return num(data.videoW) && num(data.videoH) && (num(data.duration) || data.duration === undefined) && bool(data.paused) && bool(data.playing);
|
|
325
|
+
return num(data.videoW) && num(data.videoH) && (num(data.duration) || data.duration === undefined) && bool(data.paused) && bool(data.playing) && bool(data.live);
|
|
326
326
|
case 'NXU_VIDEO_LOST':
|
|
327
327
|
case 'NXU_ACTIVITY':
|
|
328
328
|
case 'NXU_CINEMA_EXIT_REQ':
|
|
@@ -330,7 +330,7 @@
|
|
|
330
330
|
return true;
|
|
331
331
|
case 'NXU_VIDEO_EVENT':
|
|
332
332
|
return ['play', 'pause', 'seeked', 'ratechange', 'timeupdate', 'waiting', 'canplay', 'volume'].includes(data.event) &&
|
|
333
|
-
num(data.currentTime) && num(data.playbackRate) && typeof data.paused === 'boolean' && str(data.remoteEventId);
|
|
333
|
+
num(data.currentTime) && num(data.playbackRate) && typeof data.paused === 'boolean' && str(data.remoteEventId) && bool(data.live);
|
|
334
334
|
case 'NXU_FULLSCREEN_STATE':
|
|
335
335
|
return typeof data.active === 'boolean';
|
|
336
336
|
case 'NXU_HOTKEY':
|
|
@@ -671,17 +671,30 @@
|
|
|
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.',
|
|
685
|
+
subHearVideo: '๐ง Listening to the video', subHearMic: '๐ง Listening through the microphone', subVideoSilent: '๐ No sound reaches the subtitles from this video',
|
|
686
|
+
subIssueNet: 'โ ๏ธ Speech service connection is unstable โ retrying', subShareTab: '๐ฌ Connect tab sound', subTabNotShared: 'Tab audio was not shared. Choose this tab and turn on โShare tab audioโ.',
|
|
674
687
|
subPosition: 'Subtitle position', posVideo: 'Over the video', posScreen: 'Bottom of the screen', subSize: 'Size', subOpacity: 'Opacity',
|
|
675
688
|
advanced: 'Advanced', translationEngine: 'Translation engine', providerAuto: 'Google first, on-device as backup (best quality)', providerBrowser: 'On-device only (private)',
|
|
676
689
|
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
690
|
localFirst: 'Prefer on-device speech recognition', localFirstHelp: 'Uses the offline speech model when the browser has it installed.',
|
|
678
691
|
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.
|
|
692
|
+
subStart: 'Start subtitles', subStop: 'Stop subtitles', subStarting: 'Startingโฆ', subStatusIdle: 'Ready. Choose the languages, then press Start.',
|
|
680
693
|
subStatusStarting: 'Preparing audio inputโฆ', subListening: 'Listening', auto: 'Auto', inputMic: 'mic', inputMedia: 'video audio',
|
|
681
694
|
engineLocal: 'on-device', engineOnline: 'online', translation: 'Translation', recognition: 'Recognition', speaker: 'Speaker', time: 'Time', confidence: 'Confidence',
|
|
682
695
|
speakerMic: 'Mic', speakerMedia: 'Video', speakerMixed: 'Mixed',
|
|
683
696
|
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: '
|
|
697
|
+
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
698
|
subMicUnavailable: '๐๏ธ No audio input available.', subNoMic: '๐๏ธ No microphone found.', subServiceBlocked: 'The speech service is not available in this browser.',
|
|
686
699
|
subNetworkFailed: 'Speech service unreachable. Check the connection and start again.', subLangUnsupported: 'This language is not supported for recognition.',
|
|
687
700
|
subStalled: 'Speech recognition keeps failing. Please start again.', subWebAudioUnavailable: 'Video audio unavailable here โ using the microphone.',
|
|
@@ -694,7 +707,7 @@
|
|
|
694
707
|
noVideo: 'โ ๏ธ No video detected', noPlayingVideo: 'โ ๏ธ No playing video found', pipUnsupported: 'โ ๏ธ Picture-in-Picture not supported', pipBlocked: 'โ ๏ธ Picture-in-Picture was blocked',
|
|
695
708
|
mediaFound: 'โ
Media detected', mediaNotFound: '๐ No media yet โ start the video and try again',
|
|
696
709
|
canvasOn: '๐จ Canvas ON', canvasOff: '๐จ Canvas OFF', canvasViewOnly: '๐จ Canvas (view only)', nothingToUndo: 'โฉ๏ธ Nothing to undo', undo: 'Undo (Ctrl+Z)',
|
|
697
|
-
pen: 'Pen', eraser: 'Eraser', clearCanvas: 'Clear canvas', watching: '{n} watching',
|
|
710
|
+
pen: 'Pen', eraser: 'Eraser', clearCanvas: 'Clear canvas', watching: '{n} watching', meTag: '(me)', whoViewer: 'watching only', whoAway: 'away (screen off or another tab)', whoOldVer: 'different version โ please update', whoTitle: 'Watching together',
|
|
698
711
|
shieldTitle: 'Connected', shieldText: 'Tap to enable synchronized playback in this tab.', shieldButton: 'START SYNC โถ๏ธ',
|
|
699
712
|
menuCinema: 'Toggle cinema mode', menuSubtitles: 'Start / stop AI subtitles', menuShowButton: 'Show / hide the NexusSync button on this site'
|
|
700
713
|
},
|
|
@@ -754,17 +767,30 @@
|
|
|
754
767
|
subtitleLanguage: '์๋ง ๋ฒ์ญ ์ธ์ด', audioSource: '์ค๋์ค ์
๋ ฅ', audioAuto: '์๋ (๊ฐ๋ฅํ๋ฉด ์์ ์๋ฆฌ + ๋ง์ดํฌ)', audioMic: '๋ง์ดํฌ๋ง',
|
|
755
768
|
audioMedia: '์์/ํญ ์๋ฆฌ๋ง', audioDual: '๋ง์ดํฌ + ์์ ์๋ฆฌ',
|
|
756
769
|
audioHelp: '์๋์ ๋ธ๋ผ์ฐ์ ๊ฐ ํ์ฉํ๋ฉด ํ์ด์ง ์์ ์๋ฆฌ๋ฅผ ์ง์ ๋ฃ๊ณ , ์๋๋ฉด ๋ง์ดํฌ๋ก ๋ฃ์ต๋๋ค (์คํผ์ปค ๋ณผ๋ฅจ์ ๋์ฌ ์ฃผ์ธ์).',
|
|
770
|
+
heardSound: '๋ค์ ์๋ฆฌ', srcMedia: '๐ฌ ์์ ์๋ฆฌ (๊ถ์ฅ)', srcMic: '๐ค ๋ง์ดํฌ',
|
|
771
|
+
srcMediaHelp: '์์ ์๋ฆฌ๋ฅผ ์ง์ ๋ค์ด์. ๋ธ๋ผ์ฐ์ ๊ฐ ๊ณต์ ํ ํ๋ฉด์ ๋ฌผ์ผ๋ฉด ์ด ํญ์ ๊ณ ๋ฅด๊ณ โํญ ์ค๋์ค ๊ณต์ โ๋ฅผ ์ผ ์ฃผ์ธ์.',
|
|
772
|
+
srcMicHelp: '๋ง์ดํฌ๋ก ๋ค์ด์. ์์ ์๋ฆฌ๋ฅผ ์ด์ดํฐ์ด ์๋ ์คํผ์ปค๋ก ํฌ๊ฒ ํ์ด ์ฃผ์ธ์.',
|
|
773
|
+
srcIosHelp: '์์ดํฐยท์์ดํจ๋์ Safari๋ ๋ง์ดํฌ๋ก๋ง ๋ค์ ์ ์์ด์. ์์์ ์คํผ์ปค๋ก ์ฌ์ํด ์ฃผ์ธ์.',
|
|
774
|
+
videoLanguage: '์์ ์ ์ธ์ด', subtitleLanguageReq: '์๋ง ์ธ์ด (ํ์)', chooseLanguage: 'โ ์ธ์ด๋ฅผ ์ ํํ์ธ์ โ',
|
|
775
|
+
subPickLanguage: '๋จผ์ ์๋ง ์ธ์ด๋ฅผ ์ ํํด ์ฃผ์ธ์.', subAskMic: '๐ค ๋ธ๋ผ์ฐ์ ๊ฐ ๋ง์ดํฌ ๊ถํ์ ๋ฌผ์ผ๋ฉด โํ์ฉโ์ ๋๋ฌ ์ฃผ์ธ์.',
|
|
776
|
+
subAskTab: '๐ฌ ์ด ํญ์ ๊ณ ๋ฅด๊ณ โํญ ์ค๋์ค ๊ณต์ โ๋ฅผ ์ผ ๋ค ๊ณต์ ๋ฅผ ๋๋ฌ ์ฃผ์ธ์.',
|
|
777
|
+
subMicBlockedSite: '์ด ์ฌ์ดํธ๋ ๋ง์ดํฌ ์ฌ์ฉ์ ๋ง์ ๋์์ด์. ์์ ์๋ฆฌ๋ก ๋ค์๊ฒ์.',
|
|
778
|
+
subMicBlockedNoMedia: '์ด ์ฌ์ดํธ๋ ๋ง์ดํฌ ์ฌ์ฉ์ ๋ง์ ๋์๊ณ , ์์ ์๋ฆฌ๋ ๋ฐ์ ์ ์์ด์.',
|
|
779
|
+
subUsingMicFallback: '์์ ์๋ฆฌ๋ฅผ ์ง์ ๋ค์ ์ ์์ด ๋ง์ดํฌ๋ก ๋ค์ด์. ์คํผ์ปค ์๋ฆฌ๋ฅผ ํค์ ์ฃผ์ธ์.',
|
|
780
|
+
subTabShareEnded: 'ํญ ์ค๋์ค ๊ณต์ ๊ฐ ๋๋์ ์๋ง์ ๊ป์ด์.',
|
|
781
|
+
subHearVideo: '๐ง ์์ ์๋ฆฌ ๋ฃ๋ ์ค', subHearMic: '๐ง ๋ง์ดํฌ๋ก ๋ฃ๋ ์ค', subVideoSilent: '๐ ์ด ์์์ ์๋ฆฌ๊ฐ ์๋ง์ ์ ๋ฌ๋์ง ์์์',
|
|
782
|
+
subIssueNet: 'โ ๏ธ ์์ฑ ์ธ์ ์๋ฒ ์ฐ๊ฒฐ์ด ๋ถ์์ ํด์ โ ๋ค์ ์๋ ์ค', subShareTab: '๐ฌ ํญ ์๋ฆฌ ์ฐ๊ฒฐ', subTabNotShared: 'ํญ ์ค๋์ค๊ฐ ๊ณต์ ๋์ง ์์์ด์. ์ด ํญ์ ๊ณ ๋ฅด๊ณ โํญ ์ค๋์ค ๊ณต์ โ๋ฅผ ์ผ ์ฃผ์ธ์.',
|
|
757
783
|
subPosition: '์๋ง ์์น', posVideo: '์์ ์', posScreen: 'ํ๋ฉด ํ๋จ', subSize: 'ํฌ๊ธฐ', subOpacity: '๋ถํฌ๋ช
๋',
|
|
758
784
|
advanced: '๊ณ ๊ธ', translationEngine: '๋ฒ์ญ ์์ง', providerAuto: 'Google ์ฐ์ , ๊ธฐ๊ธฐ ๋ด ๋ฒ์ญ ๋ณด์กฐ (์ต๊ณ ํ์ง)', providerBrowser: '๊ธฐ๊ธฐ ๋ด ๋ฒ์ญ๋ง (๊ฐ์ธ์ ๋ณด ๋ณดํธ)',
|
|
759
785
|
providerGoogle: 'Google๋ง', providerHelp: '๋ฌธ์ฅ ๋ฒ์ญ ํ์ง์ ์จ๋ผ์ธ(Google)์ด ํจ์ฌ ์ข์ต๋๋ค. ๊ธฐ๊ธฐ ๋ด ๋ชจ๋ธ์ ์ค์๊ฐ ์์ ์ค๊ณผ ์คํ๋ผ์ธ ์ํฉ์ ๋งก์ต๋๋ค.',
|
|
760
786
|
localFirst: '๊ธฐ๊ธฐ ๋ด ์์ฑ ์ธ์ ์ฐ์ ', localFirstHelp: '๋ธ๋ผ์ฐ์ ์ ์คํ๋ผ์ธ ์์ฑ ๋ชจ๋ธ์ด ์ค์น๋์ด ์์ผ๋ฉด ์ฌ์ฉํฉ๋๋ค.',
|
|
761
787
|
hotkeyHelp: '๋จ์ถํค: Alt+Shift+T ์๋ง ยท Alt+Shift+C ์๋ค๋ง ยท Alt+Shift+N ๋ฉ๋ด ยท ์๋ค๋ง ์ค: Space, โ/โ, โ/โ, M, F',
|
|
762
|
-
subStart: '์๋ง ์์', subStop: '์๋ง ์ค์ง', subStarting: '์์ํ๋ ์คโฆ', subStatusIdle: '์ค๋น๋จ.
|
|
788
|
+
subStart: '์๋ง ์์', subStop: '์๋ง ์ค์ง', subStarting: '์์ํ๋ ์คโฆ', subStatusIdle: '์ค๋น๋จ. ์ธ์ด๋ฅผ ๊ณ ๋ฅธ ๋ค ์์์ ๋๋ฅด์ธ์.',
|
|
763
789
|
subStatusStarting: '์ค๋์ค ์
๋ ฅ ์ค๋น ์คโฆ', subListening: '๋ฃ๋ ์ค', auto: '์๋', inputMic: '๋ง์ดํฌ', inputMedia: '์์ ์๋ฆฌ',
|
|
764
790
|
engineLocal: '๊ธฐ๊ธฐ ๋ด', engineOnline: '์จ๋ผ์ธ', translation: '๋ฒ์ญ', recognition: '์ธ์', speaker: 'ํ์', time: '์๊ฐ', confidence: '์ ๋ขฐ๋',
|
|
765
791
|
speakerMic: '๋ง์ดํฌ', speakerMedia: '์์', speakerMixed: 'ํผํฉ',
|
|
766
792
|
subOn: '๐๏ธ AI ์๋ง ์ผ์ง', subOff: '๐ AI ์๋ง ๊บผ์ง', subUnsupported: '์ด ๋ธ๋ผ์ฐ์ ๋ ์์ฑ ์ธ์์ ์ง์ํ์ง ์์ต๋๋ค. Chrome, Edge, Safari๋ฅผ ์ฌ์ฉํ์ธ์.',
|
|
767
|
-
subNeedsHttps: '์๋ง์ ๋ณด์(https) ํ์ด์ง์์๋ง ๋์ํฉ๋๋ค.', subMicDenied: '
|
|
793
|
+
subNeedsHttps: '์๋ง์ ๋ณด์(https) ํ์ด์ง์์๋ง ๋์ํฉ๋๋ค.', subMicDenied: '๐ค ๋ง์ดํฌ ๊ถํ์ด ๊บผ์ ธ ์์ด์. ์ฃผ์์ฐฝ ์ผ์ชฝ ๐(์ฌ์ดํธ ์ ๋ณด)์์ ๋ง์ดํฌ๋ฅผ โํ์ฉโ์ผ๋ก ๋ฐ๊พผ ๋ค ๋ค์ ๋๋ฌ ์ฃผ์ธ์.',
|
|
768
794
|
subMicUnavailable: '๐๏ธ ์ฌ์ฉํ ์ ์๋ ์ค๋์ค ์
๋ ฅ์ด ์์ต๋๋ค.', subNoMic: '๐๏ธ ๋ง์ดํฌ๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค.', subServiceBlocked: '์ด ๋ธ๋ผ์ฐ์ ์์๋ ์์ฑ ์ธ์ ์๋น์ค๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค.',
|
|
769
795
|
subNetworkFailed: '์์ฑ ์ธ์ ์๋ฒ์ ์ฐ๊ฒฐํ ์ ์์ต๋๋ค. ์ฐ๊ฒฐ์ ํ์ธํ๊ณ ๋ค์ ์์ํ์ธ์.', subLangUnsupported: '์ด ์ธ์ด๋ ์์ฑ ์ธ์์ ์ง์ํ์ง ์์ต๋๋ค.',
|
|
770
796
|
subStalled: '์์ฑ ์ธ์์ด ๊ณ์ ์คํจํฉ๋๋ค. ๋ค์ ์์ํด ์ฃผ์ธ์.', subWebAudioUnavailable: '์ด ํ์ด์ง์์๋ ์์ ์๋ฆฌ๋ฅผ ์ง์ ๋ฐ์ ์ ์์ด ๋ง์ดํฌ๋ฅผ ์ฌ์ฉํฉ๋๋ค.',
|
|
@@ -777,7 +803,7 @@
|
|
|
777
803
|
noVideo: 'โ ๏ธ ๊ฐ์ง๋ ์์์ด ์์ต๋๋ค', noPlayingVideo: 'โ ๏ธ ์ฌ์ ์ค์ธ ์์์ด ์์ต๋๋ค', pipUnsupported: 'โ ๏ธ PiP๋ฅผ ์ง์ํ์ง ์์ต๋๋ค', pipBlocked: 'โ ๏ธ PiP๊ฐ ์ฐจ๋จ๋์์ต๋๋ค',
|
|
778
804
|
mediaFound: 'โ
๋ฏธ๋์ด ๊ฐ์ง๋จ', mediaNotFound: '๐ ์์ง ๋ฏธ๋์ด๊ฐ ์์ต๋๋ค โ ์์์ ์ฌ์ํ ๋ค ๋ค์ ์๋ํ์ธ์',
|
|
779
805
|
canvasOn: '๐จ ์บ๋ฒ์ค ์ผ์ง', canvasOff: '๐จ ์บ๋ฒ์ค ๊บผ์ง', canvasViewOnly: '๐จ ์บ๋ฒ์ค (๋ณด๊ธฐ ์ ์ฉ)', nothingToUndo: 'โฉ๏ธ ๋๋๋ฆด ๋ด์ฉ์ด ์์ต๋๋ค', undo: '๋๋๋ฆฌ๊ธฐ (Ctrl+Z)',
|
|
780
|
-
pen: 'ํ', eraser: '์ง์ฐ๊ฐ', clearCanvas: '๋ชจ๋ ์ง์ฐ๊ธฐ', watching: '{n}๋ช
์์ฒญ ์ค',
|
|
806
|
+
pen: 'ํ', eraser: '์ง์ฐ๊ฐ', clearCanvas: '๋ชจ๋ ์ง์ฐ๊ธฐ', watching: '{n}๋ช
์์ฒญ ์ค', meTag: '(๋)', whoViewer: '๋ณด๊ธฐ ์ ์ฉ', whoAway: '์๋ฆฌ ๋น์ (ํ๋ฉด ๊บผ์งยท๋ค๋ฅธ ํญ)', whoOldVer: '๋ค๋ฅธ ๋ฒ์ โ ์
๋ฐ์ดํธ๊ฐ ํ์ํด์', whoTitle: 'ํจ๊ป ๋ณด๋ ์ฌ๋',
|
|
781
807
|
shieldTitle: '์ฐ๊ฒฐ๋จ', shieldText: '๋๋ฌ์ ์ด ํญ์ ๋๊ธฐํ ์ฌ์์ ํ์ฑํํ์ธ์.', shieldButton: '๋๊ธฐํ ์์ โถ๏ธ',
|
|
782
808
|
menuCinema: '์๋ค๋ง ๋ชจ๋ ์ผ๊ธฐ/๋๊ธฐ', menuSubtitles: 'AI ์๋ง ์์/์ค์ง', menuShowButton: '์ด ์ฌ์ดํธ์์ NexusSync ๋ฒํผ ํ์/์จ๊ธฐ๊ธฐ'
|
|
783
809
|
}
|
|
@@ -1104,6 +1130,7 @@
|
|
|
1104
1130
|
[class*="mask" i], [class*="volume" i], [class*="settings" i], [class*="menu" i], [class*="tooltip" i], [class*="watermark" i], .jw-display, .xgplayer-start, .fp-ui, .art-layers, .art-notice):not(video):not(.nxu-cinema-fill):not(.nxu-keep):not([class*="caption" i]):not([class*="subtitle" i]):not([class*="text-track" i]):not([class*="cue" i]):not([class*="sub-" i]):not([class*="danmaku" i]) {
|
|
1105
1131
|
visibility: hidden !important; pointer-events: none !important; transition: none !important; animation: none !important; }
|
|
1106
1132
|
.nxu-site-ui-off :is([class*="caption" i], [class*="subtitle" i], [class*="text-track" i], [class*="cue" i], [class*="danmaku" i]) { visibility: visible !important; }
|
|
1133
|
+
.nxu-site-ui-off .nxu-site-hide { visibility: hidden !important; pointer-events: none !important; transition: none !important; animation: none !important; }
|
|
1107
1134
|
.nxu-cue-mirror { position: absolute !important; left: calc(50% + var(--nxu-cue-shift, 0px)) !important; right: auto !important; top: auto !important; bottom: var(--nxu-cue-bottom, 6%) !important; transform: translateX(-50%) !important;
|
|
1108
1135
|
width: var(--nxu-cue-width, 90%) !important; max-width: 96% !important; height: auto !important; margin: 0 !important; padding: 0 !important; border: 0 !important; background: none !important;
|
|
1109
1136
|
flex-direction: column !important; align-items: center !important; gap: 3px !important; z-index: 2147483646 !important; transition: bottom 0.3s ease !important; pointer-events: none !important; visibility: visible !important; opacity: 1 !important; }
|
|
@@ -1361,6 +1388,7 @@
|
|
|
1361
1388
|
for (let n = video.parentElement; n && n !== root; n = n.parentElement) n.classList.add('nxu-keep');
|
|
1362
1389
|
}
|
|
1363
1390
|
root.classList.toggle('nxu-site-ui-off', hide);
|
|
1391
|
+
this._structuralHide(root, video, hide);
|
|
1364
1392
|
if (video) {
|
|
1365
1393
|
if (hide && video.hasAttribute('controls')) { video.dataset.nxuControls = '1'; video.removeAttribute('controls'); }
|
|
1366
1394
|
else if (!hide && video.dataset.nxuControls) { video.setAttribute('controls', ''); delete video.dataset.nxuControls; }
|
|
@@ -1374,7 +1402,53 @@
|
|
|
1374
1402
|
} catch (_) { }
|
|
1375
1403
|
}
|
|
1376
1404
|
},
|
|
1405
|
+
// Players built from utility classes (Tailwind and the like) have no "control" in
|
|
1406
|
+
// their class names, so the site's bar stayed visible behind ours. Structurally: in the
|
|
1407
|
+
// player, everything beside the video's own chain of wrappers that holds controls
|
|
1408
|
+
// (buttons, sliders, icons, links) or is an empty overlay is hidden; text-only layers
|
|
1409
|
+
// (the site's subtitles) stay. Re-checked when the player redraws its controls.
|
|
1410
|
+
_structuralHide(root, video, hide) {
|
|
1411
|
+
const undo = () => {
|
|
1412
|
+
(this._hidden || []).forEach(n => n.classList.remove('nxu-site-hide'));
|
|
1413
|
+
this._hidden = [];
|
|
1414
|
+
this._hideObs?.disconnect();
|
|
1415
|
+
this._hideObs = null;
|
|
1416
|
+
};
|
|
1417
|
+
if (!hide || !root || !video || root === video) { undo(); return; }
|
|
1418
|
+
const run = () => {
|
|
1419
|
+
const chain = new Set();
|
|
1420
|
+
for (let n = video; n && n !== root; n = n.parentElement) chain.add(n);
|
|
1421
|
+
const hidden = [];
|
|
1422
|
+
const CTRL = 'button, input, select, [role="button"], [role="slider"], [role="menu"], [role="menuitem"], svg, a[href], [tabindex]';
|
|
1423
|
+
for (let n = video; n && n !== root; n = n.parentElement) {
|
|
1424
|
+
const parent = n.parentElement;
|
|
1425
|
+
if (!parent) break;
|
|
1426
|
+
for (const child of parent.children) {
|
|
1427
|
+
if (chain.has(child) || child === video || child.tagName === 'VIDEO' || child.tagName === 'CANVAS' && child.width > 200) continue;
|
|
1428
|
+
if (/^(nxu|nexus)/i.test(child.id || '') || [...child.classList].some(c => c.startsWith('nxu-') && c !== 'nxu-site-hide')) continue;
|
|
1429
|
+
if (child.tagName === 'TRACK' || child.tagName === 'SOURCE' || child.tagName === 'STYLE' || child.tagName === 'SCRIPT') continue;
|
|
1430
|
+
const interactive = child.matches(CTRL) || !!child.querySelector(CTRL);
|
|
1431
|
+
const text = (child.textContent || '').trim();
|
|
1432
|
+
// Text without any control: most likely the site's own subtitles.
|
|
1433
|
+
if (!interactive && text) continue;
|
|
1434
|
+
child.classList.add('nxu-site-hide');
|
|
1435
|
+
hidden.push(child);
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
(this._hidden || []).forEach(n => { if (!hidden.includes(n)) n.classList.remove('nxu-site-hide'); });
|
|
1439
|
+
this._hidden = hidden;
|
|
1440
|
+
};
|
|
1441
|
+
run();
|
|
1442
|
+
if (!this._hideObs || this._hideObsRoot !== root) {
|
|
1443
|
+
this._hideObs?.disconnect();
|
|
1444
|
+
let timer = 0;
|
|
1445
|
+
this._hideObs = new MutationObserver(() => { if (!timer) timer = setTimeout(() => { timer = 0; if (root.classList.contains('nxu-site-ui-off')) run(); }, 250); });
|
|
1446
|
+
this._hideObs.observe(root, { childList: true, subtree: true });
|
|
1447
|
+
this._hideObsRoot = root;
|
|
1448
|
+
}
|
|
1449
|
+
},
|
|
1377
1450
|
_releaseSiteUi(root, video) {
|
|
1451
|
+
this._structuralHide(root, video, false);
|
|
1378
1452
|
root?.classList.remove('nxu-site-ui-off');
|
|
1379
1453
|
try { root?.querySelectorAll('.nxu-keep').forEach(n => n.classList.remove('nxu-keep')); } catch (_) { }
|
|
1380
1454
|
if (video?.dataset.nxuControls) { video.setAttribute('controls', ''); delete video.dataset.nxuControls; }
|
|
@@ -2225,14 +2299,21 @@
|
|
|
2225
2299
|
// โโ settings & language helpers
|
|
2226
2300
|
_settings() {
|
|
2227
2301
|
return {
|
|
2228
|
-
audioMode:
|
|
2302
|
+
audioMode: this._audioMode(),
|
|
2229
2303
|
provider: STORE.get('nxu_translation_provider', 'auto'),
|
|
2230
2304
|
localFirst: STORE.get('nxu_stt_local_first', true) !== false
|
|
2231
2305
|
};
|
|
2232
2306
|
},
|
|
2307
|
+
// Two sources only: the video's own sound (default) or the microphone. Older saved
|
|
2308
|
+
// values (auto / dual) mean "video sound". iPhone/iPad Safari can only use the mic.
|
|
2309
|
+
_audioMode() {
|
|
2310
|
+
if (this._isAppleMobile()) return 'mic';
|
|
2311
|
+
return STORE.get('nxu_audio_mode', 'media') === 'mic' ? 'mic' : 'media';
|
|
2312
|
+
},
|
|
2313
|
+
// The subtitle language is always chosen by the user (no guessing): empty until set.
|
|
2233
2314
|
loadLanguageSettings() {
|
|
2234
|
-
const out = baseLang(STORE.get('nxu_subtitle_language', '') ||
|
|
2235
|
-
this.outLang = LANG_BY_CODE.has(out) ? out :
|
|
2315
|
+
const out = baseLang(STORE.get('nxu_subtitle_language', '') || '');
|
|
2316
|
+
this.outLang = out && LANG_BY_CODE.has(out) ? out : '';
|
|
2236
2317
|
const saved = STORE.get('nxu_speaker_language', '');
|
|
2237
2318
|
this.inLang = this._localeFor(saved) || this._defaultSpeakerLocale();
|
|
2238
2319
|
},
|
|
@@ -2377,11 +2458,73 @@
|
|
|
2377
2458
|
if (!audio.length) throw new Error('no audio was shared');
|
|
2378
2459
|
return new MediaStream(audio);
|
|
2379
2460
|
},
|
|
2461
|
+
// Is the microphone switched off for this page by the site itself (Permissions-Policy)?
|
|
2462
|
+
// Then the browser refuses at once, without ever asking the user.
|
|
2463
|
+
_micBlockedByPolicy() {
|
|
2464
|
+
try {
|
|
2465
|
+
const pp = document.permissionsPolicy || document.featurePolicy;
|
|
2466
|
+
return !!(pp && typeof pp.allowsFeature === 'function' && !pp.allowsFeature('microphone'));
|
|
2467
|
+
} catch (_) { return false; }
|
|
2468
|
+
},
|
|
2469
|
+
async _micPermissionState() {
|
|
2470
|
+
try { return (await withTimeout(navigator.permissions.query({ name: 'microphone' }), 800)).state || 'unknown'; } catch (_) { return 'unknown'; }
|
|
2471
|
+
},
|
|
2472
|
+
// Does a captured stream carry any sound? Cross-origin or protected media gives a
|
|
2473
|
+
// track of pure digital silence. Only judged while the video is audibly playing.
|
|
2474
|
+
async _hasSignal(stream) {
|
|
2475
|
+
const v = STATE.video;
|
|
2476
|
+
if (!v || v.paused || v.muted || !(v.volume > 0) || typeof v.captureStream !== 'function') return true;
|
|
2477
|
+
const Ctx = window.AudioContext || window.webkitAudioContext;
|
|
2478
|
+
if (!Ctx) return true;
|
|
2479
|
+
let ctx = null;
|
|
2480
|
+
try {
|
|
2481
|
+
ctx = new Ctx();
|
|
2482
|
+
const src = ctx.createMediaStreamSource(stream);
|
|
2483
|
+
const an = ctx.createAnalyser();
|
|
2484
|
+
an.fftSize = 512;
|
|
2485
|
+
src.connect(an);
|
|
2486
|
+
if (ctx.state === 'suspended') { try { await ctx.resume(); } catch (_) { } }
|
|
2487
|
+
const buf = new Float32Array(an.fftSize);
|
|
2488
|
+
let peak = 0;
|
|
2489
|
+
for (let i = 0; i < 12 && peak < 0.0008; i++) {
|
|
2490
|
+
await new Promise(r => setTimeout(r, 120));
|
|
2491
|
+
an.getFloatTimeDomainData(buf);
|
|
2492
|
+
for (let j = 0; j < buf.length; j++) { const x = Math.abs(buf[j]); if (x > peak) peak = x; }
|
|
2493
|
+
}
|
|
2494
|
+
return peak >= 0.0008;
|
|
2495
|
+
} catch (_) { return true; } finally { try { ctx?.close(); } catch (_) { } }
|
|
2496
|
+
},
|
|
2497
|
+
// The video's own sound: the element itself when it gives real audio, otherwise (on a
|
|
2498
|
+
// computer) the tab's audio, which the browser lets the user share in one dialog.
|
|
2499
|
+
_liveTab() {
|
|
2500
|
+
const st = this._sharedTab;
|
|
2501
|
+
return st && st.getAudioTracks().some(tr => tr.readyState === 'live') ? st : null;
|
|
2502
|
+
},
|
|
2503
|
+
async _captureMediaAudio(token) {
|
|
2504
|
+
// A tab the user already shared keeps working across restarts (no new dialog).
|
|
2505
|
+
const tab = this._liveTab();
|
|
2506
|
+
if (tab) return tab;
|
|
2507
|
+
let web = this._captureElementAudio();
|
|
2508
|
+
if (web && !(await this._hasSignal(web))) {
|
|
2509
|
+
web.getTracks().forEach(tr => tr.stop());
|
|
2510
|
+
web = null;
|
|
2511
|
+
logDebug('AI Sub: the video element gives no sound here (protected or cross-origin media).', 'info');
|
|
2512
|
+
}
|
|
2513
|
+
if (web) { this._webFromElement = true; return web; }
|
|
2514
|
+
if (token !== this._startToken) return null;
|
|
2515
|
+
if (this._isAppleMobile() || this._isAndroid() || !navigator.mediaDevices?.getDisplayMedia) return null;
|
|
2516
|
+
showToast(t('subAskTab'));
|
|
2517
|
+
try { return (this._sharedTab = await this._captureDisplayAudio()); } catch (err) {
|
|
2518
|
+
logDebug('AI Sub: tab audio not shared: ' + (err.message || err.name), 'warn');
|
|
2519
|
+
return null;
|
|
2520
|
+
}
|
|
2521
|
+
},
|
|
2380
2522
|
async _startAudioCapture(token) {
|
|
2381
2523
|
this._stopAudioCapture();
|
|
2382
|
-
const mode = this.
|
|
2524
|
+
const mode = this._audioMode();
|
|
2383
2525
|
this.audioMode = mode;
|
|
2384
2526
|
this._webFromElement = false;
|
|
2527
|
+
this._micMixed = false;
|
|
2385
2528
|
this._mediaPeak = 0;
|
|
2386
2529
|
this._trackSince = 0;
|
|
2387
2530
|
this._levels = { mic: 0, media: 0 };
|
|
@@ -2392,36 +2535,39 @@
|
|
|
2392
2535
|
this.captureMode = 'ios-mic';
|
|
2393
2536
|
return;
|
|
2394
2537
|
}
|
|
2538
|
+
const stopAll = (...streams) => streams.forEach(st => st?.getTracks().forEach(tr => tr.stop()));
|
|
2539
|
+
const policyBlocked = this._micBlockedByPolicy();
|
|
2395
2540
|
let web = null, mic = null;
|
|
2396
|
-
if (mode === '
|
|
2397
|
-
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
|
|
2403
|
-
|
|
2541
|
+
if (mode === 'media' || policyBlocked) {
|
|
2542
|
+
if (policyBlocked && mode === 'mic') showToast(t('subMicBlockedSite'));
|
|
2543
|
+
web = await this._captureMediaAudio(token);
|
|
2544
|
+
if (token !== this._startToken) { stopAll(web); throw new Error('cancelled'); }
|
|
2545
|
+
if (!web && policyBlocked) { const e = new Error('microphone blocked by the site'); e.name = 'PolicyBlocked'; throw e; }
|
|
2546
|
+
}
|
|
2547
|
+
// The microphone is asked for explicitly (so the permission prompt shows up right
|
|
2548
|
+
// away): always in mic mode, as the fallback when the video sound is unavailable,
|
|
2549
|
+
// and alongside video sound for browser recognition, which may still need it.
|
|
2550
|
+
if (!policyBlocked && (!web || this._useWebSpeech)) {
|
|
2551
|
+
if (!web && (await this._micPermissionState()) === 'prompt') showToast(t('subAskMic'));
|
|
2552
|
+
try {
|
|
2553
|
+
// Echo cancellation would erase the very speaker sound we want to hear.
|
|
2554
|
+
mic = await this._requestMic(!web);
|
|
2555
|
+
// With the video sound in hand the microphone was only needed for the
|
|
2556
|
+
// permission; it is not kept open (no recording light, no audio ducking).
|
|
2557
|
+
if (web) { stopAll(mic); mic = null; this._micGranted = true; }
|
|
2558
|
+
} catch (err) {
|
|
2559
|
+
if (!web) throw err;
|
|
2560
|
+
logDebug('AI Sub: microphone unavailable, using the video sound only.', 'info');
|
|
2404
2561
|
}
|
|
2405
2562
|
}
|
|
2406
|
-
if (token !== this._startToken) { web
|
|
2407
|
-
|
|
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
|
-
}
|
|
2563
|
+
if (token !== this._startToken) { stopAll(web, mic); throw new Error('cancelled'); }
|
|
2564
|
+
if (mode === 'media' && !web && mic) showToast(t('subUsingMicFallback'));
|
|
2418
2565
|
this.mediaStream = mic;
|
|
2419
2566
|
this.webMediaStream = web;
|
|
2420
|
-
|
|
2421
|
-
this.captureMode = web && mic && mode !== 'media' ? prefix + 'dual' : web ? prefix + 'media' : 'mic';
|
|
2567
|
+
this.captureMode = web ? 'media' : 'mic';
|
|
2422
2568
|
|
|
2423
2569
|
const AudioCtx = window.AudioContext || window.webkitAudioContext;
|
|
2424
|
-
const micForMix =
|
|
2570
|
+
const micForMix = web ? null : mic;
|
|
2425
2571
|
if (!AudioCtx || (!micForMix && !web)) return;
|
|
2426
2572
|
try {
|
|
2427
2573
|
let ctx;
|
|
@@ -2455,8 +2601,9 @@
|
|
|
2455
2601
|
connect(web, 'media');
|
|
2456
2602
|
this.audioContext = ctx;
|
|
2457
2603
|
this.audioNodes = nodes;
|
|
2458
|
-
this
|
|
2459
|
-
this.
|
|
2604
|
+
// Recognition hears exactly this mix (video sound, or the echo-free microphone).
|
|
2605
|
+
this.recognitionAudioStream = dest.stream;
|
|
2606
|
+
this._levelTimer = setInterval(() => { if (!document.hidden) { this._refreshLevels(); this._updateListenChip(); } }, 400);
|
|
2460
2607
|
} catch (err) {
|
|
2461
2608
|
logDebug('AI Sub: audio analysis unavailable: ' + (err.message || err.name), 'info');
|
|
2462
2609
|
}
|
|
@@ -2465,6 +2612,7 @@
|
|
|
2465
2612
|
clearInterval(this._levelTimer);
|
|
2466
2613
|
this._levelTimer = null;
|
|
2467
2614
|
[this.mediaStream, this.webMediaStream, this.recognitionAudioStream].forEach(stream => {
|
|
2615
|
+
if (stream && stream === this._sharedTab) return; // released only on a real stop
|
|
2468
2616
|
try { stream?.getTracks().forEach(tr => tr.stop()); } catch (_) { }
|
|
2469
2617
|
});
|
|
2470
2618
|
this.mediaStream = this.webMediaStream = this.recognitionAudioStream = null;
|
|
@@ -2601,8 +2749,12 @@
|
|
|
2601
2749
|
},
|
|
2602
2750
|
_touch() { this._lastEventAt = Date.now(); },
|
|
2603
2751
|
_liveTrack() {
|
|
2604
|
-
const
|
|
2605
|
-
|
|
2752
|
+
const pick = s => { const tr = s?.getAudioTracks?.()[0]; return tr && tr.readyState === 'live' ? tr : null; };
|
|
2753
|
+
// The recognizer listens to the captured source track itself (the video's own
|
|
2754
|
+
// audio track, or the echo-free microphone), as browsers document and test it; the
|
|
2755
|
+
// mixed stream is used only once the microphone was added to a silent video sound.
|
|
2756
|
+
if (this._micMixed) return pick(this.recognitionAudioStream) || pick(this.mediaStream);
|
|
2757
|
+
return pick(this.webMediaStream) || pick(this.mediaStream) || pick(this.recognitionAudioStream);
|
|
2606
2758
|
},
|
|
2607
2759
|
_startSession(reason) {
|
|
2608
2760
|
if (!this.active) return;
|
|
@@ -2652,6 +2804,9 @@
|
|
|
2652
2804
|
if (!this.active) return;
|
|
2653
2805
|
if (!document.hidden) this._checkAudio();
|
|
2654
2806
|
if (!this.active) return;
|
|
2807
|
+
// The user stopped sharing the tab's audio from the browser's bar.
|
|
2808
|
+
const shared = this.webMediaStream && !this._webFromElement ? this.webMediaStream.getAudioTracks() : [];
|
|
2809
|
+
if (shared.length && shared.every(tr => tr.readyState === 'ended')) { this.stop(t('subTabShareEnded')); return; }
|
|
2655
2810
|
if (!this._useWebSpeech) { updateAIBtnUX(); return; }
|
|
2656
2811
|
const now = Date.now();
|
|
2657
2812
|
if (!this._restartTimer && !this._waitOnline && now - this._lastEventAt > 25000) {
|
|
@@ -2663,18 +2818,111 @@
|
|
|
2663
2818
|
this._scheduleRestart('watchdog', 100, true);
|
|
2664
2819
|
} else if (this._recognitionInput === 'track' && !this._trackDisabled && this._trackSince && (
|
|
2665
2820
|
// Captured video audio is silent (e.g. cross-origin media) while the video plays,
|
|
2666
|
-
(
|
|
2667
|
-
// or sound is present but the engine never returns
|
|
2668
|
-
|
|
2821
|
+
(this._mediaSilent() && !this._micMixed) ||
|
|
2822
|
+
// or (microphone track only) sound is present but the engine never returns
|
|
2823
|
+
// words from the track. Never judged on the video sound: music, effects or a
|
|
2824
|
+
// long quiet scene are no reason to give up on it.
|
|
2825
|
+
(!this.webMediaStream && this.captureMode === 'mic' && now - this._trackSince > 40000 && this._lastResultAt < this._trackSince && this._levels.mic >= SPEECH_LEVEL))) {
|
|
2826
|
+
// Silent video sound: keep feeding the recognizer, from the echo-free microphone,
|
|
2827
|
+
// and offer the tab's sound (one tap) in the subtitle area.
|
|
2828
|
+
if (this.webMediaStream) { if (!this._micMixing) this._mixInMic(); updateAIBtnUX(); return; }
|
|
2669
2829
|
this._trackDisabled = true;
|
|
2670
|
-
logDebug('AI Sub: captured
|
|
2830
|
+
logDebug('AI Sub: captured audio unusable, switching to the recognizerโs own microphone.', 'warn');
|
|
2831
|
+
if (!this._micMixed) showToast(t('subUsingMicFallback'));
|
|
2671
2832
|
this._preparePlaybackMic();
|
|
2672
2833
|
this._destroyRecognizer();
|
|
2673
2834
|
this._createRecognizer();
|
|
2674
2835
|
this._scheduleRestart('track-fallback', 150, true);
|
|
2675
2836
|
}
|
|
2837
|
+
this._updateListenChip();
|
|
2676
2838
|
updateAIBtnUX();
|
|
2677
2839
|
},
|
|
2840
|
+
// The video is audibly playing but the captured sound has stayed digitally silent.
|
|
2841
|
+
_mediaSilent() {
|
|
2842
|
+
const v = STATE.video;
|
|
2843
|
+
return !!(this.webMediaStream && this._trackSince && Date.now() - this._trackSince > 6000 && this._mediaPeak < 0.003
|
|
2844
|
+
&& v && !v.paused && !v.muted && v.volume > 0);
|
|
2845
|
+
},
|
|
2846
|
+
async _mixInMic() {
|
|
2847
|
+
const ctx = this.audioContext, nodes = this.audioNodes;
|
|
2848
|
+
if (this._micMixed || this._micMixing || !ctx || !nodes?.mix) return false;
|
|
2849
|
+
this._micMixing = true;
|
|
2850
|
+
try {
|
|
2851
|
+
if (!this.mediaStream) {
|
|
2852
|
+
try { this.mediaStream = await this._requestMic(true); } catch (_) { return false; }
|
|
2853
|
+
if (!this.active || this.audioContext !== ctx) { this.mediaStream.getTracks().forEach(tr => tr.stop()); this.mediaStream = null; return false; }
|
|
2854
|
+
}
|
|
2855
|
+
const src = ctx.createMediaStreamSource(this.mediaStream);
|
|
2856
|
+
const an = ctx.createAnalyser();
|
|
2857
|
+
an.fftSize = 512;
|
|
2858
|
+
an.smoothingTimeConstant = 0.3;
|
|
2859
|
+
src.connect(an);
|
|
2860
|
+
src.connect(nodes.mix);
|
|
2861
|
+
nodes.list.push(src, an);
|
|
2862
|
+
nodes.analysers.mic = an;
|
|
2863
|
+
this._micMixed = true;
|
|
2864
|
+
this._preparePlaybackMic();
|
|
2865
|
+
this._trackSince = Date.now();
|
|
2866
|
+
this.captureMode = 'mic';
|
|
2867
|
+
if (this._useWebSpeech && this.active) {
|
|
2868
|
+
// Listen to the mix (video + microphone) from now on.
|
|
2869
|
+
this._destroyRecognizer();
|
|
2870
|
+
this._createRecognizer();
|
|
2871
|
+
this._scheduleRestart('mic-mixed', 150, true);
|
|
2872
|
+
}
|
|
2873
|
+
showToast(t('subUsingMicFallback'));
|
|
2874
|
+
logDebug('AI Sub: the video sound is silent here, listening through the microphone.', 'warn');
|
|
2875
|
+
return true;
|
|
2876
|
+
} catch (_) { return false; } finally { this._micMixing = false; }
|
|
2877
|
+
},
|
|
2878
|
+
// One tap in the subtitle area: listen to this tab's sound instead (needs the tap,
|
|
2879
|
+
// because the browser only opens its sharing dialog for a user action).
|
|
2880
|
+
async shareTabAudio() {
|
|
2881
|
+
if (!this.active || !navigator.mediaDevices?.getDisplayMedia) return;
|
|
2882
|
+
try {
|
|
2883
|
+
const st = await this._captureDisplayAudio();
|
|
2884
|
+
try { this._sharedTab?.getTracks().forEach(tr => tr.stop()); } catch (_) { }
|
|
2885
|
+
this._sharedTab = st;
|
|
2886
|
+
this._trackDisabled = false;
|
|
2887
|
+
await this.restart('tab audio shared');
|
|
2888
|
+
} catch (err) {
|
|
2889
|
+
logDebug('AI Sub: tab audio not shared: ' + (err.message || err.name), 'warn');
|
|
2890
|
+
showToast(t('subTabNotShared'));
|
|
2891
|
+
}
|
|
2892
|
+
},
|
|
2893
|
+
_canShareTab() {
|
|
2894
|
+
return !this._isAppleMobile() && !this._isAndroid() && !!navigator.mediaDevices?.getDisplayMedia && !this._liveTab();
|
|
2895
|
+
},
|
|
2896
|
+
// A small "listening" chip: shows that sound is arriving (level meter), and when the
|
|
2897
|
+
// video's sound cannot be heard, says so with a one-tap way to connect the tab sound.
|
|
2898
|
+
_updateListenChip() {
|
|
2899
|
+
const overlay = shadow?.getElementById('nxu-subtitle-overlay');
|
|
2900
|
+
if (!overlay) return;
|
|
2901
|
+
let chip = overlay.querySelector('.sub-listen');
|
|
2902
|
+
if (!this.active) { chip?.remove(); return; }
|
|
2903
|
+
if (!chip) {
|
|
2904
|
+
chip = createEl('div', 'sub-listen');
|
|
2905
|
+
const btn = createEl('button', 'sub-listen-btn', t('subShareTab'), { type: 'button' });
|
|
2906
|
+
btn.addEventListener('click', (e) => { e.stopPropagation(); this.shareTabAudio(); });
|
|
2907
|
+
const meter = createEl('span', 'sub-listen-meter');
|
|
2908
|
+
meter.appendChild(createEl('i'));
|
|
2909
|
+
chip.append(createEl('span', 'sub-listen-text'), meter, btn);
|
|
2910
|
+
overlay.prepend(chip);
|
|
2911
|
+
}
|
|
2912
|
+
const wantedVideo = this.audioMode === 'media' && this.captureMode !== 'ios-mic';
|
|
2913
|
+
const silent = this._mediaSilent();
|
|
2914
|
+
const fellBack = wantedVideo && !this.webMediaStream;
|
|
2915
|
+
const offer = (silent || fellBack) && this._canShareTab();
|
|
2916
|
+
const showing = !!(shadow.getElementById('nxu-final-slot')?.childElementCount || shadow.getElementById('nxu-interim-slot')?.childElementCount);
|
|
2917
|
+
chip.classList.toggle('hide', showing && !offer);
|
|
2918
|
+
chip.classList.toggle('warn', silent);
|
|
2919
|
+
chip.classList.toggle('warn', silent || !!this._issue);
|
|
2920
|
+
if (this._issue) chip.classList.remove('hide');
|
|
2921
|
+
chip.querySelector('.sub-listen-text').textContent = this._issue === 'net' ? t('subIssueNet') : silent ? t('subVideoSilent') : this.webMediaStream && !this._micMixed ? t('subHearVideo') : t('subHearMic');
|
|
2922
|
+
const level = Math.max(this._levels.media || 0, this._levels.mic || 0);
|
|
2923
|
+
chip.querySelector('.sub-listen-meter i').style.width = Math.min(100, Math.round(level * 400)) + '%';
|
|
2924
|
+
chip.querySelector('.sub-listen-btn').style.display = offer ? '' : 'none';
|
|
2925
|
+
},
|
|
2678
2926
|
_preparePlaybackMic() {
|
|
2679
2927
|
const track = this.mediaStream?.getAudioTracks?.()[0];
|
|
2680
2928
|
if (!track || typeof track.applyConstraints !== 'function') return;
|
|
@@ -2695,6 +2943,7 @@
|
|
|
2695
2943
|
this._networkErrors = 0;
|
|
2696
2944
|
this._networkRetryMs = 0;
|
|
2697
2945
|
this._audioCaptureErrors = 0;
|
|
2946
|
+
this._issue = '';
|
|
2698
2947
|
const finals = [];
|
|
2699
2948
|
const interim = [];
|
|
2700
2949
|
let confidence = null;
|
|
@@ -2859,11 +3108,21 @@
|
|
|
2859
3108
|
}
|
|
2860
3109
|
return;
|
|
2861
3110
|
case 'audio-capture':
|
|
3111
|
+
if (this._recognitionInput === 'track' && !this._trackDisabled) {
|
|
3112
|
+
// The engine could not read the captured track: let it use its own input.
|
|
3113
|
+
this._trackDisabled = true;
|
|
3114
|
+
logDebug('AI Sub: the speech engine could not read the captured audio, using its own input.', 'warn');
|
|
3115
|
+
this._destroyRecognizer();
|
|
3116
|
+
this._createRecognizer();
|
|
3117
|
+
this._scheduleRestart('track-capture-error', 200, true);
|
|
3118
|
+
return;
|
|
3119
|
+
}
|
|
2862
3120
|
if (++this._audioCaptureErrors >= 3) { this.stop(t('subNoMic')); return; }
|
|
2863
3121
|
this._networkRetryMs = 1000;
|
|
2864
3122
|
return;
|
|
2865
3123
|
case 'network': {
|
|
2866
3124
|
this._networkErrors++;
|
|
3125
|
+
this._issue = this._networkErrors >= 2 ? 'net' : '';
|
|
2867
3126
|
if (this._networkErrors >= 12) { this.stop(t('subNetworkFailed')); return; }
|
|
2868
3127
|
if (navigator.onLine === false) { this._waitOnline = true; return; }
|
|
2869
3128
|
this._networkRetryMs = Math.min(15000, Math.max(800, (this._networkRetryMs || 600) * 1.7));
|
|
@@ -3389,6 +3648,7 @@
|
|
|
3389
3648
|
this._networkErrors = 0;
|
|
3390
3649
|
this._networkRetryMs = 0;
|
|
3391
3650
|
this._audioCaptureErrors = 0;
|
|
3651
|
+
this._issue = '';
|
|
3392
3652
|
this._sessionFailures = 0;
|
|
3393
3653
|
this._trackDisabled = false;
|
|
3394
3654
|
this._waitOnline = false;
|
|
@@ -3412,6 +3672,8 @@
|
|
|
3412
3672
|
},
|
|
3413
3673
|
async start({ silent = false } = {}) {
|
|
3414
3674
|
if (this.state !== 'idle') return;
|
|
3675
|
+
this.loadLanguageSettings();
|
|
3676
|
+
if (!this.outLang) { this._askLanguage(); return; }
|
|
3415
3677
|
const SR = window.SpeechRecognition || window.webkitSpeechRecognition;
|
|
3416
3678
|
this._cloud = AI.asrProvider() !== 'browser' && !!(window.AudioContext || window.webkitAudioContext);
|
|
3417
3679
|
// With cloud recognition on iPhone/iPad, Safari's own recognizer stays off
|
|
@@ -3421,7 +3683,6 @@
|
|
|
3421
3683
|
if (window.isSecureContext === false) { showToast(t('subNeedsHttps')); return; }
|
|
3422
3684
|
const token = ++this._startToken;
|
|
3423
3685
|
this.state = 'starting';
|
|
3424
|
-
this.loadLanguageSettings();
|
|
3425
3686
|
this._resetRuntime();
|
|
3426
3687
|
this._abortCtrl = new AbortController();
|
|
3427
3688
|
this._syncUI();
|
|
@@ -3435,7 +3696,7 @@
|
|
|
3435
3696
|
this._syncUI();
|
|
3436
3697
|
const denied = err?.name === 'NotAllowedError' || err?.name === 'SecurityError';
|
|
3437
3698
|
logDebug('AI Sub: audio input failed: ' + (err?.message || err?.name), 'error');
|
|
3438
|
-
showToast(t(denied ? 'subMicDenied' : 'subMicUnavailable'));
|
|
3699
|
+
showToast(t(err?.name === 'PolicyBlocked' ? 'subMicBlockedNoMedia' : err?.name === 'NotFoundError' ? 'subNoMic' : denied ? 'subMicDenied' : 'subMicUnavailable'));
|
|
3439
3700
|
return;
|
|
3440
3701
|
}
|
|
3441
3702
|
if (token !== this._startToken) return;
|
|
@@ -3458,6 +3719,7 @@
|
|
|
3458
3719
|
clearInterval(this._watchdogTimer);
|
|
3459
3720
|
this._watchdogTimer = setInterval(() => this._watchdog(), 4000);
|
|
3460
3721
|
this.getOverlay();
|
|
3722
|
+
this._updateListenChip();
|
|
3461
3723
|
SUB_LAYOUT.schedule();
|
|
3462
3724
|
this._syncUI();
|
|
3463
3725
|
if (!silent) showToast(t('subOn'));
|
|
@@ -3504,6 +3766,9 @@
|
|
|
3504
3766
|
this._restoreAppleSession();
|
|
3505
3767
|
this._resetRuntime();
|
|
3506
3768
|
if (!keepOverlay) {
|
|
3769
|
+
try { this._sharedTab?.getTracks().forEach(tr => tr.stop()); } catch (_) { }
|
|
3770
|
+
this._sharedTab = null;
|
|
3771
|
+
shadow?.getElementById('nxu-subtitle-overlay')?.querySelector('.sub-listen')?.remove();
|
|
3507
3772
|
const overlay = shadow?.getElementById('nxu-subtitle-overlay');
|
|
3508
3773
|
if (overlay) {
|
|
3509
3774
|
overlay.style.opacity = '0';
|
|
@@ -3516,6 +3781,19 @@
|
|
|
3516
3781
|
if (wasActive && message) showToast(message);
|
|
3517
3782
|
if (wasActive) logDebug('AI Sub stopped.', 'info');
|
|
3518
3783
|
},
|
|
3784
|
+
// No subtitle language yet: open the settings with the language picker highlighted.
|
|
3785
|
+
_askLanguage() {
|
|
3786
|
+
showToast(t('subPickLanguage'));
|
|
3787
|
+
const modal = shadow?.getElementById('trans-modal');
|
|
3788
|
+
if (modal && modal.style.display !== 'flex') openPanel(modal);
|
|
3789
|
+
const sel = shadow?.getElementById('stt-out');
|
|
3790
|
+
if (sel) {
|
|
3791
|
+
sel.classList.remove('need');
|
|
3792
|
+
void sel.offsetWidth;
|
|
3793
|
+
sel.classList.add('need');
|
|
3794
|
+
try { sel.focus({ preventScroll: true }); } catch (_) { }
|
|
3795
|
+
}
|
|
3796
|
+
},
|
|
3519
3797
|
toggle() {
|
|
3520
3798
|
if (this.state === 'idle') this.start();
|
|
3521
3799
|
else this.stop(t('subOff'));
|
|
@@ -3532,7 +3810,7 @@
|
|
|
3532
3810
|
updateAIBtnUX();
|
|
3533
3811
|
},
|
|
3534
3812
|
setOutputLanguage(value) {
|
|
3535
|
-
this.outLang = LANG_BY_CODE.has(value) ? value : '
|
|
3813
|
+
this.outLang = value && LANG_BY_CODE.has(value) ? value : '';
|
|
3536
3814
|
this._recentQueued = [];
|
|
3537
3815
|
if (this.active) this._warmBrowserTranslator(baseLang(this._recognitionLanguage()), this.outLang);
|
|
3538
3816
|
updateAIBtnUX();
|
|
@@ -5314,7 +5592,24 @@
|
|
|
5314
5592
|
shieldUntil: 0,
|
|
5315
5593
|
noteTap() { this.tapAt = Date.now(); },
|
|
5316
5594
|
noteType() { this.typeAt = Date.now(); },
|
|
5317
|
-
shield(ms = 650) { this.shieldUntil = Math.max(this.shieldUntil, Date.now() + ms); },
|
|
5595
|
+
shield(ms = 650) { this.shieldUntil = Math.max(this.shieldUntil, Date.now() + ms); this._arm(); },
|
|
5596
|
+
// The page-wide click swallower is attached only while the shield is up (a permanent
|
|
5597
|
+
// non-passive touch listener on the window slows every tap and scroll on phones).
|
|
5598
|
+
_types: ['click', 'dblclick', 'mousedown', 'mouseup', 'pointerdown', 'pointerup', 'touchstart', 'touchend'],
|
|
5599
|
+
_arm() {
|
|
5600
|
+
if (!this._swallow) return;
|
|
5601
|
+
if (!this._armed) {
|
|
5602
|
+
this._armed = true;
|
|
5603
|
+
this._types.forEach(type => window.addEventListener(type, this._swallow, { capture: true, passive: false }));
|
|
5604
|
+
}
|
|
5605
|
+
clearTimeout(this._disarmTimer);
|
|
5606
|
+
const left = this.shieldUntil - Date.now();
|
|
5607
|
+
this._disarmTimer = setTimeout(() => {
|
|
5608
|
+
if (Date.now() < this.shieldUntil) { this._arm(); return; }
|
|
5609
|
+
this._armed = false;
|
|
5610
|
+
this._types.forEach(type => window.removeEventListener(type, this._swallow, { capture: true }));
|
|
5611
|
+
}, Math.max(50, left + 60));
|
|
5612
|
+
},
|
|
5318
5613
|
accidental() {
|
|
5319
5614
|
const now = Date.now();
|
|
5320
5615
|
if (now - (STATE._ownControlAt || 0) < 900) return false;
|
|
@@ -5332,7 +5627,8 @@
|
|
|
5332
5627
|
if (e.cancelable) e.preventDefault();
|
|
5333
5628
|
e.stopImmediatePropagation();
|
|
5334
5629
|
};
|
|
5335
|
-
|
|
5630
|
+
this._swallow = swallow;
|
|
5631
|
+
if (Date.now() < this.shieldUntil) this._arm();
|
|
5336
5632
|
}
|
|
5337
5633
|
};
|
|
5338
5634
|
|
|
@@ -5671,19 +5967,61 @@
|
|
|
5671
5967
|
hud._hideTimer = setTimeout(() => { hud.style.display = 'none'; }, 8000);
|
|
5672
5968
|
}
|
|
5673
5969
|
|
|
5970
|
+
// Who is here, for display: me first, then by name, each with their own colour and a
|
|
5971
|
+
// small mark for "watching only", "away" (screen off / other tab) and an outdated version.
|
|
5972
|
+
function roomRoster() {
|
|
5973
|
+
const safeColor = c => (/^#[0-9a-f]{3,8}$/i.test(String(c || '')) ? c : '#7c4dff');
|
|
5974
|
+
const list = Object.entries(STATE.presenceMap || {}).map(([uid, p]) => {
|
|
5975
|
+
const self = uid === STATE.userId;
|
|
5976
|
+
return {
|
|
5977
|
+
uid, self,
|
|
5978
|
+
name: self ? (STATE.nickname || t('you')) : (p?.nick || 'ID:' + String(uid).slice(0, 3)),
|
|
5979
|
+
color: safeColor(self ? STATE.color : p?.color),
|
|
5980
|
+
viewer: self ? !!STATE.isViewer : !!p?.viewer,
|
|
5981
|
+
away: !self && !!p?.hid,
|
|
5982
|
+
oldVer: !self && !!(p?.v && p.v !== NXU_VERSION)
|
|
5983
|
+
};
|
|
5984
|
+
});
|
|
5985
|
+
list.sort((a, b) => (b.self - a.self) || a.name.localeCompare(b.name));
|
|
5986
|
+
return list;
|
|
5987
|
+
}
|
|
5988
|
+
function renderRoster(box, max = 4) {
|
|
5989
|
+
const list = roomRoster();
|
|
5990
|
+
const sig = max + '|' + list.map(m => [m.uid, m.name, m.color, m.viewer, m.away, m.oldVer].join(',')).join(';');
|
|
5991
|
+
if (box._rosterSig === sig) return list;
|
|
5992
|
+
box._rosterSig = sig;
|
|
5993
|
+
box.replaceChildren();
|
|
5994
|
+
list.slice(0, max).forEach(m => {
|
|
5995
|
+
const chip = createEl('span', 'nx-who' + (m.away ? ' away' : '') + (m.self ? ' me' : ''));
|
|
5996
|
+
const dot = createEl('i', 'nx-who-dot');
|
|
5997
|
+
dot.style.background = m.color;
|
|
5998
|
+
chip.append(dot, createEl('span', 'nx-who-name', m.name + (m.self && STATE.nickname ? ' ' + t('meTag') : '')));
|
|
5999
|
+
if (m.viewer) chip.append(createEl('span', 'nx-who-tag', '๐'));
|
|
6000
|
+
if (m.away) chip.append(createEl('span', 'nx-who-tag', '๐ค'));
|
|
6001
|
+
if (m.oldVer) chip.append(createEl('span', 'nx-who-tag', 'โ ๏ธ'));
|
|
6002
|
+
chip.title = [m.name, m.viewer && t('whoViewer'), m.away && t('whoAway'), m.oldVer && t('whoOldVer')].filter(Boolean).join(' ยท ');
|
|
6003
|
+
box.appendChild(chip);
|
|
6004
|
+
});
|
|
6005
|
+
if (list.length > max) box.appendChild(createEl('span', 'nx-who more', '+' + (list.length - max)));
|
|
6006
|
+
box.title = t('whoTitle') + ' (' + list.length + ')';
|
|
6007
|
+
return list;
|
|
6008
|
+
}
|
|
6009
|
+
|
|
5674
6010
|
function updatePresenceUI() {
|
|
5675
6011
|
if (!shadow) return;
|
|
5676
6012
|
let pill = shadow.getElementById('nxu-presence-pill');
|
|
5677
6013
|
if (!pill && uiElements.uiWrapper) {
|
|
5678
6014
|
pill = createEl('div', 'presence-pill');
|
|
5679
6015
|
pill.id = 'nxu-presence-pill';
|
|
6016
|
+
pill.setAttribute('role', 'button');
|
|
6017
|
+
// Tap: the full list (everyone, one per line) โ the short row of names.
|
|
6018
|
+
pill.addEventListener('click', (e) => { e.stopPropagation(); pill.classList.toggle('open'); updatePresenceUI(); });
|
|
5680
6019
|
uiElements.uiWrapper.appendChild(pill);
|
|
5681
6020
|
}
|
|
5682
6021
|
if (!pill) return;
|
|
5683
6022
|
const entries = Object.values(STATE.presenceMap);
|
|
5684
6023
|
if (entries.length && STATE.role !== 'IDLE') {
|
|
5685
|
-
pill.
|
|
5686
|
-
pill.title = entries.map(e => e.nick || e.role || '').filter(Boolean).join(', ');
|
|
6024
|
+
renderRoster(pill, pill.classList.contains('open') ? 50 : 3);
|
|
5687
6025
|
pill.style.display = '';
|
|
5688
6026
|
} else {
|
|
5689
6027
|
pill.style.display = 'none';
|
|
@@ -5698,11 +6036,11 @@
|
|
|
5698
6036
|
|
|
5699
6037
|
function currentMediaInfo() {
|
|
5700
6038
|
if (STATE.video) {
|
|
5701
|
-
return { kind: 'video', el: STATE.video, time: STATE.video.currentTime, duration: STATE.video.duration, paused: STATE.video.paused };
|
|
6039
|
+
return { kind: 'video', el: STATE.video, time: STATE.video.currentTime, duration: STATE.video.duration, paused: STATE.video.paused, live: VIDEO_DETECTOR.isLive(STATE.video) };
|
|
5702
6040
|
}
|
|
5703
6041
|
if (STATE.cinemaIframe) {
|
|
5704
6042
|
const rep = VIDEO_DETECTOR.frameReports.get(STATE.cinemaIframe) || {};
|
|
5705
|
-
return { kind: 'iframe', el: STATE.cinemaIframe, time: STATE.lastCinemaTime || 0, duration: rep.duration, paused: rep.paused !== false };
|
|
6043
|
+
return { kind: 'iframe', el: STATE.cinemaIframe, time: STATE.lastCinemaTime || 0, duration: rep.duration, paused: rep.paused !== false, live: !!rep.live };
|
|
5706
6044
|
}
|
|
5707
6045
|
return null;
|
|
5708
6046
|
}
|
|
@@ -6170,12 +6508,21 @@
|
|
|
6170
6508
|
panel.style.top = Math.max(12, Math.min(initTop + dy, getH() - panel.offsetHeight - 12)) + 'px';
|
|
6171
6509
|
};
|
|
6172
6510
|
const onUp = () => { dragging = false; };
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6511
|
+
// Page-wide move/up listeners exist only while dragging: a permanent non-passive
|
|
6512
|
+
// touchmove on the window makes every scroll and tap on the page wait for script,
|
|
6513
|
+
// which felt sluggish on iPhone.
|
|
6514
|
+
const listen = (on) => {
|
|
6515
|
+
const m = on ? 'addEventListener' : 'removeEventListener';
|
|
6516
|
+
window[m]('mousemove', onMove);
|
|
6517
|
+
window[m]('touchmove', onMove, { passive: false });
|
|
6518
|
+
window[m]('mouseup', finish);
|
|
6519
|
+
window[m]('touchend', finish);
|
|
6520
|
+
window[m]('touchcancel', finish);
|
|
6521
|
+
};
|
|
6522
|
+
const finish = (e) => { listen(false); onUp(e); };
|
|
6523
|
+
const begin = (e) => { onDown(e); if (dragging) listen(true); };
|
|
6524
|
+
handle.addEventListener('mousedown', begin);
|
|
6525
|
+
handle.addEventListener('touchstart', begin, { passive: true });
|
|
6179
6526
|
}
|
|
6180
6527
|
|
|
6181
6528
|
function updateSmartPosition(wrapper, fab, dock, reactPill) {
|
|
@@ -6283,12 +6630,21 @@
|
|
|
6283
6630
|
STORE.set('nxu_fab_pos', { x: parseFloat(wrapper.style.left) / Math.max(1, w - 48), y: parseFloat(wrapper.style.top) / Math.max(1, h - 48) });
|
|
6284
6631
|
}
|
|
6285
6632
|
};
|
|
6286
|
-
|
|
6287
|
-
|
|
6288
|
-
|
|
6289
|
-
|
|
6290
|
-
|
|
6291
|
-
|
|
6633
|
+
// Page-wide move/up listeners exist only while dragging: a permanent non-passive
|
|
6634
|
+
// touchmove on the window makes every scroll and tap on the page wait for script,
|
|
6635
|
+
// which felt sluggish on iPhone.
|
|
6636
|
+
const listen = (on) => {
|
|
6637
|
+
const m = on ? 'addEventListener' : 'removeEventListener';
|
|
6638
|
+
window[m]('mousemove', onMove);
|
|
6639
|
+
window[m]('touchmove', onMove, { passive: false });
|
|
6640
|
+
window[m]('mouseup', finish);
|
|
6641
|
+
window[m]('touchend', finish);
|
|
6642
|
+
window[m]('touchcancel', finish);
|
|
6643
|
+
};
|
|
6644
|
+
const finish = (e) => { listen(false); onUp(e); };
|
|
6645
|
+
const begin = (e) => { onDown(e); if (dragging) listen(true); };
|
|
6646
|
+
handle.addEventListener('mousedown', begin);
|
|
6647
|
+
handle.addEventListener('touchstart', begin, { passive: true });
|
|
6292
6648
|
|
|
6293
6649
|
const restore = () => {
|
|
6294
6650
|
const saved = STORE.get('nxu_fab_pos', null);
|
|
@@ -6331,10 +6687,26 @@
|
|
|
6331
6687
|
const label = text => createEl('div', 'field-label', text);
|
|
6332
6688
|
const help = text => createEl('div', 'trans-help', text);
|
|
6333
6689
|
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
|
-
|
|
6336
|
-
|
|
6337
|
-
|
|
6690
|
+
const subtitleSelect = createSelect('stt-out', [{ value: '', label: t('chooseLanguage') }, ...LANGS.map(l => ({ value: l.code, label: l.label }))]);
|
|
6691
|
+
// What to listen to: two clear choices instead of a list of capture modes.
|
|
6692
|
+
const ios = TRANSLATOR._isAppleMobile();
|
|
6693
|
+
const sourceRow = createEl('div', 'seg', '', { id: 'stt-source', role: 'radiogroup' });
|
|
6694
|
+
const srcMedia = createEl('button', 'seg-btn', t('srcMedia'), { type: 'button', 'data-mode': 'media', role: 'radio' });
|
|
6695
|
+
const srcMic = createEl('button', 'seg-btn', t('srcMic'), { type: 'button', 'data-mode': 'mic', role: 'radio' });
|
|
6696
|
+
const sourceHelp = help('');
|
|
6697
|
+
sourceRow.append(srcMedia, srcMic);
|
|
6698
|
+
const paintSource = () => {
|
|
6699
|
+
const mode = TRANSLATOR._audioMode();
|
|
6700
|
+
[srcMedia, srcMic].forEach(b => { const on = b.dataset.mode === mode; b.classList.toggle('on', on); b.setAttribute('aria-checked', String(on)); });
|
|
6701
|
+
srcMedia.disabled = ios;
|
|
6702
|
+
sourceHelp.textContent = ios ? t('srcIosHelp') : mode === 'mic' ? t('srcMicHelp') : t('srcMediaHelp');
|
|
6703
|
+
};
|
|
6704
|
+
[srcMedia, srcMic].forEach(b => b.addEventListener('click', () => {
|
|
6705
|
+
if (b.disabled || TRANSLATOR._audioMode() === b.dataset.mode) return;
|
|
6706
|
+
STORE.set('nxu_audio_mode', b.dataset.mode);
|
|
6707
|
+
paintSource();
|
|
6708
|
+
TRANSLATOR.restart('audio source changed');
|
|
6709
|
+
}));
|
|
6338
6710
|
const positionSelect = createSelect('stt-position', [{ value: 'video', label: t('posVideo') }, { value: 'screen', label: t('posScreen') }]);
|
|
6339
6711
|
const asrSelect = createSelect('stt-asr-provider', [
|
|
6340
6712
|
{ value: 'browser', label: t('asrBrowser') }, { value: 'openai', label: t('asrOpenAI') },
|
|
@@ -6411,17 +6783,17 @@
|
|
|
6411
6783
|
const advanced = createEl('div', 'ai-advanced-body');
|
|
6412
6784
|
const offlineBtn = createEl('button', 'btn subtle', 'โฌ๏ธ ' + t('offlineDownload'));
|
|
6413
6785
|
offlineBtn.onclick = () => TRANSLATOR.downloadOfflineModels();
|
|
6414
|
-
advanced.append(label(t('
|
|
6786
|
+
advanced.append(label(t('translationEngine')), providerSelect, engineHint,
|
|
6787
|
+
label(t('asrEngine')), asrSelect,
|
|
6788
|
+
label(t('subPosition')), positionSelect,
|
|
6789
|
+
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
6790
|
help(t('modelHelp')), localRow, help(t('localFirstHelp')), offlineBtn, help(t('offlineHelp')));
|
|
6416
6791
|
details.append(createEl('summary', '', t('advanced')), advanced);
|
|
6417
6792
|
|
|
6418
6793
|
body.append(
|
|
6419
|
-
label(t('
|
|
6420
|
-
label(t('
|
|
6421
|
-
label(t('
|
|
6422
|
-
label(t('asrEngine')), asrSelect,
|
|
6423
|
-
label(t('translationEngine')), providerSelect, engineHint,
|
|
6424
|
-
label(t('subPosition')), positionSelect,
|
|
6794
|
+
label(t('heardSound')), sourceRow, sourceHelp,
|
|
6795
|
+
label(t('videoLanguage')), speakerSelect,
|
|
6796
|
+
label(t('subtitleLanguageReq')), subtitleSelect,
|
|
6425
6797
|
sizeRow, opacityRow,
|
|
6426
6798
|
details,
|
|
6427
6799
|
createEl('div', 'ai-status', t('subStatusIdle'), { id: 'nxu-ai-status' }),
|
|
@@ -6430,8 +6802,8 @@
|
|
|
6430
6802
|
);
|
|
6431
6803
|
|
|
6432
6804
|
speakerSelect.value = TRANSLATOR._recognitionLanguage();
|
|
6433
|
-
subtitleSelect.value = TRANSLATOR.outLang;
|
|
6434
|
-
|
|
6805
|
+
subtitleSelect.value = TRANSLATOR.outLang || '';
|
|
6806
|
+
paintSource();
|
|
6435
6807
|
positionSelect.value = STORE.get('nxu_sub_position', 'video');
|
|
6436
6808
|
providerSelect.value = STORE.get('nxu_translation_provider', 'auto');
|
|
6437
6809
|
asrSelect.value = STORE.get('nxu_asr_provider', 'browser');
|
|
@@ -6441,8 +6813,12 @@
|
|
|
6441
6813
|
opacitySlider.value = SUB_PREFS.opacity; opacityVal.textContent = SUB_PREFS.opacity + '%';
|
|
6442
6814
|
|
|
6443
6815
|
speakerSelect.addEventListener('change', () => { STORE.set('nxu_speaker_language', speakerSelect.value); TRANSLATOR.setSpeakerLanguage(speakerSelect.value); });
|
|
6444
|
-
subtitleSelect.addEventListener('change', () => {
|
|
6445
|
-
|
|
6816
|
+
subtitleSelect.addEventListener('change', () => {
|
|
6817
|
+
if (!subtitleSelect.value) return;
|
|
6818
|
+
subtitleSelect.classList.remove('need');
|
|
6819
|
+
STORE.set('nxu_subtitle_language', subtitleSelect.value);
|
|
6820
|
+
TRANSLATOR.setOutputLanguage(subtitleSelect.value);
|
|
6821
|
+
});
|
|
6446
6822
|
positionSelect.addEventListener('change', () => { STORE.set('nxu_sub_position', positionSelect.value); SUB_LAYOUT.schedule(); });
|
|
6447
6823
|
providerSelect.addEventListener('change', () => { STORE.set('nxu_translation_provider', providerSelect.value); TRANSLATOR._cache.clear(); TRANSLATOR._llmHistory = []; refreshEngineHint(); });
|
|
6448
6824
|
asrSelect.addEventListener('change', () => { STORE.set('nxu_asr_provider', asrSelect.value); refreshEngineHint(); TRANSLATOR.restart('recognition engine changed'); });
|
|
@@ -6503,6 +6879,13 @@
|
|
|
6503
6879
|
#ui-wrapper.ui-idle.touch-peek .fab { pointer-events:auto !important; }
|
|
6504
6880
|
#ui-wrapper.ui-idle.touch-peek > :not(.fab) { visibility:hidden !important; }
|
|
6505
6881
|
button { font-family:inherit; }
|
|
6882
|
+
button, [role="button"], .seg-btn, .cc-btn, .react-btn { touch-action:manipulation; -webkit-tap-highlight-color:transparent; }
|
|
6883
|
+
/* Touch devices: no backdrop blur. Blurring what lies behind a menu over a playing
|
|
6884
|
+
video is redone every frame and was the main cause of sluggish taps on iPhone. */
|
|
6885
|
+
@media (hover:none) and (pointer:coarse) {
|
|
6886
|
+
*, *::before, *::after { -webkit-backdrop-filter:none !important; backdrop-filter:none !important; }
|
|
6887
|
+
.nexus-container.nexus-container { --glass:rgba(20,25,30,0.5); --glass-strong:rgba(18,22,28,0.66); }
|
|
6888
|
+
}
|
|
6506
6889
|
.fab { pointer-events:auto; position:absolute; width:48px; height:48px; border-radius:50%; background:var(--glass); border:1px solid rgba(255,255,255,0.22); color:#fff; cursor:grab; font-size:22px;
|
|
6507
6890
|
backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px); box-shadow:0 4px 15px rgba(0,0,0,0.35); display:flex; align-items:center; justify-content:center; user-select:none; touch-action:none; z-index:101; padding:0; }
|
|
6508
6891
|
.fab.menu-open { background:var(--glass-active); border-color:rgba(0,230,118,0.5); }
|
|
@@ -6529,7 +6912,16 @@
|
|
|
6529
6912
|
.nx-spark { position:absolute; font-size:13px; pointer-events:none; transform:translate(-50%,-50%); opacity:0; animation:nxSpark .7s cubic-bezier(.2,.7,.3,1) both; z-index:2100; }
|
|
6530
6913
|
@keyframes nxSpark { 0% { opacity:1; transform:translate(-50%,-50%) scale(.6); } 100% { opacity:0; transform:translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.05) rotate(var(--rot)); } }
|
|
6531
6914
|
@media (prefers-reduced-motion: reduce) { .react-btn.pop, .react-btn.pop::after, .nx-spark { animation:none !important; } }
|
|
6532
|
-
.presence-pill { position:absolute; font-size:11px; padding:3px
|
|
6915
|
+
.presence-pill { position:absolute; display:flex; gap:3px; align-items:center; font-size:11px; padding:3px 4px; border-radius:99px; background:rgba(0,0,0,0.45); color:#e0e0e0; white-space:nowrap; pointer-events:auto; cursor:pointer; max-width:min(78vw, 360px); overflow:hidden; }
|
|
6916
|
+
.presence-pill.open { flex-direction:column; align-items:stretch; border-radius:12px; padding:5px; max-height:50vh; overflow:auto; }
|
|
6917
|
+
.nx-who { display:inline-flex; align-items:center; gap:4px; padding:2px 7px 2px 5px; border-radius:99px; background:rgba(255,255,255,0.1); font-size:11.5px; font-weight:600; line-height:1.3; max-width:140px; color:rgba(255,255,255,0.92); text-shadow:0 1px 2px rgba(0,0,0,0.6); }
|
|
6918
|
+
.presence-pill.open .nx-who { max-width:none; }
|
|
6919
|
+
.nx-who.me { background:rgba(255,255,255,0.18); }
|
|
6920
|
+
.nx-who.away { opacity:0.55; }
|
|
6921
|
+
.nx-who.more { padding:2px 7px; }
|
|
6922
|
+
.nx-who-dot { flex:none; width:8px; height:8px; border-radius:50%; box-shadow:0 0 5px currentColor; }
|
|
6923
|
+
.nx-who-name { overflow:hidden; text-overflow:ellipsis; }
|
|
6924
|
+
.nx-who-tag { font-size:10px; }
|
|
6533
6925
|
.dock { position:absolute; background:var(--glass-strong); border-radius:16px; padding:10px; display:flex; flex-direction:column; gap:6px; pointer-events:none; opacity:0; border:1px solid rgba(255,255,255,0.1);
|
|
6534
6926
|
transition:opacity 0.25s ease, transform 0.25s ease; box-shadow:0 10px 30px rgba(0,0,0,0.35); backdrop-filter:blur(4px); -webkit-backdrop-filter:blur(4px); z-index:90; overflow-y:auto; text-shadow:0 1px 2px rgba(0,0,0,0.8); overflow-x:hidden; width:clamp(150px, 40vw, 190px); width:clamp(150px, 40cqw, 190px); }
|
|
6535
6927
|
.dock.open { opacity:1; pointer-events:auto; border-color:rgba(0,230,118,0.3); }
|
|
@@ -6597,6 +6989,12 @@
|
|
|
6597
6989
|
.trans-check { width:18px; height:18px; accent-color:var(--accent); }
|
|
6598
6990
|
.trans-help { font-size:11px; line-height:1.45; color:rgba(255,255,255,0.55); }
|
|
6599
6991
|
.trans-help.center { text-align:center; margin-top:4px; }
|
|
6992
|
+
.seg { display:flex; gap:6px; }
|
|
6993
|
+
.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; }
|
|
6994
|
+
.seg-btn.on { background:rgba(124,77,255,0.38); border-color:rgba(160,130,255,0.95); }
|
|
6995
|
+
.seg-btn:disabled { opacity:0.4; cursor:default; }
|
|
6996
|
+
.trans-select.need { outline:2px solid #ffca28; outline-offset:1px; animation:nxNeed 0.9s ease 3; }
|
|
6997
|
+
@keyframes nxNeed { 50% { outline-color:transparent; } }
|
|
6600
6998
|
.range-row { display:flex; align-items:center; gap:8px; font-size:12px; margin-top:6px; }
|
|
6601
6999
|
.range-row input { flex:1; accent-color:var(--accent); }
|
|
6602
7000
|
.range-val { min-width:42px; text-align:right; color:rgba(255,255,255,0.7); }
|
|
@@ -6792,6 +7190,12 @@
|
|
|
6792
7190
|
.shield-title { font-size:21px; font-weight:800; margin-bottom:12px; }
|
|
6793
7191
|
.shield-text { opacity:0.8; margin-bottom:18px; line-height:1.45; font-size:14px; }
|
|
6794
7192
|
.shield-btn { font-size:17px; padding:14px; }
|
|
7193
|
+
.sub-listen { display:flex; align-items:center; gap:7px; padding:4px 6px 4px 10px; border-radius:99px; background:rgba(0,0,0,0.45); color:rgba(255,255,255,0.88); font-size:12px; font-weight:600; text-shadow:0 1px 2px rgba(0,0,0,0.7); pointer-events:auto; transition:opacity 0.3s ease; }
|
|
7194
|
+
.sub-listen.hide { opacity:0; pointer-events:none; }
|
|
7195
|
+
.sub-listen.warn { background:rgba(120,60,0,0.6); }
|
|
7196
|
+
.sub-listen-meter { width:38px; height:5px; border-radius:3px; background:rgba(255,255,255,0.18); overflow:hidden; }
|
|
7197
|
+
.sub-listen-meter i { display:block; height:100%; width:0; background:#40c4ff; transition:width 0.35s ease; }
|
|
7198
|
+
.sub-listen-btn { border:0; border-radius:99px; padding:4px 10px; background:#7c4dff; color:#fff; font:inherit; font-size:12px; font-weight:700; cursor:pointer; }
|
|
6795
7199
|
.sub-overlay-container { position:absolute; bottom:11%; left:50%; transform:translateX(-50%); width:clamp(280px, 90vw, 880px); width:clamp(280px, 90cqw, 880px); display:flex; flex-direction:column; align-items:center; gap:6px; transition:opacity 0.3s ease; z-index:70; user-select:none; }
|
|
6796
7200
|
.sub-overlay-container.anchored { transition:opacity 0.3s ease; }
|
|
6797
7201
|
.sub-slot { width:100%; display:flex; flex-direction:column; align-items:center; gap:6px; transition:opacity 0.25s ease; }
|
|
@@ -6857,7 +7261,7 @@
|
|
|
6857
7261
|
.cc-title { color:#fff; font-size:15px; font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; text-shadow:0 1px 3px rgba(0,0,0,0.8); }
|
|
6858
7262
|
.cc-room { display:none; align-items:center; gap:6px; font-size:12px; font-weight:600; color:rgba(255,255,255,0.85); text-shadow:0 1px 2px rgba(0,0,0,0.8); }
|
|
6859
7263
|
.cc-room.show { display:flex; }
|
|
6860
|
-
.cc-room
|
|
7264
|
+
.cc-room { flex-wrap:wrap; gap:4px; }
|
|
6861
7265
|
.cc-bottom { bottom:0; padding:0 calc(14px + env(safe-area-inset-right, 0px)) calc(8px + env(safe-area-inset-bottom, 0px)) calc(14px + env(safe-area-inset-left, 0px)); }
|
|
6862
7266
|
.cc-center { top:50%; display:none; justify-content:center; align-items:center; gap:clamp(28px, 10vw, 72px); transform:translateY(-50%); pointer-events:none; }
|
|
6863
7267
|
.cinema-chrome.touch:not(.site-mode) .cc-center { display:flex; }
|
|
@@ -8024,6 +8428,10 @@
|
|
|
8024
8428
|
this._canvas = createEl('canvas', 'nx-ink');
|
|
8025
8429
|
container.appendChild(this._canvas);
|
|
8026
8430
|
this._ctx = this._canvas.getContext('2d');
|
|
8431
|
+
if (!this._onResize) {
|
|
8432
|
+
this._onResize = () => { if (this.strokes.size) this._kick(); };
|
|
8433
|
+
window.addEventListener('resize', this._onResize, { passive: true });
|
|
8434
|
+
}
|
|
8027
8435
|
}
|
|
8028
8436
|
const dpr = Math.min(2, window.devicePixelRatio || 1);
|
|
8029
8437
|
const w = container.clientWidth, h = container.clientHeight;
|
|
@@ -8041,6 +8449,10 @@
|
|
|
8041
8449
|
ctx.clearRect(0, 0, this._canvas.width, this._canvas.height);
|
|
8042
8450
|
const now = Date.now();
|
|
8043
8451
|
const g = SOCIAL._picture();
|
|
8452
|
+
// Points are converted to screen positions once and reused while the picture's
|
|
8453
|
+
// geometry stays the same (before: every point of every stroke, every frame).
|
|
8454
|
+
const sig = (g ? [g.cx, g.cy, g.cw, g.ch, g.cos, g.sin].map(n => Math.round(n * 100)).join(',') : '') + '|' + window.innerWidth + 'x' + window.innerHeight + '|' + (typeof ROTATE !== 'undefined' ? ROTATE.deg || 0 : 0);
|
|
8455
|
+
let animate = false, wakeIn = Infinity;
|
|
8044
8456
|
const toUi = ([u, v], ref) => {
|
|
8045
8457
|
let x, y;
|
|
8046
8458
|
if (ref === 'pic' && g) {
|
|
@@ -8054,7 +8466,11 @@
|
|
|
8054
8466
|
const alpha = s.live ? 1 : age < this.HOLD_MS ? 1 : 1 - (age - this.HOLD_MS) / this.FADE_MS;
|
|
8055
8467
|
if (alpha <= 0) { this.strokes.delete(id); continue; }
|
|
8056
8468
|
if (s.pts.length < 1) continue;
|
|
8057
|
-
|
|
8469
|
+
if (s._sig !== sig) { s._sig = sig; s._ui = []; }
|
|
8470
|
+
while (s._ui.length < s.pts.length) s._ui.push(toUi(s.pts[s._ui.length], s.ref));
|
|
8471
|
+
const pts = s._ui;
|
|
8472
|
+
if (s.live || age < 400 || age >= this.HOLD_MS) animate = true;
|
|
8473
|
+
else wakeIn = Math.min(wakeIn, this.HOLD_MS - age);
|
|
8058
8474
|
const path = () => {
|
|
8059
8475
|
ctx.beginPath();
|
|
8060
8476
|
ctx.moveTo(pts[0].x, pts[0].y);
|
|
@@ -8066,24 +8482,33 @@
|
|
|
8066
8482
|
if (pts.length > 1) ctx.lineTo(pts[pts.length - 1].x, pts[pts.length - 1].y);
|
|
8067
8483
|
};
|
|
8068
8484
|
ctx.save();
|
|
8069
|
-
|
|
8485
|
+
const a = Math.max(0, Math.min(1, alpha));
|
|
8070
8486
|
ctx.lineCap = 'round'; ctx.lineJoin = 'round';
|
|
8071
|
-
// Neon
|
|
8072
|
-
|
|
8073
|
-
ctx.
|
|
8487
|
+
// Neon look without shadowBlur (a blur per stroke per frame is what made quick
|
|
8488
|
+
// sketching lag): a wide translucent halo, the colour, then a bright core.
|
|
8489
|
+
ctx.globalAlpha = a * 0.28;
|
|
8490
|
+
ctx.strokeStyle = s.color; ctx.lineWidth = s.w + 10;
|
|
8491
|
+
path(); ctx.stroke();
|
|
8492
|
+
ctx.globalAlpha = a;
|
|
8493
|
+
ctx.lineWidth = s.w + 2.5;
|
|
8074
8494
|
path(); ctx.stroke();
|
|
8075
|
-
ctx.shadowBlur = 0;
|
|
8076
8495
|
ctx.strokeStyle = 'rgba(255,255,255,0.85)'; ctx.lineWidth = Math.max(1.5, s.w * 0.4);
|
|
8077
8496
|
path(); ctx.stroke();
|
|
8078
8497
|
// A sparkle at the tip while it is being drawn.
|
|
8079
8498
|
if (s.live || age < 400) {
|
|
8080
8499
|
const tip = pts[pts.length - 1];
|
|
8081
|
-
ctx.
|
|
8082
|
-
ctx.beginPath(); ctx.arc(tip.x, tip.y, s.w *
|
|
8500
|
+
ctx.globalAlpha = a * 0.35; ctx.fillStyle = s.color;
|
|
8501
|
+
ctx.beginPath(); ctx.arc(tip.x, tip.y, s.w * 1.9, 0, Math.PI * 2); ctx.fill();
|
|
8502
|
+
ctx.globalAlpha = a; ctx.fillStyle = '#fff';
|
|
8503
|
+
ctx.beginPath(); ctx.arc(tip.x, tip.y, s.w * 0.8, 0, Math.PI * 2); ctx.fill();
|
|
8083
8504
|
}
|
|
8084
8505
|
ctx.restore();
|
|
8085
8506
|
}
|
|
8086
|
-
|
|
8507
|
+
// Redraw every frame only while something moves (drawing, the tip sparkle, fading);
|
|
8508
|
+
// finished strokes simply stay on the canvas until their fade begins.
|
|
8509
|
+
clearTimeout(this._wakeTimer);
|
|
8510
|
+
if (animate) this._kick();
|
|
8511
|
+
else if (wakeIn < Infinity) this._wakeTimer = setTimeout(() => this._kick(), wakeIn + 5);
|
|
8087
8512
|
},
|
|
8088
8513
|
active() { return !!this._catcher?.isConnected; },
|
|
8089
8514
|
start() {
|
|
@@ -8380,7 +8805,8 @@
|
|
|
8380
8805
|
if (!info) return false;
|
|
8381
8806
|
const r = info.el.getBoundingClientRect();
|
|
8382
8807
|
if (r.width < Math.min(420, window.innerWidth * 0.6)) return false;
|
|
8383
|
-
|
|
8808
|
+
// A movie or episode โ or a live channel (endless, or a short moving window).
|
|
8809
|
+
return !!info.live || (Number.isFinite(info.duration) && info.duration >= 90);
|
|
8384
8810
|
},
|
|
8385
8811
|
tick() {
|
|
8386
8812
|
if (!IS_TOP || STATE.retired || STATE.isCinema || STATE.pendingCinema || document.hidden) return;
|
|
@@ -10348,9 +10774,9 @@
|
|
|
10348
10774
|
e.spinnerLabel.textContent = roomWait
|
|
10349
10775
|
? (room.sourceDeviceId === STATE.userId ? t('ccWaitSelf') : t('ccWaitPeer', { name: participantName(room.sourceDeviceId) }))
|
|
10350
10776
|
: '';
|
|
10351
|
-
const peers = STATE.handshakeVerified ?
|
|
10777
|
+
const peers = STATE.handshakeVerified ? Object.keys(STATE.presenceMap || {}).length : 0;
|
|
10352
10778
|
e.room.classList.toggle('show', peers > 0);
|
|
10353
|
-
if (peers) e.room
|
|
10779
|
+
if (peers) renderRoster(e.room, 4);
|
|
10354
10780
|
|
|
10355
10781
|
e.seek.style.visibility = duration ? '' : 'hidden';
|
|
10356
10782
|
if (!this._scrubbing) {
|
|
@@ -10643,7 +11069,7 @@
|
|
|
10643
11069
|
if (!inUse && this.isClipLike(v)) return false;
|
|
10644
11070
|
if (v === STATE.video && v.readyState >= 1) return true;
|
|
10645
11071
|
const dur = v.duration;
|
|
10646
|
-
if (Number.isFinite(dur) && dur > 0 && dur < 8) return false;
|
|
11072
|
+
if (Number.isFinite(dur) && dur > 0 && dur < 8 && !this.isLive(v)) return false;
|
|
10647
11073
|
if (+style.opacity === 0) return false;
|
|
10648
11074
|
const rect = v.getBoundingClientRect();
|
|
10649
11075
|
// Parked off-page (preloaded ads, hidden players): left of / above the document.
|
|
@@ -10658,12 +11084,22 @@
|
|
|
10658
11084
|
// video (gifv, ์์งค, hero backgrounds) or a short muted autoplay clip without controls
|
|
10659
11085
|
// (feed previews, many video ads). Unmuting or adding controls makes it media again
|
|
10660
11086
|
// (volumechange triggers a rescan).
|
|
11087
|
+
// A live stream: endless, or a moving window (HLS players report the window's few
|
|
11088
|
+
// seconds as the "duration", and the playable range no longer starts at 0).
|
|
11089
|
+
isLive(v) {
|
|
11090
|
+
try {
|
|
11091
|
+
if (!v) return false;
|
|
11092
|
+
if (v.duration === Infinity || v._nxuLive) return true;
|
|
11093
|
+
const s = v.seekable;
|
|
11094
|
+
return !!(s && s.length && s.start(0) > 0.5 && !v.loop);
|
|
11095
|
+
} catch (_) { return false; }
|
|
11096
|
+
},
|
|
10661
11097
|
isClipLike(v) {
|
|
10662
11098
|
const silent = v.muted || v.volume === 0;
|
|
10663
11099
|
if (!silent || v.controls || v.hasAttribute('data-nxu-user-played')) return false;
|
|
10664
11100
|
if (v.loop) return true;
|
|
10665
11101
|
const dur = v.duration;
|
|
10666
|
-
if (
|
|
11102
|
+
if (this.isLive(v)) return false; // live stream (a TV channel)
|
|
10667
11103
|
// Silent short clips without controls (previews, ads, animated clips) โ unless the
|
|
10668
11104
|
// user started them; long silent videos (muted players) still count.
|
|
10669
11105
|
return Number.isNaN(dur) || (dur > 0 && dur < 60);
|
|
@@ -10733,7 +11169,23 @@
|
|
|
10733
11169
|
return score;
|
|
10734
11170
|
},
|
|
10735
11171
|
|
|
11172
|
+
// HLS live players start the stream at 0 and grow the "duration" as segments arrive:
|
|
11173
|
+
// a duration that keeps growing while it plays marks a live channel.
|
|
11174
|
+
_watchLive(v) {
|
|
11175
|
+
if (v._nxuLiveWatch) return;
|
|
11176
|
+
v._nxuLiveWatch = true;
|
|
11177
|
+
let last = v.duration;
|
|
11178
|
+
v.addEventListener('durationchange', () => {
|
|
11179
|
+
const d = v.duration;
|
|
11180
|
+
if (Number.isFinite(d) && Number.isFinite(last) && d > last + 0.5 && d - last < 120 && !v._nxuLive) {
|
|
11181
|
+
v._nxuLive = true;
|
|
11182
|
+
this.scheduleScan(30);
|
|
11183
|
+
}
|
|
11184
|
+
last = d;
|
|
11185
|
+
});
|
|
11186
|
+
},
|
|
10736
11187
|
_videoInfo(v) {
|
|
11188
|
+
this._watchLive(v);
|
|
10737
11189
|
const playing = !!(v.isConnected && !v.paused && !v.ended && v.readyState >= 2);
|
|
10738
11190
|
let score = this._scoreRect(rectInTop(v), playing);
|
|
10739
11191
|
if (!v.ended) score += 500;
|
|
@@ -10885,11 +11337,11 @@
|
|
|
10885
11337
|
msg = {
|
|
10886
11338
|
type: 'NXU_VIDEO_FOUND', videoW: v.videoWidth || 0, videoH: v.videoHeight || 0,
|
|
10887
11339
|
duration: Number.isFinite(v.duration) ? v.duration : null, paused: !!v.paused,
|
|
10888
|
-
playing: !v.paused && !v.ended && v.readyState >= 2
|
|
11340
|
+
playing: !v.paused && !v.ended && v.readyState >= 2, live: this.isLive(v)
|
|
10889
11341
|
};
|
|
10890
11342
|
} else if (STATE.cinemaIframe) {
|
|
10891
11343
|
const rep = this.frameReports.get(STATE.cinemaIframe) || {};
|
|
10892
|
-
msg = { type: 'NXU_VIDEO_FOUND', videoW: rep.w || 0, videoH: rep.h || 0, duration: Number.isFinite(rep.duration) ? rep.duration : null, paused: rep.paused !== false, playing: !!rep.playing };
|
|
11344
|
+
msg = { type: 'NXU_VIDEO_FOUND', videoW: rep.w || 0, videoH: rep.h || 0, duration: Number.isFinite(rep.duration) ? rep.duration : null, paused: rep.paused !== false, playing: !!rep.playing, live: !!rep.live };
|
|
10893
11345
|
}
|
|
10894
11346
|
if (msg) {
|
|
10895
11347
|
const sig = JSON.stringify(msg);
|
|
@@ -10927,7 +11379,7 @@
|
|
|
10927
11379
|
FRAME.postToParent({
|
|
10928
11380
|
type: 'NXU_VIDEO_EVENT', event: evt,
|
|
10929
11381
|
currentTime: video.currentTime, paused: video.paused, playbackRate: RATE.base(video),
|
|
10930
|
-
duration: Number.isFinite(video.duration) ? video.duration : null,
|
|
11382
|
+
duration: Number.isFinite(video.duration) ? video.duration : null, live: this.isLive(video),
|
|
10931
11383
|
volume: video.volume, muted: video.muted, buffered: bufferedEnd(video),
|
|
10932
11384
|
remoteEventId: Date.now() < (video._nxuRemoteUntil || 0) && String(video._nxuRemoteKinds || '').split(' ').includes(evt) ? video._nxuRemoteEventId : null,
|
|
10933
11385
|
userGesture
|
|
@@ -11013,7 +11465,7 @@
|
|
|
11013
11465
|
case 'NXU_VIDEO_FOUND':
|
|
11014
11466
|
this._watchFrameBox(ifr);
|
|
11015
11467
|
this.frameReports.set(ifr, {
|
|
11016
|
-
w: data.videoW, h: data.videoH, duration: data.duration, paused: data.paused !== false,
|
|
11468
|
+
w: data.videoW, h: data.videoH, duration: data.duration, live: !!data.live, paused: data.paused !== false,
|
|
11017
11469
|
playing: !!data.playing, currentTime: this.frameReports.get(ifr)?.currentTime || 0, ts: Date.now()
|
|
11018
11470
|
});
|
|
11019
11471
|
if (isTarget && !IS_TOP) this._reportUp();
|
|
@@ -11039,6 +11491,7 @@
|
|
|
11039
11491
|
rep.playing = !data.paused && !rep.waiting;
|
|
11040
11492
|
rep.currentTime = data.currentTime;
|
|
11041
11493
|
if (Number.isFinite(data.duration)) rep.duration = data.duration;
|
|
11494
|
+
if (typeof data.live === 'boolean') rep.live = data.live;
|
|
11042
11495
|
rep.ts = Date.now();
|
|
11043
11496
|
this.frameReports.set(ifr, rep);
|
|
11044
11497
|
// A frame we are not using yet started playing: it may be the real player.
|
|
@@ -11275,8 +11728,10 @@
|
|
|
11275
11728
|
});
|
|
11276
11729
|
|
|
11277
11730
|
// Genuine user gestures distinguish user playback from site auto-resume.
|
|
11731
|
+
// On window (capture): the earliest listener, so a page that stops the event in its own
|
|
11732
|
+
// handler (many players do for Space) cannot hide the gesture.
|
|
11278
11733
|
['pointerdown', 'mousedown', 'touchstart', 'keydown'].forEach(type => {
|
|
11279
|
-
|
|
11734
|
+
window.addEventListener(type, (e) => { if (!MEDIA_SAFE._simulatingKey && e.isTrusted !== false) STATE._lastUserGestureTs = Date.now(); }, { capture: true, passive: true });
|
|
11280
11735
|
});
|
|
11281
11736
|
// What the user clicked/tapped (a scroll never produces a click): tells a video the user
|
|
11282
11737
|
// started apart from autoplay previews that start while scrolling a feed.
|
|
@@ -11307,6 +11762,36 @@
|
|
|
11307
11762
|
}
|
|
11308
11763
|
};
|
|
11309
11764
|
|
|
11765
|
+
// Space bar = play / pause for the room's video, wherever the keyboard focus is.
|
|
11766
|
+
// Often the page itself cannot do it: the player sits in another site's frame (keys go
|
|
11767
|
+
// to the top page), or the focus stayed on a NexusSync button (Space would press that
|
|
11768
|
+
// button). The page gets the first chance; if the video did not change, we toggle it.
|
|
11769
|
+
const SPACE_KEY = {
|
|
11770
|
+
handle(e, target) {
|
|
11771
|
+
if (e.code !== 'Space' || e.ctrlKey || e.metaKey || e.altKey || e.shiftKey) return false;
|
|
11772
|
+
const info = currentMediaInfo();
|
|
11773
|
+
if (!info) return false;
|
|
11774
|
+
const host = shadow?.host;
|
|
11775
|
+
const inUi = !!host && (typeof e.composedPath === 'function' ? e.composedPath().includes(host) : false);
|
|
11776
|
+
// A frame player cannot hear the key, and a focused NexusSync button must not be pressed.
|
|
11777
|
+
if (inUi || info.kind === 'iframe') {
|
|
11778
|
+
e.preventDefault();
|
|
11779
|
+
e.stopPropagation();
|
|
11780
|
+
if (!e.repeat) { applyMediaCommand('toggle'); STATE._ownControlAt = Date.now(); }
|
|
11781
|
+
try { if (inUi && target && typeof target.blur === 'function' && target.tagName === 'BUTTON') target.blur(); } catch (_) { }
|
|
11782
|
+
return true;
|
|
11783
|
+
}
|
|
11784
|
+
if (e.repeat || STATE.role === 'IDLE') return false;
|
|
11785
|
+
const before = info.paused, el = info.el;
|
|
11786
|
+
clearTimeout(this._timer);
|
|
11787
|
+
this._timer = setTimeout(() => {
|
|
11788
|
+
const now = currentMediaInfo();
|
|
11789
|
+
if (now && now.el === el && now.paused === before) applyMediaCommand('toggle');
|
|
11790
|
+
}, 320);
|
|
11791
|
+
return false;
|
|
11792
|
+
}
|
|
11793
|
+
};
|
|
11794
|
+
|
|
11310
11795
|
document.addEventListener('keydown', (e) => {
|
|
11311
11796
|
// Our own simulated key (player fallback) and page-generated keys are not shortcuts.
|
|
11312
11797
|
if (STATE.retired || MEDIA_SAFE._simulatingKey || !e.isTrusted) return;
|
|
@@ -11324,6 +11809,7 @@
|
|
|
11324
11809
|
}
|
|
11325
11810
|
if (isEditableTarget(target) && !(isPlayerSlider(target) && STATE.isCinema)) return;
|
|
11326
11811
|
if (STATE.isCinema && (IS_TOP || STATE.video) && CINEMA_UI.handleKey(e)) return;
|
|
11812
|
+
if (IS_TOP && SPACE_KEY.handle(e, target)) return;
|
|
11327
11813
|
if (e.altKey && e.shiftKey && !e.ctrlKey && !e.metaKey && HOTKEYS.map[e.code]) {
|
|
11328
11814
|
e.preventDefault();
|
|
11329
11815
|
e.stopPropagation();
|
package/package.json
CHANGED