@kangsicj/nexussync 1.6.5 → 1.6.6

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.
@@ -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.6.5
11
+ // @version 1.6.6
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.6.5
11
+ // @version 1.6.6
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 *://*/*
@@ -46,12 +46,12 @@
46
46
 
47
47
  // The version of the code that is actually running (the manager's metadata can lag
48
48
  // behind when an old copy is still installed).
49
- const NXU_VERSION = '1.6.5';
49
+ const NXU_VERSION = '1.6.6';
50
50
  // Rank used by the one-instance guard below and to tell newer builds apart in a room.
51
51
  // It is independent of the public version (1.0.0 is the first public release, after
52
52
  // private builds that reached ranks up to 10.2.0), so every older copy still installed
53
53
  // steps aside instead of this release.
54
- const NXU_RANK = '11.6.5';
54
+ const NXU_RANK = '11.6.6';
55
55
  const NXU_SESSION = Math.random().toString(36).slice(2, 10); // this page load // raise with every release
56
56
  // App icon (same artwork as assets/icon.svg / @icon), inlined so it shows offline too.
57
57
  const NXU_ICON = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNTYgMjU2IiByb2xlPSJpbWciIGFyaWEtbGFiZWw9Ik5leHVzU3luYyI+PGRlZnM+PGxpbmVhckdyYWRpZW50IGlkPSJueGJnIiB4MT0iMCIgeTE9IjAiIHgyPSIxIiB5Mj0iMSI+PHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSIjNWIyZWZmIi8+PHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjZmY0ZmEzIi8+PC9saW5lYXJHcmFkaWVudD48cmFkaWFsR3JhZGllbnQgaWQ9Im54Z2xvdyIgY3g9IjAuODIiIGN5PSIwLjE0IiByPSIwLjciPjxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iIzdjZjlmZiIgc3RvcC1vcGFjaXR5PSIwLjU1Ii8+PHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjN2NmOWZmIiBzdG9wLW9wYWNpdHk9IjAiLz48L3JhZGlhbEdyYWRpZW50PjxsaW5lYXJHcmFkaWVudCBpZD0ibnhwbGF5IiB4MT0iMCIgeTE9IjAiIHgyPSIxIiB5Mj0iMSI+PHN0b3Agb2Zmc2V0PSIwIiBzdG9wLWNvbG9yPSIjZmZmZmZmIi8+PHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjZmZlM2YxIi8+PC9saW5lYXJHcmFkaWVudD48Y2xpcFBhdGggaWQ9Im54ciI+PHJlY3Qgd2lkdGg9IjI1NiIgaGVpZ2h0PSIyNTYiIHJ4PSI1OCIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNueHIpIj48cmVjdCB3aWR0aD0iMjU2IiBoZWlnaHQ9IjI1NiIgZmlsbD0idXJsKCNueGJnKSIvPjxyZWN0IHdpZHRoPSIyNTYiIGhlaWdodD0iMjU2IiBmaWxsPSJ1cmwoI254Z2xvdykiLz48ZyBmaWxsPSJub25lIiBzdHJva2U9IiNmZmZmZmYiIHN0cm9rZS13aWR0aD0iMTUiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCI+PHBhdGggZD0iTTYwIDExNiBBNzAgNzAgMCAwIDEgMTc4IDcyIi8+PHBhdGggZD0iTTE5NiAxNDAgQTcwIDcwIDAgMCAxIDc4IDE4NCIvPjwvZz48cGF0aCBkPSJNMTg2IDUwIEwyMDAgOTIgTDE1NyA4NiBaIiBmaWxsPSIjZmZmZmZmIi8+PHBhdGggZD0iTTcwIDIwNiBMNTYgMTY0IEw5OSAxNzAgWiIgZmlsbD0iI2ZmZmZmZiIvPjxwYXRoIGQ9Ik0xMTAgOTIgUTEwNCA4OCAxMDQgOTYgTDEwNCAxNjAgUTEwNCAxNjggMTEwIDE2NCBMMTYyIDEzMiBRMTY4IDEyOCAxNjIgMTI0IFoiIGZpbGw9InVybCgjbnhwbGF5KSIvPjwvZz48L3N2Zz4=';
@@ -714,6 +714,7 @@
714
714
  subUsingMicFallback: 'The video sound could not be heard directly — listening through the microphone (turn the speakers up).',
715
715
  subTabShareEnded: 'Tab audio sharing stopped, so subtitles were turned off.',
716
716
  subHearVideo: '🎧 Listening to the video', subHearMic: '🎧 Listening through the microphone', subVideoSilent: '🔇 No sound reaches the subtitles from this video',
