@kangsicj/nexussync 1.6.18 → 1.6.19

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.18
11
+ // @version 1.6.19
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.18
11
+ // @version 1.6.19
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.18';
49
+ const NXU_VERSION = '1.6.19';
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.18';
54
+ const NXU_RANK = '11.6.19';
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=';
@@ -766,7 +766,7 @@ async function handle(m) {
766
766
  tuneSrcSame: '🟢 Same video on every device — kept in step automatically, frame by frame.', tuneSrcDiff: '🟠 Different versions (length differs by {s}) — the timing is found automatically after a little playing, or set it here.', tuneSrcUnknown: 'Waiting for the others’ video…', tuneSrcShifted: '🟠 Same length, but the scenes differ — the timing is lined up automatically while you play, or set it here.', tuneDiffPicture: 'Same time, but the pictures differ', tuneShiftFound: 'Same length but different scenes: timing set to {s} automatically (tap to undo).',
767
767
  tuneSameReset: '⏱ Same video as the others: timing correction removed.', tuneAutoApplied: 'Different version: timing set to {s} automatically (tap to undo).', tuneSuggest: 'Your videos differ by {s}. Tap to line them up.',
768
768
  subMenu: 'Subtitles', xsubOff: 'Off', subTrack: 'From the video', subSearch: '🔎 Find subtitles (OpenSubtitles)', subFile: '📂 Open a subtitle file…', subAi: '🧠 AI live subtitles', subDelay: 'Timing', subLater: 'later', subEarlier: 'earlier', xsubSize: 'Size',
769
- subLoaded: '💬 Subtitles: {name}', subMulti: 'Several subtitles at once — each dot is the colour of its lines on screen; tap one to take it away.', subNone: 'No subtitles found in this video.', subMoreLangs: '🌐 {n} more languages', subRestored: '💬 Subtitles picked again: {name}', resumeFrom: 'Continue from {time}', rateRestored: '⏩ {rate}x — the speed you last used on this site (pick 1x to forget it)', setResume: 'Offer to continue where I stopped', subSiteOnly: 'This site loads that subtitle only from its own menu — switch to the site controls (top right) and pick it there.', subSuggest: '💬 No subtitles? Find them', subLoadFail: 'Could not load these subtitles.',
769
+ subLoaded: '💬 Subtitles: {name}', subMulti: 'Several subtitles at once — each dot is the colour of its lines on screen; tap one to take it away.', subNone: 'No subtitles found in this video.', subMoreLangs: '🌐 {n} more languages', subRestored: '💬 Subtitles picked again: {name}', resumeFrom: 'Continue from {time}', rateRestored: '⏩ {rate}x — the speed you last used on this site (pick 1x to forget it)', whoPlaying: 'playing', whoLoading: 'loading', whoPaused: 'paused', playCheckText: 'The room is playing but this device is stopped.', playCheckGo: 'Play in sync', setResume: 'Offer to continue where I stopped', subSiteOnly: 'This site loads that subtitle only from its own menu — switch to the site controls (top right) and pick it there.', subSuggest: '💬 No subtitles? Find them', subLoadFail: 'Could not load these subtitles.',
770
770
  osTitle: 'Find subtitles', osTmdbLooking: 'Looking up the English title on TMDB…', osTmdbNone: 'No English title found on TMDB — type it yourself if you know it.', osQuery: 'Title (English titles work best)', osSeason: 'Season', osEpisode: 'Episode', osLang: 'Language', osSearch: 'Search', osSearching: 'Searching…', osNone: 'Nothing found. Try the English title, or remove the year.', osError: 'OpenSubtitles did not answer. Try again in a moment.', osDownloads: '{n} downloads', osLoading: 'Loading…', osHint: 'Subtitles come from OpenSubtitles.org and are shown in NexusSync’s own style; use “Timing” in the subtitle menu if they are early or late.',
771
771
  viewMenu: 'Picture', viewAudio: 'Soundtrack', viewBright: 'Brightness', viewBoost: 'Volume boost', viewReset: 'Reset', boostBlocked: 'This video’s sound cannot be boosted here (it comes from another site).',
772
772
  settings: 'Settings', setProfile: 'Profile', setAvatar: 'Avatar', setStatus: 'Status message', setStatusPh: 'e.g. Popcorn ready 🍿', setReactions: 'My reactions',
@@ -893,7 +893,7 @@ async function handle(m) {
893
893
  tuneSrcSame: '🟢 모두 같은 영상이에요 — 프레임 단위로 자동으로 맞추고 있어요.', tuneSrcDiff: '🟠 서로 다른 버전이에요 (길이 차이 {s}) — 잠시 재생하면 자동으로 맞추고, 여기서 직접 맞출 수도 있어요.', tuneSrcUnknown: '다른 사람의 영상 정보를 기다리는 중…', tuneSrcShifted: '🟠 길이는 같지만 장면이 달라요 — 재생하는 동안 자동으로 맞추고, 여기서 직접 맞출 수도 있어요.', tuneDiffPicture: '시간은 같지만 화면이 달라요', tuneShiftFound: '길이는 같지만 장면이 달라서 타이밍을 {s} 자동 보정했어요 (누르면 되돌리기).',
894
894
  tuneSameReset: '⏱ 상대와 같은 영상이라 타이밍 보정을 해제했어요.', tuneAutoApplied: '다른 버전이라 타이밍을 {s} 자동 보정했어요 (누르면 되돌리기).', tuneSuggest: '서로 영상 길이가 {s} 달라요. 눌러서 맞춰 보세요.',
895
895
  subMenu: '자막', xsubOff: '끄기', subTrack: '영상에 포함된 자막', subSearch: '🔎 자막 찾기 (OpenSubtitles)', subFile: '📂 자막 파일 열기…', subAi: '🧠 AI 실시간 자막', subDelay: '싱크', subLater: '늦게', subEarlier: '빠르게', xsubSize: '크기',
896
- subLoaded: '💬 자막: {name}', subMulti: '자막 여러 개를 함께 보는 중 — 점 색이 화면 자막 색이에요. 누르면 그 자막만 꺼져요.', subNone: '이 영상에는 포함된 자막이 없어요.', subMoreLangs: '🌐 다른 언어 {n}개 더 보기', subRestored: '💬 지난번 자막을 다시 켰어요: {name}', resumeFrom: '{time}부터 이어보기', rateRestored: '⏩ {rate}x — 이 사이트에서 마지막으로 쓴 속도예요 (1x를 고르면 잊어요)', setResume: '보던 곳부터 이어보기 제안', subSiteOnly: '이 사이트는 자기 메뉴에서만 이 자막을 불러와요. 오른쪽 위에서 사이트 컨트롤로 바꾼 뒤 거기서 골라 주세요.', subSuggest: '💬 자막이 없나요? 찾아보기', subLoadFail: '자막을 불러오지 못했어요.',
896
+ subLoaded: '💬 자막: {name}', subMulti: '자막 여러 개를 함께 보는 중 — 점 색이 화면 자막 색이에요. 누르면 그 자막만 꺼져요.', subNone: '이 영상에는 포함된 자막이 없어요.', subMoreLangs: '🌐 다른 언어 {n}개 더 보기', subRestored: '💬 지난번 자막을 다시 켰어요: {name}', resumeFrom: '{time}부터 이어보기', rateRestored: '⏩ {rate}x — 이 사이트에서 마지막으로 쓴 속도예요 (1x를 고르면 잊어요)', whoPlaying: '재생 중', whoLoading: '불러오는 중', whoPaused: '일시정지', playCheckText: '다른 사람은 재생 중인데 이 기기는 멈춰 있어요.', playCheckGo: '함께 재생', setResume: '보던 곳부터 이어보기 제안', subSiteOnly: '이 사이트는 자기 메뉴에서만 이 자막을 불러와요. 오른쪽 위에서 사이트 컨트롤로 바꾼 뒤 거기서 골라 주세요.', subSuggest: '💬 자막이 없나요? 찾아보기', subLoadFail: '자막을 불러오지 못했어요.',
897
897
  osTitle: '자막 찾기', osTmdbLooking: 'TMDB에서 영어 제목을 찾는 중…', osTmdbNone: 'TMDB에서 영어 제목을 찾지 못했어요 — 알고 있다면 직접 입력하세요.', osQuery: '제목 (영어 제목이 가장 잘 찾아져요)', osSeason: '시즌', osEpisode: '회차', osLang: '언어', osSearch: '검색', osSearching: '찾는 중…', osNone: '찾지 못했어요. 영어 제목으로 바꾸거나 연도를 빼 보세요.', osError: 'OpenSubtitles가 응답하지 않아요. 잠시 후 다시 시도하세요.', osDownloads: '다운로드 {n}회', osLoading: '불러오는 중…', osHint: '자막은 OpenSubtitles.org에서 가져와 NexusSync 스타일로 보여 줘요. 빠르거나 늦으면 자막 메뉴의 “싱크”로 맞추세요.',
898
898
  viewMenu: '화면', viewAudio: '오디오 트랙', viewBright: '밝기', viewBoost: '볼륨 부스트', viewReset: '초기화', boostBlocked: '이 영상은 다른 사이트에서 오는 소리라 여기서 키울 수 없어요.',
899
899
  settings: '설정', setProfile: '프로필', setAvatar: '아바타', setStatus: '상태 메시지', setStatusPh: '예: 팝콘 준비 완료 🍿', setReactions: '내 리액션',
@@ -1428,6 +1428,7 @@ async function handle(m) {
1428
1428
  this._stopAmbient();
1429
1429
  this._ambientPaused = false;
1430
1430
  if (!video || !root || !this.ambientEnabled() || (this._ambientBlocked && this._ambientBlockedFor === video)) return;
1431
+ if (this._ambientBlockedFor !== video) this._noStage = false;
1431
1432
  this._ambientBlocked = false; this._ambientBlockedFor = video; this._layerBelow = false;
1432
1433
  try { if (video.mediaKeys || video.webkitKeys) return; } catch (_) { } // DRM video always draws black
1433
1434
  const doc = video.ownerDocument;
@@ -1491,12 +1492,16 @@ async function handle(m) {
1491
1492
  // Phones: the picture is never made smaller for the glow (switching the
1492
1493
  // glow off then looked like "fill screen" had been turned on).
1493
1494
  const phone = Math.min(view.screen?.width || vw, view.screen?.height || vh) < 500;
1494
- if (barX < want && barY < want && !phone) inset = want;
1495
+ if (barX < want && barY < want && !phone && !this._noStage) inset = want;
1495
1496
  }
1496
1497
  visible = fit === 'contain' && (bars || inset > 0 || !ar);
1497
1498
  root.style.setProperty('--nxu-stage-x', inset + 'px');
1498
1499
  root.style.setProperty('--nxu-stage-y', inset + 'px');
1500
+ const was = root.classList.contains('nxu-ambient-stage');
1499
1501
  root.classList.toggle('nxu-ambient-stage', inset > 0);
1502
+ // The box changed (window maximised, video size known…): look again once the
1503
+ // player has laid itself out for it.
1504
+ if (was !== inset > 0 && this._ambient) { clearTimeout(this._stageCheck); this._stageCheck = setTimeout(() => this._guardGlow(), 350); }
1500
1505
  };
1501
1506
  stage();
1502
1507
  draw(true);
@@ -1510,9 +1515,13 @@ async function handle(m) {
1510
1515
  if (rvfc) frameHandle = video.requestVideoFrameCallback(onFrame);
1511
1516
  // Without frame callbacks (older Safari) a timer samples while playing; with them
1512
1517
  // the timer only catches the first frame and seeks while paused.
1518
+ let ticks = 0;
1513
1519
  const timer = setInterval(() => {
1514
1520
  if (!rvfc && !video.paused) draw(false);
1515
1521
  else if (!drawn || video.seeking) draw(true);
1522
+ // Every ~2.5 s: is the picture still drawn above the glow? (Players change their
1523
+ // layout on their own: window size, controls, quality switches.)
1524
+ if (++ticks % Math.max(1, Math.round(2500 / (rvfc ? 400 : gap))) === 0 && !doc.hidden) this._guardGlow();
1516
1525
  }, rvfc ? 400 : gap);
1517
1526
  const onSeek = () => setTimeout(() => draw(true), 50);
1518
1527
  const onMeta = () => { stage(); draw(true); };
@@ -1588,21 +1597,27 @@ async function handle(m) {
1588
1597
  // Is the glow drawn over the picture? Asked of the browser itself (what is on top at the
1589
1598
  // middle of the video), whatever the page's layout does. The glow and the video are
1590
1599
  // made hit-testable for the question only.
1591
- _glowCoversVideo(a) {
1600
+ _glowCoversVideo(a) { return this._glowCheck(a) !== 'ok'; },
1601
+ // 'ok' — the picture is drawn above the glow; 'covered' — the glow is drawn over it;
1602
+ // 'missing' — the picture is not where it should be (collapsed or moved away by the
1603
+ // player when its box was resized for the glow), so only the glow is seen.
1604
+ _glowCheck(a) {
1592
1605
  const doc = a.video.ownerDocument;
1593
1606
  const r = a.video.getBoundingClientRect();
1594
- if (r.width < 40 || r.height < 40 || typeof doc.elementsFromPoint !== 'function') return false;
1607
+ const rr = a.root.getBoundingClientRect();
1608
+ if (rr.width > 80 && rr.height > 80 && (r.width < 40 || r.height < 40 || r.width * r.height < rr.width * rr.height * 0.2)) return 'missing';
1609
+ if (r.width < 40 || r.height < 40 || typeof doc.elementsFromPoint !== 'function') return 'ok';
1595
1610
  const view = doc.defaultView || window;
1596
1611
  const x = Math.min(view.innerWidth - 2, Math.max(1, r.left + r.width / 2)), y = Math.min(view.innerHeight - 2, Math.max(1, r.top + r.height / 2));
1597
1612
  const keepL = a.layer.style.getPropertyValue('pointer-events'), prioL = a.layer.style.getPropertyPriority('pointer-events');
1598
1613
  const keepV = a.video.style.getPropertyValue('pointer-events'), prioV = a.video.style.getPropertyPriority('pointer-events');
1599
- let covers = false;
1614
+ let covers = 'ok';
1600
1615
  try {
1601
1616
  a.layer.style.setProperty('pointer-events', 'auto', 'important');
1602
1617
  a.video.style.setProperty('pointer-events', 'auto', 'important');
1603
1618
  const hits = doc.elementsFromPoint(x, y);
1604
1619
  const li = hits.indexOf(a.layer), vi = hits.indexOf(a.video);
1605
- covers = li !== -1 && vi !== -1 && li < vi;
1620
+ covers = li !== -1 && vi !== -1 && li < vi ? 'covered' : li !== -1 && vi === -1 ? 'missing' : 'ok';
1606
1621
  } catch (_) { }
1607
1622
  if (keepL) a.layer.style.setProperty('pointer-events', keepL, prioL); else a.layer.style.removeProperty('pointer-events');
1608
1623
  if (keepV) a.video.style.setProperty('pointer-events', keepV, prioV); else a.video.style.removeProperty('pointer-events');
@@ -1612,7 +1627,19 @@ async function handle(m) {
1612
1627
  // everything; if the page still draws it over the picture, it is switched off here.
1613
1628
  _guardGlow() {
1614
1629
  const a = this._ambient;
1615
- if (!a || !this._glowCoversVideo(a)) return;
1630
+ if (!a) return;
1631
+ let verdict = this._glowCheck(a);
1632
+ if (verdict === 'ok') return;
1633
+ // The picture was made a little smaller to leave room for the glow ("stage"), and
1634
+ // some players lay themselves out again for the new size (the picture vanished
1635
+ // behind the glow when the window was maximised). Such a player keeps its full size.
1636
+ if (a.root.classList.contains('nxu-ambient-stage') && !this._noStage) {
1637
+ this._noStage = true;
1638
+ a.stage();
1639
+ logDebug('Ambient light: this player does not take a smaller box; the picture keeps its full size.', 'info');
1640
+ verdict = this._glowCheck(a);
1641
+ if (verdict === 'ok') return;
1642
+ }
1616
1643
  if (!this._layerBelow) {
1617
1644
  this._layerBelow = true;
1618
1645
  this._matchLayerZ(a.layer, a.root);
@@ -1629,6 +1656,7 @@ async function handle(m) {
1629
1656
  _stopAmbient() {
1630
1657
  const a = this._ambient;
1631
1658
  this._ambient = null;
1659
+ clearTimeout(this._stageCheck);
1632
1660
  if (!a) return;
1633
1661
  a.stop();
1634
1662
  clearInterval(a.timer);
@@ -4813,6 +4841,7 @@ async function handle(m) {
4813
4841
  }
4814
4842
 
4815
4843
  function _writeVideoStateFields(state) {
4844
+ if (state?.action !== 'heartbeat') STATE._lastLocalActionAt = Date.now();
4816
4845
  yVideo.set('state', _stateForDoc(state));
4817
4846
  // Each device also keeps its latest decision under its own key. Two devices writing the
4818
4847
  // shared 'state' at the same moment are settled by Yjs in a fixed order — on a slow link
@@ -7308,6 +7337,7 @@ async function handle(m) {
7308
7337
  setTimeout(beat, 1500);
7309
7338
  setTimeout(beat, 4000);
7310
7339
  STATE._presenceTimer = setInterval(beat, 8000);
7340
+ PLAY_CHECK.start();
7311
7341
  }
7312
7342
 
7313
7343
  async function disconnectAll(isRemote = false) {
@@ -7340,6 +7370,7 @@ async function handle(m) {
7340
7370
  releaseVideoHooks(STATE.video);
7341
7371
  MEDIA_SESSION.release();
7342
7372
  if (STATE._presenceTimer) { clearInterval(STATE._presenceTimer); STATE._presenceTimer = null; }
7373
+ PLAY_CHECK.stop();
7343
7374
  STATE.presenceMap = {};
7344
7375
  PRESENCE.seen.clear();
7345
7376
  updatePresenceUI();
@@ -7461,7 +7492,9 @@ async function handle(m) {
7461
7492
  muted: !self && SAFETY.muted.has(uid),
7462
7493
  away: !self && (!!p?.hid || !!p?._sleep),
7463
7494
  sleeping: !self && !!p?._sleep,
7464
- oldVer: !self && !!(p?.v && p.v !== NXU_VERSION)
7495
+ oldVer: !self && !!(p?.v && p.v !== NXU_VERSION),
7496
+ // What the picture on that device is doing: 'p' playing, 's' loading, 'z' paused, '' none.
7497
+ pl: self ? PLAY_CHECK.local() : (p?._sleep || p?.hid ? '' : ['p', 's', 'z'].includes(p?.pl) ? p.pl : '')
7465
7498
  };
7466
7499
  });
7467
7500
  list.sort((a, b) => (b.self - a.self) || a.name.localeCompare(b.name));
@@ -7470,7 +7503,7 @@ async function handle(m) {
7470
7503
  function renderRoster(box, max = 4) {
7471
7504
  const list = roomRoster();
7472
7505
  const issue = STATE.handshakeVerified && STATE.connectionMode !== 'WEBRTC_P2P' && typeof relayAlive === 'function' && !relayAlive();
7473
- const sig = max + '|' + issue + '|' + list.map(m => [m.uid, m.name, m.color, m.viewer, m.away, m.sleeping, m.oldVer, m.av, m.img.length, m.st, m.muted].join(',')).join(';');
7506
+ const sig = max + '|' + issue + '|' + list.map(m => [m.uid, m.name, m.color, m.viewer, m.away, m.sleeping, m.oldVer, m.av, m.img.length, m.st, m.muted, m.pl].join(',')).join(';');
7474
7507
  if (box._rosterSig === sig) return list;
7475
7508
  box._rosterSig = sig;
7476
7509
  box.replaceChildren();
@@ -7485,11 +7518,12 @@ async function handle(m) {
7485
7518
  if (m.av && !m.img) chip.append(createEl('span', 'nx-who-av', m.av));
7486
7519
  chip.append(createEl('span', 'nx-who-name', m.name + (m.self && STATE.nickname ? ' ' + t('meTag') : '')));
7487
7520
  if (m.muted) chip.append(createEl('span', 'nx-who-tag', '🔇'));
7521
+ if (m.pl) chip.append(createEl('span', 'nx-who-pl ' + m.pl, m.pl === 'p' ? '▶' : m.pl === 's' ? '⏳' : '⏸'));
7488
7522
  if (m.st && max > 4) chip.append(createEl('span', 'nx-who-st', m.st));
7489
7523
  if (m.viewer) chip.append(createEl('span', 'nx-who-tag', '👀'));
7490
7524
  if (m.away) chip.append(createEl('span', 'nx-who-tag', '💤'));
7491
7525
  if (m.oldVer) chip.append(createEl('span', 'nx-who-tag', '⚠️'));
7492
- chip.title = [m.name, m.st, m.viewer && t('whoViewer'), m.sleeping ? t('whoSleeping') : m.away && t('whoAway'), m.oldVer && t('whoOldVer')].filter(Boolean).join(' · ');
7526
+ chip.title = [m.name, m.st, m.pl === 'p' ? t('whoPlaying') : m.pl === 's' ? t('whoLoading') : m.pl === 'z' ? t('whoPaused') : '', m.viewer && t('whoViewer'), m.sleeping ? t('whoSleeping') : m.away && t('whoAway'), m.oldVer && t('whoOldVer')].filter(Boolean).join(' · ');
7493
7527
  box.appendChild(chip);
7494
7528
  });
7495
7529
  if (list.length > max) box.appendChild(createEl('span', 'nx-who more', '+' + (list.length - max)));
@@ -8278,7 +8312,9 @@ async function handle(m) {
8278
8312
  const adv = section('🔧', t('setAdvanced'));
8279
8313
  const tools = createEl('div', 'nx-btn-row nx-tools');
8280
8314
  tools.append(parts.chatLog, parts.subLog, parts.debug);
8281
- adv.append(tools, parts.idleRow, parts.hideSite, createEl('div', 'trans-help', t('setHideFabHelp')), createEl('div', 'nx-set-ver', 'NexusSync v' + NXU_VERSION));
8315
+ adv.append(tools, parts.idleRow, parts.hideSite, createEl('div', 'trans-help', t('setHideFabHelp')));
8316
+ // The installed version, always visible at the bottom (not inside a folded section).
8317
+ body.appendChild(createEl('div', 'nx-set-ver', 'NexusSync v' + NXU_VERSION));
8282
8318
  return body;
8283
8319
  }
8284
8320
 
@@ -8595,6 +8631,14 @@ async function handle(m) {
8595
8631
  .nx-who-dot { flex:none; width:8px; height:8px; border-radius:50%; box-shadow:0 0 5px currentColor; }
8596
8632
  .nx-who-name { overflow:hidden; text-overflow:ellipsis; }
8597
8633
  .nx-who-tag { font-size:10px; }
8634
+ .nx-who-pl { font-size:9px; line-height:1; opacity:0.85; }
8635
+ .nx-who-pl.p { color:#69f0ae; }
8636
+ .nx-who-pl.z { color:#ffcc80; }
8637
+ .nx-sync-card { position:absolute; left:50%; bottom:calc(96px + env(safe-area-inset-bottom, 0px)); z-index:2066; display:flex; align-items:center; gap:10px; padding:8px 8px 8px 14px; border-radius:14px; max-width:min(92vw, 460px); box-sizing:border-box;
8638
+ background:rgba(16,18,24,0.88); color:#fff; font-size:13px; line-height:1.35; box-shadow:0 10px 28px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.14) inset; opacity:0; transform:translate(-50%, 10px); transition:opacity 0.25s ease, transform 0.25s ease; pointer-events:auto; }
8639
+ .nx-sync-card.in { opacity:1; transform:translate(-50%, 0); }
8640
+ .nx-sync-card button { flex:none; border:none; border-radius:10px; background:#69f0ae; color:#061009; font:800 13px/1 inherit; font-family:inherit; padding:10px 12px; cursor:pointer; }
8641
+ .nx-sync-card .x { background:rgba(255,255,255,0.12); color:#fff; width:28px; height:28px; padding:0; border-radius:50%; font-size:11px; }
8598
8642
  .nx-who-av { font-size:12px; line-height:1; }
8599
8643
  .nx-who-img { width:16px; height:16px; border-radius:50%; object-fit:cover; border:1.5px solid; flex:none; }
8600
8644
  .nx-who-st { font-weight:500; opacity:0.7; margin-left:4px; overflow:hidden; text-overflow:ellipsis; }
@@ -8772,7 +8816,7 @@ async function handle(m) {
8772
8816
  .nx-sw.active .nx-sw-track { background:var(--accent); }
8773
8817
  .nx-sw.active .nx-sw-track::after { transform:translateX(16px); }
8774
8818
  .nx-set-sec > .nx-sw + .nx-sw { margin-top:4px; }
8775
- .nx-set-ver { font-size:10.5px; opacity:0.45; text-align:right; }
8819
+ .nx-set-ver { font-size:10.5px; opacity:0.5; text-align:center; padding:8px 0 2px; letter-spacing:0.02em; user-select:text; }
8776
8820
  .nx-settings { container-type:inline-size; }
8777
8821
  .seg { display:flex; gap:6px; }
8778
8822
  .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; }
@@ -9995,7 +10039,7 @@ async function handle(m) {
9995
10039
  },
9996
10040
  // What this device announces in the room (presence): name, colour, avatar, status.
9997
10041
  value() {
9998
- return { ts: Date.now(), color: STATE.color, viewer: !!STATE.isViewer, nick: STATE.nickname || '', av: this.avatar(), md: TUNE.mediaSig(), v: NXU_VERSION, r: NXU_RANK, sess: NXU_SESSION, hid: !!document.hidden };
10042
+ return { ts: Date.now(), color: STATE.color, viewer: !!STATE.isViewer, nick: STATE.nickname || '', av: this.avatar(), md: TUNE.mediaSig(), v: NXU_VERSION, r: NXU_RANK, sess: NXU_SESSION, hid: !!document.hidden, pl: PLAY_CHECK.local() };
9999
10043
  },
10000
10044
  AVATARS: ['🙂', '😎', '🥳', '🤠', '👻', '👾', '🤖', '🎃', '🦊', '🐱', '🐶', '🐯', '🐵', '🐼', '🐸', '🐰', '🐻', '🐨', '🦁', '🐧', '🦄', '🐙', '🍿', '🎧'],
10001
10045
  avatar() { return safeAvatar(STORE.get('nxu_avatar', '')); },
@@ -11473,6 +11517,69 @@ async function handle(m) {
11473
11517
  } catch (_) { }
11474
11518
  }, 1200);
11475
11519
 
11520
+ // ───────────────────────── Playing for everyone?
11521
+ // Each device tells the room what its picture is actually doing (playing / loading /
11522
+ // paused, in the names row). Once a second this device compares itself with the room:
11523
+ // when the room plays but the picture here stands still (a refused or swallowed play(),
11524
+ // a player that ignored the room), it is put back in step by itself; if the browser
11525
+ // refuses that (it wants a tap), a small card says so and one tap fixes it. The same
11526
+ // when the room is paused but the picture here keeps playing.
11527
+ const PLAY_CHECK = {
11528
+ local() {
11529
+ const v = STATE.video;
11530
+ if (v) return v.paused || v.ended ? 'z' : (v.readyState < 3 || v.seeking) ? 's' : 'p';
11531
+ if (STATE.cinemaIframe) { const rep = VIDEO_DETECTOR.frameReports.get(STATE.cinemaIframe); if (rep) return rep.paused === false ? 'p' : 'z'; }
11532
+ return '';
11533
+ },
11534
+ _since: 0, _kind: '', _tries: 0, _last: '',
11535
+ start() {
11536
+ if (this._timer || !IS_TOP) return;
11537
+ this._timer = setInterval(() => { try { this.tick(); } catch (_) { } }, 1000);
11538
+ },
11539
+ stop() { clearInterval(this._timer); this._timer = null; this._hide(); this._since = 0; this._kind = ''; this._tries = 0; this._last = ''; },
11540
+ tick() {
11541
+ if (!STATE.handshakeVerified) { this.stop(); return; }
11542
+ const me = this.local();
11543
+ // Changes reach the others within a second (not only with the 8 s heartbeat).
11544
+ if (me !== this._last) { this._last = me; PROFILE.publish(); updatePresenceUI(); }
11545
+ const room = _getVideoState();
11546
+ const busy = !room || !me || STATE.isViewer || document.hidden || STATE._scheduledPlay || Date.now() - (STATE._lastLocalActionAt || 0) < 2500;
11547
+ const kind = busy ? '' : room.play && me === 'z' ? 'stopped' : !room.play && me === 'p' ? 'running' : '';
11548
+ if (!kind) { if (this._kind) this._hide(); this._kind = ''; this._since = 0; this._tries = 0; return; }
11549
+ if (kind !== this._kind) { this._kind = kind; this._since = Date.now(); this._tries = 0; return; }
11550
+ const held = Date.now() - this._since;
11551
+ if (held < 2500) return;
11552
+ if (this._tries < 2 && held >= 2500 + this._tries * 3000) {
11553
+ this._tries++;
11554
+ logDebug(`Play check: the room is ${room.play ? 'playing' : 'paused'} but the picture here is ${kind === 'stopped' ? 'paused' : 'playing'}; putting it back in step (${this._tries}).`, 'warn');
11555
+ this.heal(room);
11556
+ return;
11557
+ }
11558
+ if (this._tries >= 2 && kind === 'stopped') this._show();
11559
+ },
11560
+ heal(room = _getVideoState()) {
11561
+ if (!room) return;
11562
+ if (STATE.video) applyRemoteStateToVideo({ ...room, action: 'user' });
11563
+ else if (STATE.cinemaIframe) FRAME.postToFrame(STATE.cinemaIframe, { type: 'NXU_SYNC_CMD', cmd: room.play ? 'play' : 'pause', time: Number.isFinite(room.time) ? room.time + (room.play ? Math.max(0, getSyncedTime() - room.timestamp) / 1000 * (room.rate || 1) : 0) : null, rate: room.rate || 1, eventId: null, action: 'user', startIn: 0 });
11564
+ },
11565
+ _show() {
11566
+ if (this._card?.isConnected) return;
11567
+ const container = getContainer();
11568
+ if (!container) return;
11569
+ const card = createEl('div', 'nx-sync-card');
11570
+ const go = createEl('button', '', '▶ ' + t('playCheckGo'), { type: 'button' });
11571
+ const x = createEl('button', 'x', '✕', { type: 'button', 'aria-label': t('talkClose') });
11572
+ ['pointerdown', 'click', 'touchstart'].forEach(n => card.addEventListener(n, (ev) => ev.stopPropagation()));
11573
+ go.onclick = () => { const v = STATE.video; if (v) { v.play?.().catch(() => { }); } this.heal(); this._hide(); this._tries = 0; this._since = Date.now(); };
11574
+ x.onclick = () => { this._hide(); this._since = Date.now() + 30000; };
11575
+ card.append(createEl('span', '', t('playCheckText')), go, x);
11576
+ container.appendChild(card);
11577
+ this._card = card;
11578
+ requestAnimationFrame(() => card.classList.add('in'));
11579
+ },
11580
+ _hide() { const c = this._card; this._card = null; if (!c) return; c.classList.remove('in'); setTimeout(() => c.remove(), 260); }
11581
+ };
11582
+
11476
11583
  // ───────────────────────── Speed per site
11477
11584
  // The speed you pick in the speed menu is kept per site and used again for the next video
11478
11585
  // there when you watch on your own (in a room the room's speed rules). 1x forgets it.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kangsicj/nexussync",
3
- "version": "1.6.18",
3
+ "version": "1.6.19",
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",