@kangsicj/nexussync 1.6.18 → 1.6.20
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/dist/NexusSync.meta.js +1 -1
- package/dist/NexusSync.user.js +168 -27
- package/package.json +1 -1
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.6.
|
|
11
|
+
// @version 1.6.20
|
|
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.6.
|
|
11
|
+
// @version 1.6.20
|
|
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.
|
|
49
|
+
const NXU_VERSION = '1.6.20';
|
|
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.
|
|
54
|
+
const NXU_RANK = '11.6.20';
|
|
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=';
|
|
@@ -716,7 +716,7 @@ async function handle(m) {
|
|
|
716
716
|
ccFit: 'Fit / fill screen (Z)', ccFitCover: 'Fill screen', ccFitContain: 'Original ratio', ccSpeed: 'Playback speed', ccNormal: 'Normal', ccLive: 'LIVE',
|
|
717
717
|
ccTimeToggle: 'Show elapsed / remaining time', ccSeconds: '{n}s', ccWatching: '{n} watching together', ccWaitPeer: 'Waiting for {name}…', ccWaitSelf: 'Loading — the room is waiting',
|
|
718
718
|
ccHelp: 'Keyboard shortcuts (?)', ccKeyPlay: 'Play / pause', ccKeySeek5: 'Back / forward 5s (Shift: 10s)', ccKeySeek10: 'Back / forward 10s', ccKeyVolume: 'Volume',
|
|
719
|
-
ccKeyPercent: 'Jump to 0%–90%', ccKeySpeed: 'Slower / faster', ccKeyMute: 'Mute', ccKeySubs: 'AI subtitles', ccKeyFull: 'Fullscreen', ccKeyFit: 'Fit / fill screen',
|
|
719
|
+
ccKeyPercent: 'Jump to 0%–90%', ccKeySpeed: 'Slower / faster', ccKeyMute: 'Mute', ccKeySubs: 'AI subtitles', ccKeyFull: 'Fullscreen', ccKeyFit: 'Fit / fill screen', ccKeySyncAll: 'Bring everyone in the room to my picture', ccSyncAll: 'everyone here',
|
|
720
720
|
ccKeyExit: 'Close menu / exit cinema', ccKeyHelp: 'This help',
|
|
721
721
|
ccTouchHelp: 'Touch: tap = show/hide controls · double-tap left/right = ∓10s (keep tapping for more) · drag sideways = scrub.', ccFullscreen: 'Fullscreen (F) — keeps subtitles & controls', fullscreenUnsupported: 'Fullscreen is not available here.',
|
|
722
722
|
syncLoopCalm: '🔁 Play/pause kept flipping by itself — automatic sync paused for 30 s (your own taps still sync)', peerLeft: '👋 {name} left the room', someone: 'Someone',
|
|
@@ -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',
|
|
@@ -843,7 +843,7 @@ async function handle(m) {
|
|
|
843
843
|
ccFit: '화면 맞춤 / 채우기 (Z)', ccFitCover: '화면 채우기', ccFitContain: '원본 비율', ccSpeed: '재생 속도', ccNormal: '보통', ccLive: '실시간',
|
|
844
844
|
ccTimeToggle: '경과 / 남은 시간 전환', ccSeconds: '{n}초', ccWatching: '{n}명이 함께 시청 중', ccWaitPeer: '{name} 기기를 기다리는 중…', ccWaitSelf: '로딩 중 — 방이 기다려 줍니다',
|
|
845
845
|
ccHelp: '단축키 (?)', ccKeyPlay: '재생 / 일시정지', ccKeySeek5: '5초 뒤로 / 앞으로 (Shift: 10초)', ccKeySeek10: '10초 뒤로 / 앞으로', ccKeyVolume: '볼륨',
|
|
846
|
-
ccKeyPercent: '0%–90% 위치로 이동', ccKeySpeed: '느리게 / 빠르게', ccKeyMute: '음소거', ccKeySubs: 'AI 자막', ccKeyFull: '전체화면', ccKeyFit: '화면 맞춤 / 채우기',
|
|
846
|
+
ccKeyPercent: '0%–90% 위치로 이동', ccKeySpeed: '느리게 / 빠르게', ccKeyMute: '음소거', ccKeySubs: 'AI 자막', ccKeyFull: '전체화면', ccKeyFit: '화면 맞춤 / 채우기', ccKeySyncAll: '방 전체를 내 화면 위치로 맞추기', ccSyncAll: '모두 여기로',
|
|
847
847
|
ccKeyExit: '메뉴 닫기 / 시네마 종료', ccKeyHelp: '이 도움말',
|
|
848
848
|
ccTouchHelp: '터치: 탭 = 컨트롤 표시/숨김 · 좌우 두 번 탭 = ∓10초 (계속 탭하면 누적) · 옆으로 끌기 = 탐색.', ccFullscreen: '전체화면 (F) — 자막·컨트롤 유지', fullscreenUnsupported: '이 환경에서는 전체화면을 사용할 수 없습니다.',
|
|
849
849
|
syncLoopCalm: '🔁 재생/일시정지가 저절로 반복되어 자동 동기화를 30초간 멈췄습니다 (직접 누르는 조작은 그대로 동기화)', peerLeft: '👋 {name} 님이 나갔습니다', someone: '누군가',
|
|
@@ -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
|
-
|
|
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 =
|
|
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
|
|
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)));
|
|
@@ -7506,6 +7540,8 @@ async function handle(m) {
|
|
|
7506
7540
|
// A plain row of names: a tap does nothing (it used to flip the row into a column).
|
|
7507
7541
|
pill.addEventListener('click', (e) => e.stopPropagation());
|
|
7508
7542
|
uiElements.uiWrapper.appendChild(pill);
|
|
7543
|
+
// Placed at once (it used to wait for the next drag or resize and showed up off screen).
|
|
7544
|
+
placePresencePill();
|
|
7509
7545
|
}
|
|
7510
7546
|
if (!pill) return;
|
|
7511
7547
|
const entries = Object.values(STATE.presenceMap);
|
|
@@ -8034,13 +8070,24 @@ async function handle(m) {
|
|
|
8034
8070
|
dock.style.transformOrigin = `${isTop ? 'top' : 'bottom'} ${isLeft ? 'left' : 'right'}`;
|
|
8035
8071
|
dock.style.transform = dock.classList.contains('open') ? 'translateY(0)' : `translateY(${isTop ? '-15px' : '15px'})`;
|
|
8036
8072
|
reactPill.style.transform = reactPill.classList.contains('visible') ? 'translateX(0)' : `translateX(${isLeft ? '-20px' : '20px'})`;
|
|
8073
|
+
placePresencePill();
|
|
8074
|
+
}
|
|
8075
|
+
|
|
8076
|
+
// The names row sits just outside the ⚙ button, on the side facing the middle of the screen
|
|
8077
|
+
// (above it in the lower half, below it in the upper half), and never past the screen's edge.
|
|
8078
|
+
function placePresencePill() {
|
|
8037
8079
|
const pill = shadow?.getElementById('nxu-presence-pill');
|
|
8038
|
-
|
|
8039
|
-
|
|
8040
|
-
|
|
8041
|
-
|
|
8042
|
-
|
|
8043
|
-
|
|
8080
|
+
const wrapper = uiElements.uiWrapper;
|
|
8081
|
+
if (!pill || !wrapper) return;
|
|
8082
|
+
const rect = localBox(wrapper), w = getW(), h = getH();
|
|
8083
|
+
const isLeft = rect.left + 24 < w / 2, isTop = rect.top + 24 < h / 2;
|
|
8084
|
+
pill.style.top = isTop ? 'auto' : '-30px';
|
|
8085
|
+
pill.style.bottom = isTop ? '-30px' : 'auto';
|
|
8086
|
+
pill.style.left = isLeft ? '0' : 'auto';
|
|
8087
|
+
pill.style.right = isLeft ? 'auto' : '0';
|
|
8088
|
+
// Room on that side: from the button's edge to the screen's edge (8 px margin).
|
|
8089
|
+
const room = isLeft ? w - rect.left - 8 : rect.left + rect.width - 8;
|
|
8090
|
+
pill.style.maxWidth = Math.max(120, Math.min(360, room)) + 'px';
|
|
8044
8091
|
}
|
|
8045
8092
|
|
|
8046
8093
|
// Notch / home-indicator insets (iPhone), so controls never sit under them.
|
|
@@ -8278,7 +8325,9 @@ async function handle(m) {
|
|
|
8278
8325
|
const adv = section('🔧', t('setAdvanced'));
|
|
8279
8326
|
const tools = createEl('div', 'nx-btn-row nx-tools');
|
|
8280
8327
|
tools.append(parts.chatLog, parts.subLog, parts.debug);
|
|
8281
|
-
adv.append(tools, parts.idleRow, parts.hideSite, createEl('div', 'trans-help', t('setHideFabHelp'))
|
|
8328
|
+
adv.append(tools, parts.idleRow, parts.hideSite, createEl('div', 'trans-help', t('setHideFabHelp')));
|
|
8329
|
+
// The installed version, always visible at the bottom (not inside a folded section).
|
|
8330
|
+
body.appendChild(createEl('div', 'nx-set-ver', 'NexusSync v' + NXU_VERSION));
|
|
8282
8331
|
return body;
|
|
8283
8332
|
}
|
|
8284
8333
|
|
|
@@ -8586,7 +8635,7 @@ async function handle(m) {
|
|
|
8586
8635
|
.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; }
|
|
8587
8636
|
@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)); } }
|
|
8588
8637
|
@media (prefers-reduced-motion: reduce) { .react-btn.pop, .react-btn.pop::after, .nx-spark { animation:none !important; } }
|
|
8589
|
-
.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:default; max-width:min(78vw, 360px); overflow:hidden; }
|
|
8638
|
+
.presence-pill { position:absolute; right:0; top:-30px; 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:default; max-width:min(78vw, 360px); overflow:hidden; }
|
|
8590
8639
|
.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); }
|
|
8591
8640
|
.nx-who.me { background:rgba(255,255,255,0.18); }
|
|
8592
8641
|
.nx-who.away { opacity:0.55; }
|
|
@@ -8595,6 +8644,14 @@ async function handle(m) {
|
|
|
8595
8644
|
.nx-who-dot { flex:none; width:8px; height:8px; border-radius:50%; box-shadow:0 0 5px currentColor; }
|
|
8596
8645
|
.nx-who-name { overflow:hidden; text-overflow:ellipsis; }
|
|
8597
8646
|
.nx-who-tag { font-size:10px; }
|
|
8647
|
+
.nx-who-pl { font-size:9px; line-height:1; opacity:0.85; }
|
|
8648
|
+
.nx-who-pl.p { color:#69f0ae; }
|
|
8649
|
+
.nx-who-pl.z { color:#ffcc80; }
|
|
8650
|
+
.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;
|
|
8651
|
+
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; }
|
|
8652
|
+
.nx-sync-card.in { opacity:1; transform:translate(-50%, 0); }
|
|
8653
|
+
.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; }
|
|
8654
|
+
.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
8655
|
.nx-who-av { font-size:12px; line-height:1; }
|
|
8599
8656
|
.nx-who-img { width:16px; height:16px; border-radius:50%; object-fit:cover; border:1.5px solid; flex:none; }
|
|
8600
8657
|
.nx-who-st { font-weight:500; opacity:0.7; margin-left:4px; overflow:hidden; text-overflow:ellipsis; }
|
|
@@ -8772,7 +8829,7 @@ async function handle(m) {
|
|
|
8772
8829
|
.nx-sw.active .nx-sw-track { background:var(--accent); }
|
|
8773
8830
|
.nx-sw.active .nx-sw-track::after { transform:translateX(16px); }
|
|
8774
8831
|
.nx-set-sec > .nx-sw + .nx-sw { margin-top:4px; }
|
|
8775
|
-
.nx-set-ver { font-size:10.5px; opacity:0.
|
|
8832
|
+
.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
8833
|
.nx-settings { container-type:inline-size; }
|
|
8777
8834
|
.seg { display:flex; gap:6px; }
|
|
8778
8835
|
.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 +10052,7 @@ async function handle(m) {
|
|
|
9995
10052
|
},
|
|
9996
10053
|
// What this device announces in the room (presence): name, colour, avatar, status.
|
|
9997
10054
|
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 };
|
|
10055
|
+
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
10056
|
},
|
|
10000
10057
|
AVATARS: ['🙂', '😎', '🥳', '🤠', '👻', '👾', '🤖', '🎃', '🦊', '🐱', '🐶', '🐯', '🐵', '🐼', '🐸', '🐰', '🐻', '🐨', '🦁', '🐧', '🦄', '🐙', '🍿', '🎧'],
|
|
10001
10058
|
avatar() { return safeAvatar(STORE.get('nxu_avatar', '')); },
|
|
@@ -11473,6 +11530,81 @@ async function handle(m) {
|
|
|
11473
11530
|
} catch (_) { }
|
|
11474
11531
|
}, 1200);
|
|
11475
11532
|
|
|
11533
|
+
// ───────────────────────── Playing for everyone?
|
|
11534
|
+
// Each device tells the room what its picture is actually doing (playing / loading /
|
|
11535
|
+
// paused, in the names row). Once a second this device compares itself with the room:
|
|
11536
|
+
// when the room plays but the picture here stands still (a refused or swallowed play(),
|
|
11537
|
+
// a player that ignored the room), it is put back in step by itself; if the browser
|
|
11538
|
+
// refuses that (it wants a tap), a small card says so and one tap fixes it. The same
|
|
11539
|
+
// when the room is paused but the picture here keeps playing.
|
|
11540
|
+
const PLAY_CHECK = {
|
|
11541
|
+
local() {
|
|
11542
|
+
const v = STATE.video;
|
|
11543
|
+
if (v) return v.paused || v.ended ? 'z' : (v.readyState < 3 || v.seeking) ? 's' : 'p';
|
|
11544
|
+
if (STATE.cinemaIframe) { const rep = VIDEO_DETECTOR.frameReports.get(STATE.cinemaIframe); if (rep) return rep.paused === false ? 'p' : 'z'; }
|
|
11545
|
+
return '';
|
|
11546
|
+
},
|
|
11547
|
+
_since: 0, _kind: '', _tries: 0, _last: '',
|
|
11548
|
+
start() {
|
|
11549
|
+
if (this._timer || !IS_TOP) return;
|
|
11550
|
+
this._timer = setInterval(() => { try { this.tick(); } catch (_) { } }, 1000);
|
|
11551
|
+
// Back from another app or tab (phones pause or freeze a page in the background):
|
|
11552
|
+
// put the picture in step with the room at once instead of after a few seconds.
|
|
11553
|
+
if (!this._onVis) {
|
|
11554
|
+
this._onVis = () => {
|
|
11555
|
+
if (document.hidden || !STATE.handshakeVerified || STATE.isViewer) return;
|
|
11556
|
+
setTimeout(() => {
|
|
11557
|
+
const room = _getVideoState(), me = this.local();
|
|
11558
|
+
if (room && me && ((room.play && me === 'z') || (!room.play && me === 'p'))) { logDebug('Play check: back in front — putting the picture in step with the room.', 'info'); this.heal(room); }
|
|
11559
|
+
}, 400);
|
|
11560
|
+
};
|
|
11561
|
+
document.addEventListener('visibilitychange', this._onVis);
|
|
11562
|
+
}
|
|
11563
|
+
},
|
|
11564
|
+
stop() { clearInterval(this._timer); this._timer = null; this._hide(); this._since = 0; this._kind = ''; this._tries = 0; this._last = ''; },
|
|
11565
|
+
tick() {
|
|
11566
|
+
if (!STATE.handshakeVerified) { this.stop(); return; }
|
|
11567
|
+
const me = this.local();
|
|
11568
|
+
// Changes reach the others within a second (not only with the 8 s heartbeat).
|
|
11569
|
+
if (me !== this._last) { this._last = me; PROFILE.publish(); updatePresenceUI(); }
|
|
11570
|
+
const room = _getVideoState();
|
|
11571
|
+
const busy = !room || !me || STATE.isViewer || document.hidden || STATE._scheduledPlay || Date.now() - (STATE._lastLocalActionAt || 0) < 2500;
|
|
11572
|
+
const kind = busy ? '' : room.play && me === 'z' ? 'stopped' : !room.play && me === 'p' ? 'running' : '';
|
|
11573
|
+
if (!kind) { if (this._kind) this._hide(); this._kind = ''; this._since = 0; this._tries = 0; return; }
|
|
11574
|
+
if (kind !== this._kind) { this._kind = kind; this._since = Date.now(); this._tries = 0; return; }
|
|
11575
|
+
const held = Date.now() - this._since;
|
|
11576
|
+
if (held < 2500) return;
|
|
11577
|
+
if (this._tries < 2 && held >= 2500 + this._tries * 3000) {
|
|
11578
|
+
this._tries++;
|
|
11579
|
+
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');
|
|
11580
|
+
this.heal(room);
|
|
11581
|
+
return;
|
|
11582
|
+
}
|
|
11583
|
+
if (this._tries >= 2 && kind === 'stopped') this._show();
|
|
11584
|
+
},
|
|
11585
|
+
heal(room = _getVideoState()) {
|
|
11586
|
+
if (!room) return;
|
|
11587
|
+
if (STATE.video) applyRemoteStateToVideo({ ...room, action: 'user' });
|
|
11588
|
+
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 });
|
|
11589
|
+
},
|
|
11590
|
+
_show() {
|
|
11591
|
+
if (this._card?.isConnected) return;
|
|
11592
|
+
const container = getContainer();
|
|
11593
|
+
if (!container) return;
|
|
11594
|
+
const card = createEl('div', 'nx-sync-card');
|
|
11595
|
+
const go = createEl('button', '', '▶ ' + t('playCheckGo'), { type: 'button' });
|
|
11596
|
+
const x = createEl('button', 'x', '✕', { type: 'button', 'aria-label': t('talkClose') });
|
|
11597
|
+
['pointerdown', 'click', 'touchstart'].forEach(n => card.addEventListener(n, (ev) => ev.stopPropagation()));
|
|
11598
|
+
go.onclick = () => { const v = STATE.video; if (v) { v.play?.().catch(() => { }); } this.heal(); this._hide(); this._tries = 0; this._since = Date.now(); };
|
|
11599
|
+
x.onclick = () => { this._hide(); this._since = Date.now() + 30000; };
|
|
11600
|
+
card.append(createEl('span', '', t('playCheckText')), go, x);
|
|
11601
|
+
container.appendChild(card);
|
|
11602
|
+
this._card = card;
|
|
11603
|
+
requestAnimationFrame(() => card.classList.add('in'));
|
|
11604
|
+
},
|
|
11605
|
+
_hide() { const c = this._card; this._card = null; if (!c) return; c.classList.remove('in'); setTimeout(() => c.remove(), 260); }
|
|
11606
|
+
};
|
|
11607
|
+
|
|
11476
11608
|
// ───────────────────────── Speed per site
|
|
11477
11609
|
// The speed you pick in the speed menu is kept per site and used again for the next video
|
|
11478
11610
|
// there when you watch on your own (in a room the room's speed rules). 1x forgets it.
|
|
@@ -13560,7 +13692,7 @@ async function handle(m) {
|
|
|
13560
13692
|
const rows = [
|
|
13561
13693
|
[['Space', 'K'], 'ccKeyPlay'], [['←', '→'], 'ccKeySeek5'], [['J', 'L'], 'ccKeySeek10'], [['↑', '↓'], 'ccKeyVolume'],
|
|
13562
13694
|
[['0', '9'], 'ccKeyPercent'], [['<', '>'], 'ccKeySpeed'], [['M'], 'ccKeyMute'], [['C'], 'ccKeySubs'],
|
|
13563
|
-
[['F'], 'ccKeyFull'], [['Z'], 'ccKeyFit'], [['Esc'], 'ccKeyExit'], [['?'], 'ccKeyHelp']
|
|
13695
|
+
[['F'], 'ccKeyFull'], [['Z'], 'ccKeyFit'], ...(STATE.handshakeVerified ? [[['G'], 'ccKeySyncAll']] : []), [['Esc'], 'ccKeyExit'], [['?'], 'ccKeyHelp']
|
|
13564
13696
|
];
|
|
13565
13697
|
const dl = createEl('dl');
|
|
13566
13698
|
rows.forEach(([keys, label]) => {
|
|
@@ -13811,6 +13943,15 @@ async function handle(m) {
|
|
|
13811
13943
|
if (e.shiftKey) return false;
|
|
13812
13944
|
if (IS_TOP) COVER.toggle(); else up('cover');
|
|
13813
13945
|
break;
|
|
13946
|
+
case 'KeyG':
|
|
13947
|
+
// Everyone in the room to this device's picture: where it is, playing or
|
|
13948
|
+
// paused (when someone drifted or got stuck). Only in a room.
|
|
13949
|
+
if (e.shiftKey || !STATE.handshakeVerified) return false;
|
|
13950
|
+
if (control) { const info = control.info(); if (!info) return false; control.seek(info.time); }
|
|
13951
|
+
else if (STATE.video) act('seek', STATE.video.currentTime);
|
|
13952
|
+
else return false;
|
|
13953
|
+
this.flash('⇆ ' + t('ccSyncAll'));
|
|
13954
|
+
break;
|
|
13814
13955
|
default:
|
|
13815
13956
|
return false;
|
|
13816
13957
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kangsicj/nexussync",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.20",
|
|
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",
|