717
+ subNoWords: '⚠️ The speech engine hears sound but returns no words here. Add a free Groq key in AI Sub → Advanced to use AI recognition instead.', subNoWordsEdge: '⚠️ Edge’s speech engine hears the video but returns no words. Use Chrome, or add a free Groq key in AI Sub → Advanced (works in Edge).', subNoWordsKey: '⚠️ The browser’s speech engine returns no words here — switching to AI recognition with your key.',
717
718
  subDiagCopy: 'Copy a problem report', subDiagCopied: '🔬 Report copied — paste it in your message', subDiagInDebug: '🔬 Report written to the debug console (Settings → Advanced → Debug)',
718
719
  subNoTrackInput: '⚠️ This browser’s speech engine cannot listen to the video sound directly — it only hears the microphone (play the sound through speakers, not headphones), or add a free Groq key in AI Sub → Advanced.', subIssueNoTrack: 'The speech engine only hears the microphone here', subNoService: '⚠️ This browser has no working speech recognition service (it works in Chrome). Add a free Groq or an OpenAI key in AI Sub → Advanced to use AI recognition instead.', subNoServiceKey: '⚠️ This browser has no working speech recognition service — switching to AI recognition with your key.',
719
720
  subIssueNet: '⚠️ Speech service connection is unstable — retrying', subIssueNoResult: '⚠️ Sound arrives but no words are recognised', subSiteBlocksSpeech: 'This site does not allow the browser’s speech recognition. Add an OpenAI or Groq key (AI subtitles → Advanced) to use AI subtitles here.', subSiteBlocksSpeechKey: 'This site blocks the browser’s speech recognition — switching to cloud recognition with your key.', subTryMic: '🎤 Listen through the mic', subTryKey: '🔑 Use an AI recognition key', subShareTab: '🎬 Connect tab sound', subTabNotShared: 'Tab audio was not shared. Choose this tab and turn on “Share tab audio”.',
@@ -832,6 +833,7 @@
832
833
  subUsingMicFallback: '영상 소리를 직접 들을 수 없어 마이크로 들어요. 스피커 소리를 키워 주세요.',
833
834
  subTabShareEnded: '탭 오디오 공유가 끝나서 자막을 껐어요.',
834
835
  subHearVideo: '🎧 영상 소리 듣는 중', subHearMic: '🎧 마이크로 듣는 중', subVideoSilent: '🔇 이 영상의 소리가 자막에 전달되지 않아요',
836
+ subNoWords: '⚠️ 음성 인식이 소리는 듣지만 말을 알아듣지 못하고 있어요. AI 자막 → 고급에서 무료 Groq 키를 넣으면 AI 인식으로 쓸 수 있어요.', subNoWordsEdge: '⚠️ Edge의 음성 인식이 영상 소리를 받지만 말을 알아듣지 못하고 있어요. Chrome을 쓰거나, AI 자막 → 고급에서 무료 Groq 키를 넣어 주세요 (Edge에서도 동작해요).', subNoWordsKey: '⚠️ 브라우저 음성 인식이 말을 알아듣지 못해 입력한 키로 AI 인식을 시작해요.',
835
837
  subDiagCopy: '문제 진단 보고서 복사', subDiagCopied: '🔬 진단 보고서를 복사했어요 — 메시지에 붙여 넣어 주세요', subDiagInDebug: '🔬 진단 보고서를 디버그 콘솔에 남겼어요 (설정 → 고급 → 디버그)',
836
838
  subNoTrackInput: '⚠️ 이 브라우저의 음성 인식은 영상 소리를 직접 듣지 못하고 마이크로만 들어요. 이어폰 대신 스피커로 소리를 내거나, AI 자막 → 고급에서 무료 Groq 키를 넣어 주세요.', subIssueNoTrack: '이 브라우저는 마이크로만 들을 수 있어요', subNoService: '⚠️ 이 브라우저에는 동작하는 음성 인식 서비스가 없어요 (Chrome에서는 동작해요). AI 자막 → 고급에서 무료 Groq 키나 OpenAI 키를 넣으면 AI 인식으로 쓸 수 있어요.', subNoServiceKey: '⚠️ 이 브라우저에는 동작하는 음성 인식 서비스가 없어 입력한 키로 AI 인식을 시작해요.',
837
839
  subIssueNet: '⚠️ 음성 인식 서버 연결이 불안정해요 — 다시 시도 중', subIssueNoResult: '⚠️ 소리는 들어오는데 말이 인식되지 않아요', subSiteBlocksSpeech: '이 사이트는 브라우저 음성 인식을 막아 두었어요. AI 자막 → 고급에서 OpenAI 또는 Groq 키를 넣으면 여기서도 쓸 수 있어요.', subSiteBlocksSpeechKey: '이 사이트는 브라우저 음성 인식을 막아 두어서, 넣어 둔 키로 클라우드 인식으로 바꿀게요.', subTryMic: '🎤 마이크로 듣기', subTryKey: '🔑 AI 인식 키 사용', subShareTab: '🎬 탭 소리 연결', subTabNotShared: '탭 오디오가 공유되지 않았어요. 이 탭을 고르고 “탭 오디오 공유”를 켜 주세요.',
@@ -2797,8 +2799,14 @@
2797
2799
  const mixGain = ctx.createGain();
2798
2800
  mixGain.gain.value = micForMix && web ? 0.75 : 1;
2799
2801
  const dest = ctx.createMediaStreamDestination();
2800
- mixGain.connect(dest);
2801
- const nodes = { list: [mixGain], analysers: {}, mix: mixGain };
2802
+ // The copy the engine may listen to: quiet speech (a low player volume, a
2803
+ // shared tab) is evened out and raised, loud effects are held back.
2804
+ const comp = ctx.createDynamicsCompressor();
2805
+ try { comp.threshold.value = -42; comp.knee.value = 18; comp.ratio.value = 6; comp.attack.value = 0.005; comp.release.value = 0.25; } catch (_) { }
2806
+ const makeup = ctx.createGain();
2807
+ makeup.gain.value = 3;
2808
+ mixGain.connect(comp); comp.connect(makeup); makeup.connect(dest);
2809
+ const nodes = { list: [mixGain, comp, makeup], analysers: {}, mix: mixGain };
2802
2810
  const connect = (stream, label) => {
2803
2811
  if (!stream) return;
2804
2812
  const source = ctx.createMediaStreamSource(stream);
@@ -3056,7 +3064,19 @@
3056
3064
  // Plenty of sound but not a single word back: try the other ways of feeding the
3057
3065
  // engine on its own first, then say so, with a one-tap way out.
3058
3066
  if (this._useWebSpeech && !this._cloud && this._rescueNoWords()) { updateAIBtnUX(); return; }
3059
- if (this._useWebSpeech && !this._issue && this._soundMs > 15000 && (this._lastResultAt || 0) < (this._startedAt || 0) && (this._cloud || this._rescueStage >= 3)) this._issue = 'noresult';
3067
+ if (this._useWebSpeech && !this._issue && (this._soundMs > 15000 || (this._diag.empty || 0) >= 10) && (this._lastResultAt || 0) < (this._startedAt || 0) && (this._cloud || this._rescueStage >= 3)) {
3068
+ this._issue = 'noresult';
3069
+ if (!this._cloud && !this._toldNoWords) {
3070
+ this._toldNoWords = true;
3071
+ const key = AI.key('groq') || AI.key('openai');
3072
+ logDebug('AI Sub: the speech engine returns no words here (' + (this._diag.empty || 0) + ' empty results).', 'error');
3073
+ if (key && STORE.get('nxu_asr_provider', 'browser') === 'browser') {
3074
+ showToast(t('subNoWordsKey'));
3075
+ STORE.set('nxu_asr_provider', AI.key('groq') ? 'groq' : 'openai');
3076
+ this.restart('no words from the browser engine');
3077
+ } else showToast(t(/\bEdg\//.test(navigator.userAgent) ? 'subNoWordsEdge' : 'subNoWords'));
3078
+ }
3079
+ }
3060
3080
  this._updateListenChip();
3061
3081
  updateAIBtnUX();
3062
3082
  },
@@ -3066,8 +3086,11 @@
3066
3086
  // the on-device model → the Web Audio copy of the sound → the engine's own microphone.
3067
3087
  _rescueNoWords() {
3068
3088
  if (this.captureMode === 'ios-mic' || (this._lastResultAt || 0) >= (this._stageAt || 0)) return false;
3069
- if ((this._stageSoundMs || 0) < 10000 || Date.now() - (this._stageAt || 0) < 8000) return false;
3070
- const next = () => { this._rescueStage++; this._stageAt = Date.now(); this._stageSoundMs = 0; };
3089
+ // Evidence of "hears but no words": ten seconds of speech-level sound, or a run of
3090
+ // empty results from the engine itself (it is hearing something, but no words).
3091
+ const emptyRun = (this._diag.empty || 0) - (this._stageEmpty || 0);
3092
+ if (((this._stageSoundMs || 0) < 10000 && emptyRun < 6) || Date.now() - (this._stageAt || 0) < 8000) return false;
3093
+ const next = () => { this._rescueStage++; this._stageAt = Date.now(); this._stageSoundMs = 0; this._stageEmpty = this._diag.empty || 0; };
3071
3094
  const rebuild = (why) => { this._commitInterim('rescue', 0); this._resetSegment(); this._destroyRecognizer(); this._createRecognizer(); this._scheduleRestart(why, 150, true); };
3072
3095
  if (this._rescueStage === 0) {
3073
3096
  next();
@@ -3213,6 +3236,18 @@
3213
3236
  },
3214
3237
  _onResult(event) {
3215
3238
  this._touch();
3239
+ // Some engines (seen with Edge listening to a captured track) send result events
3240
+ // that carry no words at all. Those are not a sign of success: counting them as
3241
+ // results kept every rescue step and every warning from ever starting.
3242
+ let anyWords = false;
3243
+ try {
3244
+ for (let i = event.resultIndex || 0; i < event.results.length; i++) {
3245
+ const tx = event.results[i]?.[0]?.transcript;
3246
+ if (tx && String(tx).trim()) { anyWords = true; this._diag.lastText = String(tx).trim().slice(-60); break; }
3247
+ }
3248
+ } catch (_) { }
3249
+ if (!anyWords) { this._diag.empty = (this._diag.empty || 0) + 1; return; }
3250
+ this._diag.words = (this._diag.words || 0) + 1;
3216
3251
  this._lastResultAt = Date.now();
3217
3252
  this._networkErrors = 0;
3218
3253
  this._networkRetryMs = 0;
@@ -3959,6 +3994,7 @@
3959
3994
  this._rescueStage = 0;
3960
3995
  this._stageAt = Date.now();
3961
3996
  this._stageSoundMs = 0;
3997
+ this._stageEmpty = 0;
3962
3998
  this._waitOnline = false;
3963
3999
  this._googleBackoffUntil = 0;
3964
4000
  this._providerStatus = '';
@@ -4021,6 +4057,7 @@
4021
4057
  this.state = 'running';
4022
4058
  this._diag = { sound: 0, results: 0, err: '' };
4023
4059
  this._toldNoTrack = false;
4060
+ this._toldNoWords = false;
4024
4061
  this._startedAt = Date.now();
4025
4062
  this._soundMs = 0;
4026
4063
  this._stageAt = Date.now();
@@ -4054,9 +4091,9 @@
4054
4091
  'microphone blocked by site: ' + (this._micBlockedByPolicy() ? 'YES' : 'no') + ' · permission: ' + (await this._micPermissionState()),
4055
4092
  'recognition: ' + (this._cloud ? 'cloud ' + AI.asrModel() : (this._useWebSpeech ? this._sttProvider || 'web-speech' : '-')) + ' · state: ' + this.state,
4056
4093
  'wanted sound: ' + (this.audioMode || this._audioMode()) + ' · capturing: ' + (this.captureMode || '-') + ' · engine input: ' + (this._recognitionInput || '-') + (this._trackDisabled ? ' (track refused)' : '') + (this._micMixed ? ' · mic mixed in' : '') + (this._useMixTrack ? ' · web-audio track' : '') + ' · rescue step ' + (this._rescueStage || 0),
4057
- 'video: ' + (v ? (v.paused ? 'paused' : 'playing') + (v.muted ? ', muted' : '') + ', volume ' + Math.round((v.volume || 0) * 100) + '%' : 'none') + ' · video sound peak: ' + (this._mediaPeak || 0).toFixed(4),
4094
+ 'video: ' + (v ? (v.paused ? 'paused' : 'playing') + (v.muted ? ', muted' : '') + ', volume ' + Math.round((v.volume || 0) * 100) + '%' : (STATE.cinemaIframe || STATE.frameMedia ? 'in a frame' : 'none')) + ' · sound from: ' + (this._sharedTab && this.webMediaStream === this._sharedTab ? 'shared tab' : this._webFromElement ? 'video element' : this.captureMode) + ' · video sound peak: ' + (this._mediaPeak || 0).toFixed(4),
4058
4095
  'levels: video ' + Math.round((this._levels?.media || 0) * 400) + ' · mic ' + Math.round((this._levels?.mic || 0) * 400),
4059
- 'engine events: sound ' + this._diag.sound + ' · results ' + this._diag.results + ' · last error ' + (this._diag.err || '-') + ' · network errors ' + (this._networkErrors || 0),
4096
+ 'engine events: sound ' + this._diag.sound + ' · results ' + this._diag.results + ' (with words ' + (this._diag.words || 0) + ', empty ' + (this._diag.empty || 0) + ')' + (this._diag.lastText ? ' · last heard "' + this._diag.lastText + '"' : '') + ' · last error ' + (this._diag.err || '-') + ' · network errors ' + (this._networkErrors || 0),
4060
4097
  'issue: ' + (this._issue || '-')
4061
4098
  ];
4062
4099
  return lines.join('\n');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kangsicj/nexussync",
3
- "version": "1.6.5",
3
+ "version": "1.6.6",
4
4
  "description": "Watch-together userscript: media sync, cinema mode, live AI subtitles, chat bubbles and quick ink for Violentmonkey, Tampermonkey and iOS Userscripts.",
5
5
  "keywords": [
6
6
  "userscript",