@kangsicj/nexussync 1.6.13 → 1.6.15
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 +2 -2
- package/dist/NexusSync.meta.js +1 -1
- package/dist/NexusSync.user.js +353 -56
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
| Drawing and reactions | Strokes anchored to the video frame on every screen; emoji bursts; 3-2-1 countdown |
|
|
34
34
|
| Cover | Hides the picture on all screens for a few seconds; audio and subtitles continue; replays the cover on rewind |
|
|
35
35
|
| AI subtitles | Transcribes video audio into translated live subtitles; free offline Whisper on PC and phone (downloaded on request; on iPhone the way to hear the video itself without a key), the browser's engine, or your own API key; glossary for names |
|
|
36
|
-
| Subtitles | Video tracks, local files or OpenSubtitles; up to 3 tracks at once |
|
|
36
|
+
| Subtitles | Video tracks, local files or OpenSubtitles; up to 3 tracks at once, each in its own colour; your pick is remembered per site for the next episode |
|
|
37
37
|
| Timing sync | Aligns two different releases of the same film (offset by manual mark or automatic detection) |
|
|
38
|
-
| Next episode | Room persists across episodes; *Up next* countdown; sleep timer (pause after 15/30/60 min or at the end of the episode) |
|
|
38
|
+
| Next episode | Room persists across episodes; *Up next* countdown; sleep timer (pause after 15/30/60 min or at the end of the episode); continue watching from where you stopped (offered, never forced) |
|
|
39
39
|
| Privacy | End-to-end encrypted rooms, PIN or invite link to join, rooms deleted after everyone leaves |
|
|
40
40
|
|
|
41
41
|
## Installation
|
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.15
|
|
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.15
|
|
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.15';
|
|
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.15';
|
|
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=';
|
|
@@ -249,7 +249,7 @@ async function handle(m) {
|
|
|
249
249
|
'nxu_idle_timeout', 'nxu_sub_size', 'nxu_sub_opacity', 'nxu_sub_position', 'nxu_speaker_language',
|
|
250
250
|
'nxu_subtitle_language', 'nxu_audio_mode', 'nxu_translation_provider', 'nxu_stt_local_first',
|
|
251
251
|
'nxu_smart_speech_locale', 'nxu_fab_pos', 'nxu_asr_provider', 'nxu_key_openai', 'nxu_key_anthropic', 'nxu_key_groq', 'nxu_key_deepl',
|
|
252
|
-
'nxu_model_openai', 'nxu_model_anthropic', 'nxu_cinema_ambient', 'nxu_cinema_fit', 'nxu_cc_remaining', 'nxu_cinema_controls', 'nxu_nickname', 'nxu_color', 'nxu_quick_replies', 'nxu_chat_translate', 'nxu_sync_offset', 'nxu_cover_band', 'nxu_cover_marks', 'nxu_travel', 'nxu_auto_next', 'nxu_auto_cinema_sites', 'nxu_ad_guard', 'nxu_glossary', 'nxu_panel_size_chat-panel', 'nxu_panel_size_sub-log-panel', 'nxu_panel_size_debug-panel', 'nxu_panel_size_trans-modal', 'nxu_cinema_rotate', 'nxu_rotate_denied_' + HOST
|
|
252
|
+
'nxu_model_openai', 'nxu_model_anthropic', 'nxu_cinema_ambient', 'nxu_cinema_fit', 'nxu_cc_remaining', 'nxu_cinema_controls', 'nxu_nickname', 'nxu_color', 'nxu_quick_replies', 'nxu_chat_translate', 'nxu_sync_offset', 'nxu_cover_band', 'nxu_cover_marks', 'nxu_travel', 'nxu_auto_next', 'nxu_auto_cinema_sites', 'nxu_ad_guard', 'nxu_glossary', 'nxu_panel_size_chat-panel', 'nxu_panel_size_sub-log-panel', 'nxu_panel_size_debug-panel', 'nxu_panel_size_trans-modal', 'nxu_cinema_rotate', 'nxu_rotate_denied_' + HOST, 'nxu_resume', 'nxu_resume_on', 'nxu_sub_pick_' + HOST
|
|
253
253
|
]);
|
|
254
254
|
|
|
255
255
|
// ───────────────────────── Cross-origin HTTP (GM xhr first, fetch fallback)
|
|
@@ -413,7 +413,9 @@ async function handle(m) {
|
|
|
413
413
|
case 'NXU_CINEMA':
|
|
414
414
|
return typeof data.on === 'boolean' && bool(data.ambient) && (data.fit === undefined || ['contain', 'cover', 'fill'].includes(data.fit)) && bool(data.nexus);
|
|
415
415
|
case 'NXU_MEDIA_CMD':
|
|
416
|
-
return ['play', 'pause', 'toggle', 'seek', 'seekBy', 'volume', 'mute'].includes(data.action) && num(data.value);
|
|
416
|
+
return ['play', 'pause', 'toggle', 'seek', 'seekBy', 'volume', 'mute', 'pip'].includes(data.action) && num(data.value);
|
|
417
|
+
case 'NXU_PIP_STATE':
|
|
418
|
+
return ['on', 'off', 'armed', 'blocked', 'unsupported'].includes(data.state);
|
|
417
419
|
case 'NXU_SYNC_CMD':
|
|
418
420
|
return ['play', 'pause', 'rate'].includes(data.cmd) && num(data.time) && num(data.rate) && str(data.eventId) && str(data.action) && num(data.startIn);
|
|
419
421
|
case 'NXU_TUNE':
|
|
@@ -743,7 +745,7 @@ async function handle(m) {
|
|
|
743
745
|
findMedia: 'Find Media', connect: 'Connect', disconnect: 'Disconnect', connecting: 'Connecting…', loading: 'Loading…', offline: 'Offline', sync: 'Sync',
|
|
744
746
|
cinema: 'Cinema', cinemaTitle: 'Fill the window with the video (Alt+Shift+C, Esc to exit)', cinemaOn: '🍿 Cinema ON', cinemaOff: '🍿 Cinema OFF',
|
|
745
747
|
cinemaPending: '🍿 Cinema will start when a video is found', cinemaPendingOff: '🍿 Cinema request cancelled', cinemaExit: 'Exit cinema', cinemaExitTitle: 'Exit cinema mode (Esc)',
|
|
746
|
-
rotateTitle: 'Landscape view (works with rotation lock) · hold to turn auto on/off', rotateAutoOn: '📱 Tilt-to-landscape ON (works with rotation lock)', rotateAutoOff: '📱 Tilt-to-landscape OFF',
|
|
748
|
+
rotateTitle: 'Landscape view (works with rotation lock): tap for one side, again for the other, again to go back · hold to turn auto on/off', rotateOnce: '↻ Landscape · tap again for the other side', rotateOther: '↺ Turned to the other side · tap again to go back', rotateAutoOn: '📱 Tilt-to-landscape ON (works with rotation lock)', rotateAutoOff: '📱 Tilt-to-landscape OFF',
|
|
747
749
|
rotateDenied: '📱 Motion access was declined, so tilting cannot switch to landscape. Use the ↻ button in cinema mode.', menuRotate: 'Tilt-to-landscape for videos on/off (iPhone)',
|
|
748
750
|
canvas: 'Canvas', bookmark: 'Bookmark', bookmarkTitle: 'Bookmark the current position', chat: 'Chat', aiSub: 'AI Sub', aiSubTitle: 'Live subtitles & translation (Alt+Shift+T)',
|
|
749
751
|
subLog: 'Sub Log', debug: 'Debug', hideOnSite: 'Hide on this site', hideOnSiteTitle: 'Hide the floating button on this site (restore with Alt+Shift+N or the userscript menu)',
|
|
@@ -764,7 +766,7 @@ async function handle(m) {
|
|
|
764
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).',
|
|
765
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.',
|
|
766
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',
|
|
767
|
-
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', 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}', 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.',
|
|
768
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.',
|
|
769
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).',
|
|
770
772
|
settings: 'Settings', setProfile: 'Profile', setAvatar: 'Avatar', setStatus: 'Status message', setStatusPh: 'e.g. Popcorn ready 🍿', setReactions: 'My reactions',
|
|
@@ -783,6 +785,8 @@ async function handle(m) {
|
|
|
783
785
|
srcIosHelp: 'Safari\'s built-in engine on iPhone/iPad erases the phone\'s own sound, so it hears only voices in the room. To subtitle the video, pick offline Whisper or Groq/OpenAI as the recognition engine below.',
|
|
784
786
|
srcIosMediaHelp: 'The video is heard through the microphone with echo cancellation off — keep it playing through the speaker (not earphones) with the volume up.',
|
|
785
787
|
subIosSpeaker: 'Listening to the video through the microphone — play it through the speaker with the volume up (not earphones).',
|
|
788
|
+
subIssueIos: 'Hears only voices around you',
|
|
789
|
+
subIosEngineCard: 'Safari\'s built-in engine cannot hear this phone\'s own sound, only voices around you. To subtitle the video, use the free offline model (73 MB, downloaded once).', subIosGetWhisper: 'Get the offline model and switch', subIosWhisperFailed: 'The offline model could not start in this app. In AI settings, enter a free Groq key and pick Groq as the recognition engine instead.',
|
|
786
790
|
subIosEngine: 'Safari\'s engine hears only voices in the room, not this phone\'s own sound. To subtitle the video, choose offline Whisper or Groq in AI settings → recognition engine.',
|
|
787
791
|
whisperMobileHelp: 'On a phone only the base model is offered; the first line can take a few seconds.',
|
|
788
792
|
videoLanguage: 'Language spoken in the video', subtitleLanguageReq: 'Subtitle language (required)', chooseLanguage: '— Choose a language —',
|
|
@@ -817,7 +821,7 @@ async function handle(m) {
|
|
|
817
821
|
pinFormat: '⚠️ Enter the 6-digit PIN', pinLocked: '🔒 Too many attempts. Retry in {s}s.', pinMismatch: '⚠️ Could not join. {n} attempts left.', pinCopied: '📋 PIN copied',
|
|
818
822
|
syncBlocked: '❌ This site blocks the sync module. Try another page.', roomPlaying: '▶️ Room playing at {time}', roomPaused: '⏸️ Room paused at {time}',
|
|
819
823
|
bookmarkAdded: '📌 Bookmark added: {time}', bookmarkSynced: '📌 Bookmark synced', jumpedTo: '⏩ Jumped to {time}', jumpToPosition: 'Jump to this position',
|
|
820
|
-
noVideo: '⚠️ No video detected', noPlayingVideo: '⚠️ No playing video found', pipUnsupported: '⚠️ Picture-in-Picture not supported', pipBlocked: '⚠️ Picture-in-Picture was blocked',
|
|
824
|
+
noVideo: '⚠️ No video detected', noPlayingVideo: '⚠️ No playing video found', pipUnsupported: '⚠️ Picture-in-Picture not supported', pipBlocked: '⚠️ Picture-in-Picture was blocked', pipTapVideo: '📺 Tap the video once to pop it out',
|
|
821
825
|
mediaFound: '✅ Media detected', mediaNotFound: '🔎 No media yet — start the video and try again',
|
|
822
826
|
canvasOn: '🎨 Canvas ON', canvasOff: '🎨 Canvas OFF', canvasViewOnly: '🎨 Canvas (view only)', nothingToUndo: '↩️ Nothing to undo', undo: 'Undo (Ctrl+Z)',
|
|
823
827
|
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', whoSleeping: 'screen off — still in the room, back when it wakes', whoReconnecting: 'Reconnecting…',
|
|
@@ -868,7 +872,7 @@ async function handle(m) {
|
|
|
868
872
|
findMedia: '미디어 찾기', connect: '연결', disconnect: '연결 해제', connecting: '연결 중…', loading: '불러오는 중…', offline: '오프라인', sync: '동기화',
|
|
869
873
|
cinema: '시네마', cinemaTitle: '영상을 창 전체로 크게 보기 (Alt+Shift+C, Esc로 종료)', cinemaOn: '🍿 시네마 모드 켜짐', cinemaOff: '🍿 시네마 모드 꺼짐',
|
|
870
874
|
cinemaPending: '🍿 영상이 감지되면 시네마 모드가 적용됩니다', cinemaPendingOff: '🍿 시네마 예약 취소', cinemaExit: '시네마 종료', cinemaExitTitle: '시네마 모드 종료 (Esc)',
|
|
871
|
-
rotateTitle: '가로로 보기 (화면 고정 상태에서도) · 길게 누르면 자동 전환 켜기/끄기', rotateAutoOn: '📱 기울이면 가로 보기 켜짐 (화면 고정 해제 불필요)', rotateAutoOff: '📱 기울이면 가로 보기 꺼짐',
|
|
875
|
+
rotateTitle: '가로로 보기 (화면 고정 상태에서도): 한 번 누르면 한쪽, 또 누르면 반대쪽, 또 누르면 원래대로 · 길게 누르면 자동 전환 켜기/끄기', rotateOnce: '↻ 가로 보기 · 한 번 더 누르면 반대쪽으로 돌아가요', rotateOther: '↺ 반대쪽으로 돌렸어요 · 한 번 더 누르면 원래대로', rotateAutoOn: '📱 기울이면 가로 보기 켜짐 (화면 고정 해제 불필요)', rotateAutoOff: '📱 기울이면 가로 보기 꺼짐',
|
|
872
876
|
rotateDenied: '📱 동작·방향 접근이 거부되어 기울여서 가로 보기를 쓸 수 없습니다. 시네마 화면의 ↻ 버튼으로 돌릴 수 있습니다.', menuRotate: '동영상 기울이면 가로 보기 켜기/끄기 (아이폰)',
|
|
873
877
|
canvas: '캔버스', bookmark: '북마크', bookmarkTitle: '현재 위치를 북마크', chat: '채팅', aiSub: 'AI 자막', aiSubTitle: '실시간 자막·번역 (Alt+Shift+T)',
|
|
874
878
|
subLog: '자막 기록', debug: '디버그', hideOnSite: '이 사이트에서 숨기기', hideOnSiteTitle: '이 사이트에서 떠 있는 버튼 숨기기 (Alt+Shift+N 또는 유저스크립트 메뉴로 복원)',
|
|
@@ -889,7 +893,7 @@ async function handle(m) {
|
|
|
889
893
|
tuneSrcSame: '🟢 모두 같은 영상이에요 — 프레임 단위로 자동으로 맞추고 있어요.', tuneSrcDiff: '🟠 서로 다른 버전이에요 (길이 차이 {s}) — 잠시 재생하면 자동으로 맞추고, 여기서 직접 맞출 수도 있어요.', tuneSrcUnknown: '다른 사람의 영상 정보를 기다리는 중…', tuneSrcShifted: '🟠 길이는 같지만 장면이 달라요 — 재생하는 동안 자동으로 맞추고, 여기서 직접 맞출 수도 있어요.', tuneDiffPicture: '시간은 같지만 화면이 달라요', tuneShiftFound: '길이는 같지만 장면이 달라서 타이밍을 {s} 자동 보정했어요 (누르면 되돌리기).',
|
|
890
894
|
tuneSameReset: '⏱ 상대와 같은 영상이라 타이밍 보정을 해제했어요.', tuneAutoApplied: '다른 버전이라 타이밍을 {s} 자동 보정했어요 (누르면 되돌리기).', tuneSuggest: '서로 영상 길이가 {s} 달라요. 눌러서 맞춰 보세요.',
|
|
891
895
|
subMenu: '자막', xsubOff: '끄기', subTrack: '영상에 포함된 자막', subSearch: '🔎 자막 찾기 (OpenSubtitles)', subFile: '📂 자막 파일 열기…', subAi: '🧠 AI 실시간 자막', subDelay: '싱크', subLater: '늦게', subEarlier: '빠르게', xsubSize: '크기',
|
|
892
|
-
subLoaded: '💬 자막: {name}', subMulti: '자막 여러 개를 함께 보는 중 — 점 색이 화면 자막 색이에요. 누르면 그 자막만 꺼져요.', subNone: '이 영상에는 포함된 자막이 없어요.', subMoreLangs: '🌐 다른 언어 {n}개 더 보기', subSiteOnly: '이 사이트는 자기 메뉴에서만 이 자막을 불러와요. 오른쪽 위에서 사이트 컨트롤로 바꾼 뒤 거기서 골라 주세요.', subSuggest: '💬 자막이 없나요? 찾아보기', subLoadFail: '자막을 불러오지 못했어요.',
|
|
896
|
+
subLoaded: '💬 자막: {name}', subMulti: '자막 여러 개를 함께 보는 중 — 점 색이 화면 자막 색이에요. 누르면 그 자막만 꺼져요.', subNone: '이 영상에는 포함된 자막이 없어요.', subMoreLangs: '🌐 다른 언어 {n}개 더 보기', subRestored: '💬 지난번 자막을 다시 켰어요: {name}', resumeFrom: '{time}부터 이어보기', setResume: '보던 곳부터 이어보기 제안', subSiteOnly: '이 사이트는 자기 메뉴에서만 이 자막을 불러와요. 오른쪽 위에서 사이트 컨트롤로 바꾼 뒤 거기서 골라 주세요.', subSuggest: '💬 자막이 없나요? 찾아보기', subLoadFail: '자막을 불러오지 못했어요.',
|
|
893
897
|
osTitle: '자막 찾기', osTmdbLooking: 'TMDB에서 영어 제목을 찾는 중…', osTmdbNone: 'TMDB에서 영어 제목을 찾지 못했어요 — 알고 있다면 직접 입력하세요.', osQuery: '제목 (영어 제목이 가장 잘 찾아져요)', osSeason: '시즌', osEpisode: '회차', osLang: '언어', osSearch: '검색', osSearching: '찾는 중…', osNone: '찾지 못했어요. 영어 제목으로 바꾸거나 연도를 빼 보세요.', osError: 'OpenSubtitles가 응답하지 않아요. 잠시 후 다시 시도하세요.', osDownloads: '다운로드 {n}회', osLoading: '불러오는 중…', osHint: '자막은 OpenSubtitles.org에서 가져와 NexusSync 스타일로 보여 줘요. 빠르거나 늦으면 자막 메뉴의 “싱크”로 맞추세요.',
|
|
894
898
|
viewMenu: '화면', viewAudio: '오디오 트랙', viewBright: '밝기', viewBoost: '볼륨 부스트', viewReset: '초기화', boostBlocked: '이 영상은 다른 사이트에서 오는 소리라 여기서 키울 수 없어요.',
|
|
895
899
|
settings: '설정', setProfile: '프로필', setAvatar: '아바타', setStatus: '상태 메시지', setStatusPh: '예: 팝콘 준비 완료 🍿', setReactions: '내 리액션',
|
|
@@ -908,6 +912,8 @@ async function handle(m) {
|
|
|
908
912
|
srcIosHelp: '아이폰·아이패드의 Safari 기본 엔진은 휴대폰 자체 소리를 지워서 주변 사람 목소리만 들어요. 영상 자막을 보려면 아래 음성 인식 엔진을 오프라인 Whisper나 Groq/OpenAI로 골라 주세요.',
|
|
909
913
|
srcIosMediaHelp: '마이크의 에코 제거를 끄고 영상 소리를 들어요. 이어폰 말고 스피커로, 소리를 키워서 재생해 주세요.',
|
|
910
914
|
subIosSpeaker: '마이크로 영상 소리를 듣고 있어요. 이어폰 말고 스피커로, 소리를 키워서 재생해 주세요.',
|
|
915
|
+
subIssueIos: '주변 목소리만 듣는 중',
|
|
916
|
+
subIosEngineCard: 'Safari 기본 엔진은 이 휴대폰에서 나는 소리는 못 듣고 주변 목소리만 들어요. 영상 자막을 보려면 무료 오프라인 모델(73MB, 한 번만 다운로드)을 쓰세요.', subIosGetWhisper: '오프라인 모델 받고 바로 전환', subIosWhisperFailed: '이 앱에서는 오프라인 모델을 실행할 수 없어요. AI 설정에서 무료 Groq 키를 넣고 음성 인식 엔진을 Groq로 골라 주세요.',
|
|
911
917
|
subIosEngine: 'Safari 엔진은 이 휴대폰 자체 소리는 못 듣고 주변 목소리만 들어요. 영상 자막은 AI 설정 → 음성 인식 엔진에서 오프라인 Whisper나 Groq를 골라 주세요.',
|
|
912
918
|
whisperMobileHelp: '휴대폰에서는 base 모델만 쓸 수 있어요. 첫 줄은 몇 초 걸릴 수 있어요.',
|
|
913
919
|
videoLanguage: '영상 속 언어', subtitleLanguageReq: '자막 언어 (필수)', chooseLanguage: '— 언어를 선택하세요 —',
|
|
@@ -942,7 +948,7 @@ async function handle(m) {
|
|
|
942
948
|
pinFormat: '⚠️ 6자리 PIN을 입력하세요', pinLocked: '🔒 시도 횟수 초과. {s}초 후 다시 시도하세요.', pinMismatch: '⚠️ 참여하지 못했습니다. {n}회 남음.', pinCopied: '📋 PIN 복사됨',
|
|
943
949
|
syncBlocked: '❌ 이 사이트는 동기화 모듈을 차단합니다. 다른 페이지에서 시도하세요.', roomPlaying: '▶️ {time}부터 재생 중', roomPaused: '⏸️ {time}에서 일시정지',
|
|
944
950
|
bookmarkAdded: '📌 북마크 추가: {time}', bookmarkSynced: '📌 북마크 동기화됨', jumpedTo: '⏩ {time}(으)로 이동', jumpToPosition: '이 위치로 이동',
|
|
945
|
-
noVideo: '⚠️ 감지된 영상이 없습니다', noPlayingVideo: '⚠️ 재생 중인 영상이 없습니다', pipUnsupported: '⚠️ PiP를 지원하지 않습니다', pipBlocked: '⚠️ PiP가 차단되었습니다',
|
|
951
|
+
noVideo: '⚠️ 감지된 영상이 없습니다', noPlayingVideo: '⚠️ 재생 중인 영상이 없습니다', pipUnsupported: '⚠️ PiP를 지원하지 않습니다', pipBlocked: '⚠️ PiP가 차단되었습니다', pipTapVideo: '📺 영상을 한 번 탭하면 작은 창으로 떠요',
|
|
946
952
|
mediaFound: '✅ 미디어 감지됨', mediaNotFound: '🔎 아직 미디어가 없습니다 — 영상을 재생한 뒤 다시 시도하세요',
|
|
947
953
|
canvasOn: '🎨 캔버스 켜짐', canvasOff: '🎨 캔버스 꺼짐', canvasViewOnly: '🎨 캔버스 (보기 전용)', nothingToUndo: '↩️ 되돌릴 내용이 없습니다', undo: '되돌리기 (Ctrl+Z)',
|
|
948
954
|
pen: '펜', eraser: '지우개', clearCanvas: '모두 지우기', watching: '{n}명 시청 중', meTag: '(나)', whoViewer: '보기 전용', whoAway: '자리 비움 (화면 꺼짐·다른 탭)', whoOldVer: '다른 버전 — 업데이트가 필요해요', whoTitle: '함께 보는 사람', whoSleeping: '화면 꺼짐 — 방에 그대로 있고, 화면이 켜지면 돌아와요', whoReconnecting: '다시 연결하는 중…',
|
|
@@ -1478,7 +1484,10 @@ async function handle(m) {
|
|
|
1478
1484
|
const barX = (vw - Math.min(vw, vh * ar)) / 2, barY = (vh - Math.min(vh, vw / ar)) / 2;
|
|
1479
1485
|
const want = Math.round(Math.min(vw, vh) * 0.045);
|
|
1480
1486
|
bars = barX >= 2 || barY >= 2;
|
|
1481
|
-
|
|
1487
|
+
// Phones: the picture is never made smaller for the glow (switching the
|
|
1488
|
+
// glow off then looked like "fill screen" had been turned on).
|
|
1489
|
+
const phone = Math.min(view.screen?.width || vw, view.screen?.height || vh) < 500;
|
|
1490
|
+
if (barX < want && barY < want && !phone) inset = want;
|
|
1482
1491
|
}
|
|
1483
1492
|
visible = fit === 'contain' && (bars || inset > 0 || !ar);
|
|
1484
1493
|
root.style.setProperty('--nxu-stage-x', inset + 'px');
|
|
@@ -1788,7 +1797,8 @@ async function handle(m) {
|
|
|
1788
1797
|
const why = this._seeThrough(a.video, a.root);
|
|
1789
1798
|
if (why) { logDebug('Ambient light off for this player: ' + why, 'info'); this._stopAmbient(); this._ambientPaused = true; }
|
|
1790
1799
|
else { this._matchLayerZ(a.layer, a.root); this._clearBackdrops(a.video, a.root, a.cleared); }
|
|
1791
|
-
} else if (this._ambientPaused && this.ambientEnabled() && this.applied.video && this.applied.chain[0]?.root) {
|
|
1800
|
+
} else if (this._ambientPaused && this.ambientEnabled() && this.applied.video && this.applied.chain[0]?.root && Date.now() - (this._ambientTry || 0) > 2000) {
|
|
1801
|
+
this._ambientTry = Date.now();
|
|
1792
1802
|
// Turned off only while the site faded or covered its picture (loading,
|
|
1793
1803
|
// seeking): back on once the picture shows again, while the setting is on.
|
|
1794
1804
|
const v = this.applied.video, root = this.applied.chain[0].root;
|
|
@@ -2155,6 +2165,7 @@ async function handle(m) {
|
|
|
2155
2165
|
const sideways = this._cand !== 0;
|
|
2156
2166
|
this._apply(0);
|
|
2157
2167
|
this.manual = false;
|
|
2168
|
+
this.pinned = false;
|
|
2158
2169
|
this.autoCinema = false;
|
|
2159
2170
|
if (sideways) this.suppress = true;
|
|
2160
2171
|
}
|
|
@@ -2188,7 +2199,7 @@ async function handle(m) {
|
|
|
2188
2199
|
if (side) this._lastSide = side;
|
|
2189
2200
|
// Turned on with ↻: stays in landscape, but follows the phone to the other side
|
|
2190
2201
|
// (left or right edge down) instead of staying stuck on the first one.
|
|
2191
|
-
if (this.manual) { if (side && this.deg && side !== this.deg) this._apply(side); return; }
|
|
2202
|
+
if (this.manual) { if (side && this.deg && side !== this.deg && !this.pinned) this._apply(side); return; }
|
|
2192
2203
|
if (!side) {
|
|
2193
2204
|
this.suppress = false;
|
|
2194
2205
|
if (this.deg) this._leave();
|
|
@@ -2212,18 +2223,29 @@ async function handle(m) {
|
|
|
2212
2223
|
if (STATE.isCinema) CINEMA.set(false, { silent: true });
|
|
2213
2224
|
}
|
|
2214
2225
|
},
|
|
2215
|
-
// ↻ button:
|
|
2226
|
+
// ↻ button: each tap goes on — sideways one way (the side the phone was last held),
|
|
2227
|
+
// sideways the other way, upright again — so the picture can be watched with either
|
|
2228
|
+
// edge of the phone down. A side picked with the second tap stays (tilt does not flip it).
|
|
2216
2229
|
toggleManual() {
|
|
2217
2230
|
this.requestAccess(true);
|
|
2231
|
+
if (this.deg && this.manual && !this.pinned) {
|
|
2232
|
+
this.pinned = true;
|
|
2233
|
+
this._apply(-this.deg);
|
|
2234
|
+
showToast(t('rotateOther'));
|
|
2235
|
+
return;
|
|
2236
|
+
}
|
|
2218
2237
|
if (this.deg) {
|
|
2219
2238
|
this.manual = false;
|
|
2239
|
+
this.pinned = false;
|
|
2220
2240
|
if (this._cand) this.suppress = true;
|
|
2221
2241
|
this._leave();
|
|
2222
2242
|
return;
|
|
2223
2243
|
}
|
|
2224
2244
|
if (!STATE.isCinema) { CINEMA.set(true, { silent: true }); if (!STATE.isCinema) return; }
|
|
2225
2245
|
this.manual = true;
|
|
2246
|
+
this.pinned = false;
|
|
2226
2247
|
this._apply(this._cand || this._lastSide || 90);
|
|
2248
|
+
if (this._perm === 'granted') showToast(t('rotateOnce')); // (a refused motion prompt has its own notice)
|
|
2227
2249
|
},
|
|
2228
2250
|
_apply(deg) {
|
|
2229
2251
|
this.deg = deg;
|
|
@@ -2304,9 +2326,12 @@ async function handle(m) {
|
|
|
2304
2326
|
}
|
|
2305
2327
|
},
|
|
2306
2328
|
// What NexusSync is showing right now ('' = nothing).
|
|
2307
|
-
feed(text) {
|
|
2329
|
+
feed(text, rich = '') {
|
|
2308
2330
|
text = String(text || '').trim();
|
|
2309
|
-
|
|
2331
|
+
this._rich = text ? rich : '';
|
|
2332
|
+
const key = text + '\u0001' + this._rich;
|
|
2333
|
+
if (key === this._key && (!this.video || this._shown === text)) return;
|
|
2334
|
+
this._key = key;
|
|
2310
2335
|
this._text = text;
|
|
2311
2336
|
if (this.video) this._show(text);
|
|
2312
2337
|
else if (IS_TOP && SUB_LAYOUT.mirrorFrame?.isConnected) {
|
|
@@ -2314,7 +2339,7 @@ async function handle(m) {
|
|
|
2314
2339
|
FRAME.postToFrame(SUB_LAYOUT.mirrorFrame, { type: 'NXU_CAPTION', mode: text ? 'sub' : 'clear', text, original: '', color: '', size: Math.round(22 * (typeof SUBS !== 'undefined' ? SUBS.size() : 1)) });
|
|
2315
2340
|
}
|
|
2316
2341
|
},
|
|
2317
|
-
showOn(v, text) { if (v !== this.video) { if (this.video) this._leave(this.video); this.video = v; } this._text = String(text || '').trim(); this._show(this._text); },
|
|
2342
|
+
showOn(v, text) { if (v !== this.video) { if (this.video) this._leave(this.video); this.video = v; } this._text = String(text || '').trim(); this._rich = ''; this._show(this._text); },
|
|
2318
2343
|
_track(v) {
|
|
2319
2344
|
if (v._nxuFsTrack) return v._nxuFsTrack;
|
|
2320
2345
|
try { v._nxuFsTrack = v.addTextTrack('subtitles', 'NexusSync', (STORE.get('nxu_subtitle_language', '') || navigator.language || 'en').slice(0, 2)); } catch (_) { return null; }
|
|
@@ -2332,10 +2357,16 @@ async function handle(m) {
|
|
|
2332
2357
|
if (!text) return;
|
|
2333
2358
|
const Cue = window.VTTCue || window.TextTrackCue;
|
|
2334
2359
|
if (!Cue) return;
|
|
2360
|
+
if (this._rich && !document.getElementById('nxu-cue-colors')) {
|
|
2361
|
+
const st = document.createElement('style');
|
|
2362
|
+
st.id = 'nxu-cue-colors';
|
|
2363
|
+
st.textContent = SUBS.COLORS.map((c, i) => `video::cue(.nxl${i}) { color: ${c}; }`).join('\n');
|
|
2364
|
+
(document.head || document.documentElement).appendChild(st);
|
|
2365
|
+
}
|
|
2335
2366
|
try {
|
|
2336
2367
|
const at = Number.isFinite(v.currentTime) ? v.currentTime : 0;
|
|
2337
2368
|
// One cue that lasts until the text changes (replaced on every change).
|
|
2338
|
-
tr.addCue(new Cue(Math.max(0, at - 0.25), at + 6 * 3600, text));
|
|
2369
|
+
tr.addCue(new Cue(Math.max(0, at - 0.25), at + 6 * 3600, text === this._text && this._rich ? this._rich : text));
|
|
2339
2370
|
} catch (_) { }
|
|
2340
2371
|
},
|
|
2341
2372
|
_leave(v) {
|
|
@@ -2451,14 +2482,6 @@ async function handle(m) {
|
|
|
2451
2482
|
return code.split(/[-_]/)[0].toLowerCase();
|
|
2452
2483
|
}
|
|
2453
2484
|
|
|
2454
|
-
function defaultOutputLanguage() {
|
|
2455
|
-
for (const candidate of [...(navigator.languages || []), navigator.language]) {
|
|
2456
|
-
const base = baseLang(candidate);
|
|
2457
|
-
if (LANG_BY_CODE.has(base)) return base;
|
|
2458
|
-
}
|
|
2459
|
-
return 'en';
|
|
2460
|
-
}
|
|
2461
|
-
|
|
2462
2485
|
function mediaIsBuffering() {
|
|
2463
2486
|
const v = STATE.video;
|
|
2464
2487
|
if (v) return !v.paused && !v.ended && v.readyState < 3;
|
|
@@ -3042,6 +3065,44 @@ async function handle(m) {
|
|
|
3042
3065
|
}
|
|
3043
3066
|
} catch (_) { }
|
|
3044
3067
|
},
|
|
3068
|
+
// iPhone/iPad with Safari's own engine: a card says why the video is not heard and
|
|
3069
|
+
// fixes it in one tap (downloads the offline model, switches to it and restarts).
|
|
3070
|
+
_iosEngineCard() {
|
|
3071
|
+
const container = getContainer();
|
|
3072
|
+
if (!container || this._iosCard?.isConnected) return;
|
|
3073
|
+
const card = createEl('div', 'nx-ai-card');
|
|
3074
|
+
const text = createEl('div', 'nx-ai-card-text', t('subIosEngineCard'));
|
|
3075
|
+
const go = createEl('button', 'nx-ai-card-go', '⬇️ ' + t('subIosGetWhisper'), { type: 'button' });
|
|
3076
|
+
const x = createEl('button', 'nx-ai-card-x', '✕', { type: 'button', 'aria-label': t('talkClose') });
|
|
3077
|
+
const hide = () => { card.classList.remove('in'); setTimeout(() => card.remove(), 260); };
|
|
3078
|
+
['pointerdown', 'click', 'touchstart'].forEach(n => card.addEventListener(n, (ev) => ev.stopPropagation()));
|
|
3079
|
+
x.onclick = hide;
|
|
3080
|
+
go.onclick = async () => {
|
|
3081
|
+
if (go.disabled) return;
|
|
3082
|
+
go.disabled = true;
|
|
3083
|
+
go.textContent = '⬇️ 0%';
|
|
3084
|
+
try {
|
|
3085
|
+
await LOCAL_WHISPER.load('base', (f) => { go.textContent = '⬇️ ' + Math.round(f * 100) + '%'; });
|
|
3086
|
+
STORE.set('nxu_whisper_model', 'base');
|
|
3087
|
+
STORE.set('nxu_whisper_ready_base', true);
|
|
3088
|
+
STORE.set('nxu_asr_provider', 'local');
|
|
3089
|
+
STORE.set('nxu_audio_mode', 'media');
|
|
3090
|
+
logDebug('Offline Whisper downloaded from the iPhone card; switching to it.', 'success');
|
|
3091
|
+
showToast('✓ ' + t('whisperDone'));
|
|
3092
|
+
hide();
|
|
3093
|
+
this._issue = '';
|
|
3094
|
+
if (this.active) this.restart('whisper ready');
|
|
3095
|
+
} catch (err) {
|
|
3096
|
+
logDebug('Offline Whisper download failed: ' + (err?.message || err), 'error');
|
|
3097
|
+
text.textContent = t('subIosWhisperFailed');
|
|
3098
|
+
go.remove();
|
|
3099
|
+
}
|
|
3100
|
+
};
|
|
3101
|
+
card.append(text, go, x);
|
|
3102
|
+
container.appendChild(card);
|
|
3103
|
+
this._iosCard = card;
|
|
3104
|
+
requestAnimationFrame(() => card.classList.add('in'));
|
|
3105
|
+
},
|
|
3045
3106
|
_diag: { sound: 0, results: 0, err: '' },
|
|
3046
3107
|
_createRecognizer() {
|
|
3047
3108
|
const SR = window.SpeechRecognition || window.webkitSpeechRecognition;
|
|
@@ -3352,7 +3413,7 @@ async function handle(m) {
|
|
|
3352
3413
|
chip.classList.toggle('warn', silent);
|
|
3353
3414
|
chip.classList.toggle('warn', silent || !!this._issue);
|
|
3354
3415
|
if (this._issue) chip.classList.remove('hide');
|
|
3355
|
-
chip.querySelector('.sub-listen-text').textContent = this._issue === 'notrack' ? t('subIssueNoTrack') : this._issue === 'noresult' ? t('subIssueNoResult') : this._issue === 'net' ? t('subIssueNet') : silent ? t('subVideoSilent') : this.webMediaStream && !this._micMixed ? t('subHearVideo') : t('subHearMic');
|
|
3416
|
+
chip.querySelector('.sub-listen-text').textContent = this._issue === 'notrack' ? t('subIssueNoTrack') : this._issue === 'noresult' ? t('subIssueNoResult') : this._issue === 'net' ? t('subIssueNet') : this._issue === 'ios-echo' ? t('subIssueIos') : silent ? t('subVideoSilent') : this.webMediaStream && !this._micMixed ? t('subHearVideo') : t('subHearMic');
|
|
3356
3417
|
const level = Math.max(this._levels.media || 0, this._levels.mic || 0);
|
|
3357
3418
|
chip.querySelector('.sub-listen-meter i').style.width = Math.min(100, Math.round(level * 400)) + '%';
|
|
3358
3419
|
chip.querySelector('.sub-listen-btn').style.display = offer ? '' : 'none';
|
|
@@ -4195,6 +4256,7 @@ async function handle(m) {
|
|
|
4195
4256
|
return;
|
|
4196
4257
|
}
|
|
4197
4258
|
if (token !== this._startToken) return;
|
|
4259
|
+
CLOUD_ASR.boost = !this.webMediaStream; // listening through the microphone
|
|
4198
4260
|
if (this._cloud && !(this.audioContext && this.audioNodes?.mix && CLOUD_ASR.start(this.audioContext, this.audioNodes.mix))) {
|
|
4199
4261
|
this._cloud = false;
|
|
4200
4262
|
logDebug('AI Sub: cloud recognition needs an audio input here; using browser recognition.', 'warn');
|
|
@@ -4212,7 +4274,7 @@ async function handle(m) {
|
|
|
4212
4274
|
this._startedAt = Date.now();
|
|
4213
4275
|
// iPhone/iPad with Safari's own recognizer: it erases the phone's own speaker, so
|
|
4214
4276
|
// say once how to subtitle the video itself.
|
|
4215
|
-
if (this._isAppleMobile() && !this._cloud
|
|
4277
|
+
if (this._isAppleMobile() && !this._cloud) { this._issue = this._issue || 'ios-echo'; this._iosEngineCard(); }
|
|
4216
4278
|
try {
|
|
4217
4279
|
const s = this.mediaStream?.getAudioTracks()[0]?.getSettings?.();
|
|
4218
4280
|
if (s) logDebug(`AI Sub: microphone echo cancellation ${s.echoCancellation === false ? 'off' : s.echoCancellation ? 'on' : 'unknown'}.`, 'info');
|
|
@@ -4249,10 +4311,11 @@ async function handle(m) {
|
|
|
4249
4311
|
'microphone blocked by site: ' + (this._micBlockedByPolicy() ? 'YES' : 'no') + ' · permission: ' + (await this._micPermissionState()),
|
|
4250
4312
|
'recognition: ' + (this._cloud ? 'cloud ' + AI.asrModel() : (this._useWebSpeech ? this._sttProvider || 'web-speech' : '-')) + ' · state: ' + this.state,
|
|
4251
4313
|
'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),
|
|
4252
|
-
'video: ' + (v ? (v.paused ? 'paused' : 'playing') + (v.muted ? ', muted' : '') + ', volume ' + Math.round((v.volume || 0) * 100) + '%' : (STATE.cinemaIframe
|
|
4314
|
+
'video: ' + (v ? (v.paused ? 'paused' : 'playing') + (v.muted ? ', muted' : '') + ', volume ' + Math.round((v.volume || 0) * 100) + '%' : (STATE.cinemaIframe ? '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),
|
|
4253
4315
|
'levels: video ' + Math.round((this._levels?.media || 0) * 400) + ' · mic ' + Math.round((this._levels?.mic || 0) * 400),
|
|
4254
4316
|
'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),
|
|
4255
|
-
'
|
|
4317
|
+
...(this._cloud ? ['cloud/offline engine: pieces sent ' + CLOUD_ASR.diag.sent + ' · with words ' + CLOUD_ASR.diag.answered + ' · empty ' + CLOUD_ASR.diag.empty + ' · failed ' + CLOUD_ASR.diag.failed + (CLOUD_ASR.diag.lastErr ? ' (' + CLOUD_ASR.diag.lastErr + ')' : '') + ' · last answer took ' + (CLOUD_ASR.diag.lastMs / 1000).toFixed(1) + ' s' + (CLOUD_ASR.diag.lastText ? ' · last heard "' + CLOUD_ASR.diag.lastText + '"' : '') + ' · input gain ×' + (CLOUD_ASR.gain || 1).toFixed(1) + ' · level now ' + Math.round((CLOUD_ASR.level || 0) * 400)] : []),
|
|
4318
|
+
'issue: ' + (this._issue === 'ios-echo' ? 'ios-echo (Safari\'s engine removes the phone\'s own sound: use offline Whisper or Groq as the recognition engine)' : this._issue || '-') + ' · started with: ' + (this._feedFromMemory || 'video track') + ' · remembered for this browser: ' + (STORE.get(this._feedKey(), '') || '-') + ' · running ' + Math.round((Date.now() - (this._startedAt || Date.now())) / 1000) + ' s'
|
|
4256
4319
|
];
|
|
4257
4320
|
return lines.join('\n');
|
|
4258
4321
|
},
|
|
@@ -5109,6 +5172,7 @@ async function handle(m) {
|
|
|
5109
5172
|
_seq: 0, _next: 1, _results: new Map(), _inflight: new Set(), _failures: 0,
|
|
5110
5173
|
level: 0,
|
|
5111
5174
|
|
|
5175
|
+
boost: false, gain: 1, diag: { sent: 0, answered: 0, empty: 0, failed: 0, lastMs: 0, lastText: '' },
|
|
5112
5176
|
start(ctx, inputNode) {
|
|
5113
5177
|
this.stop();
|
|
5114
5178
|
if (!ctx || !inputNode || typeof ctx.createScriptProcessor !== 'function') return false;
|
|
@@ -5120,7 +5184,8 @@ async function handle(m) {
|
|
|
5120
5184
|
sink.connect(ctx.destination);
|
|
5121
5185
|
node.onaudioprocess = (e) => { if (this.active) this._onAudio(e.inputBuffer.getChannelData(0), ctx.sampleRate); };
|
|
5122
5186
|
Object.assign(this, { node, sink, input: inputNode, active: true, _pos: 0, _last: 0, _carry: new Float32Array(0), _pre: [], _seg: null, _speaking: false,
|
|
5123
|
-
_voicedRun: 0, _voiced: 0, _silence: 0, _floor: 0.004, _seq: 0, _next: 1, _failures: 0
|
|
5187
|
+
_voicedRun: 0, _voiced: 0, _silence: 0, _floor: 0.004, _seq: 0, _next: 1, _failures: 0, _peak: 0.02, gain: 1,
|
|
5188
|
+
diag: { sent: 0, answered: 0, empty: 0, failed: 0, lastMs: 0, lastText: '' } });
|
|
5124
5189
|
this._results.clear();
|
|
5125
5190
|
return true;
|
|
5126
5191
|
},
|
|
@@ -5159,12 +5224,26 @@ async function handle(m) {
|
|
|
5159
5224
|
}
|
|
5160
5225
|
this._carry = Float32Array.from(buffer.slice(offset));
|
|
5161
5226
|
},
|
|
5227
|
+
// Quiet input is brought up before the voice gate: a phone's microphone listening to its
|
|
5228
|
+
// own speaker (no gain control, no echo canceller) delivers the video at well under
|
|
5229
|
+
// the gate's level, so nothing was ever sent. The gain follows the loudest recent
|
|
5230
|
+
// sound (about 7 s memory); up to ×40 for a microphone, ×6 for the video's own track.
|
|
5231
|
+
_autoGain(frame, rms) {
|
|
5232
|
+
this._peak = Math.max(rms, (this._peak || 0.02) * 0.998);
|
|
5233
|
+
const want = Math.min(this.boost ? 40 : 6, Math.max(1, 0.08 / Math.max(this._peak, 1e-5)));
|
|
5234
|
+
this.gain = (this.gain || 1) * 0.9 + want * 0.1;
|
|
5235
|
+
if (this.gain < 1.05) return rms;
|
|
5236
|
+
const g = this.gain;
|
|
5237
|
+
for (let i = 0; i < frame.length; i++) { const x = frame[i] * g; frame[i] = x > 1 ? 1 : x < -1 ? -1 : x; }
|
|
5238
|
+
return Math.min(1, rms * g);
|
|
5239
|
+
},
|
|
5162
5240
|
_frame(frame) {
|
|
5163
5241
|
let sum = 0;
|
|
5164
5242
|
for (let i = 0; i < frame.length; i++) sum += frame[i] * frame[i];
|
|
5165
|
-
|
|
5243
|
+
let rms = Math.sqrt(sum / frame.length);
|
|
5166
5244
|
if (!Number.isFinite(rms)) return;
|
|
5167
5245
|
this.level = rms;
|
|
5246
|
+
rms = this._autoGain(frame, rms);
|
|
5168
5247
|
const threshold = Math.max(0.007, this._floor * 3 + 0.002);
|
|
5169
5248
|
if (!this._speaking) {
|
|
5170
5249
|
// Track background noise only while nobody speaks.
|
|
@@ -5230,6 +5309,8 @@ async function handle(m) {
|
|
|
5230
5309
|
this._inflight.add(ctrl);
|
|
5231
5310
|
const seconds = (frames.length * 0.02).toFixed(1);
|
|
5232
5311
|
let text = '';
|
|
5312
|
+
const diag = this.diag, began = Date.now();
|
|
5313
|
+
diag.sent++;
|
|
5233
5314
|
try {
|
|
5234
5315
|
if (AI.asrProvider() === 'local') {
|
|
5235
5316
|
const pcm = new Float32Array(frames.reduce((n, f) => n + f.length, 0));
|
|
@@ -5237,9 +5318,12 @@ async function handle(m) {
|
|
|
5237
5318
|
text = await LOCAL_WHISPER.transcribe(pcm, baseLang(TRANSLATOR._recognitionLanguage()));
|
|
5238
5319
|
} else text = await AI.transcribe(this._wav(frames), { lang: baseLang(TRANSLATOR._recognitionLanguage()), prompt: [glossaryTerms().join(', '), TRANSLATOR._cloudPrompt].filter(Boolean).join('. '), signal: ctrl.signal });
|
|
5239
5320
|
this._failures = 0;
|
|
5321
|
+
diag.lastMs = Date.now() - began;
|
|
5322
|
+
if (text) { diag.answered++; diag.lastText = text.slice(0, 40); } else diag.empty++;
|
|
5240
5323
|
} catch (err) {
|
|
5241
5324
|
if (err?.name === 'AbortError' || !this.active) return;
|
|
5242
5325
|
this._failures++;
|
|
5326
|
+
diag.failed++; diag.lastErr = String(err?.message || err).slice(0, 60);
|
|
5243
5327
|
logDebug(`AI Sub: cloud speech recognition failed (${err.message}${err.detail ? ': ' + err.detail : ''}).`, 'warn');
|
|
5244
5328
|
if (err.status === 401 || err.status === 403 || err.code === 'helper' || this._failures >= 4) TRANSLATOR.cloudAsrFailed(err);
|
|
5245
5329
|
} finally {
|
|
@@ -8111,7 +8195,8 @@ async function handle(m) {
|
|
|
8111
8195
|
// Playback: the same switch for every on/off choice
|
|
8112
8196
|
const play = section('🎬', t('setPlayback'));
|
|
8113
8197
|
const autoNext = switchRow(createEl('button', '', '', { type: 'button' }), '⏭ ' + t('setAutoNext'), () => NEXT_EP.enabled(), on => STORE.set('nxu_auto_next', on));
|
|
8114
|
-
|
|
8198
|
+
const resumeRow = switchRow(createEl('button', '', '', { type: 'button' }), '⏯ ' + t('setResume'), () => RESUME.enabled(), on => STORE.set('nxu_resume_on', on));
|
|
8199
|
+
play.append(parts.autoCinema, parts.adGuard, autoNext, resumeRow);
|
|
8115
8200
|
// Tools and this site
|
|
8116
8201
|
const adv = section('🔧', t('setAdvanced'));
|
|
8117
8202
|
const tools = createEl('div', 'nx-btn-row nx-tools');
|
|
@@ -8682,6 +8767,26 @@ async function handle(m) {
|
|
|
8682
8767
|
background:rgba(16,18,24,0.62); -webkit-backdrop-filter:blur(4px); backdrop-filter:blur(4px); box-shadow:0 12px 30px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.14) inset; color:#fff; text-shadow:0 1px 2px rgba(0,0,0,0.8);
|
|
8683
8768
|
opacity:0; transition:opacity 0.25s ease, transform 0.25s ease; pointer-events:auto; }
|
|
8684
8769
|
.nx-mode-card.in { opacity:1; transform:translate(-50%, 0); }
|
|
8770
|
+
.nexus-container.rot select { -webkit-appearance:none; appearance:none; line-height:1.35; padding-right:28px;
|
|
8771
|
+
background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 6px center; background-size:18px; }
|
|
8772
|
+
.nexus-container.rot input[type="range"]:not(.cc-range):not(.cc-volume) { -webkit-appearance:none; appearance:none; height:6px; border-radius:3px; background:rgba(255,255,255,0.28); outline:none; }
|
|
8773
|
+
.nexus-container.rot input[type="range"]:not(.cc-range):not(.cc-volume)::-webkit-slider-thumb { -webkit-appearance:none; appearance:none; width:22px; height:22px; border-radius:50%; background:#69f0ae; border:2px solid #0b0f14; }
|
|
8774
|
+
.nexus-container.rot input[type="checkbox"], .nexus-container.rot input[type="radio"] { -webkit-appearance:none; appearance:none; width:18px; height:18px; border-radius:4px; border:2px solid rgba(255,255,255,0.6); background:transparent; vertical-align:middle; }
|
|
8775
|
+
.nexus-container.rot input[type="radio"] { border-radius:50%; }
|
|
8776
|
+
.nexus-container.rot input[type="checkbox"]:checked, .nexus-container.rot input[type="radio"]:checked { background:#69f0ae; border-color:#69f0ae; }
|
|
8777
|
+
.nx-resume { position:absolute; left:calc(18px + env(safe-area-inset-left, 0px)); bottom:calc(120px + env(safe-area-inset-bottom, 0px)); z-index:2065; display:flex; align-items:center; gap:6px; padding:6px; border-radius:14px;
|
|
8778
|
+
background:rgba(16,18,24,0.62); -webkit-backdrop-filter:blur(4px); backdrop-filter:blur(4px); box-shadow:0 10px 28px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.14) inset;
|
|
8779
|
+
opacity:0; transform:translateY(12px); transition:opacity 0.25s ease, transform 0.25s ease; pointer-events:auto; }
|
|
8780
|
+
.nx-resume.in { opacity:1; transform:none; }
|
|
8781
|
+
.nx-ai-card { position:absolute; left:50%; top:calc(64px + env(safe-area-inset-top, 0px)); z-index:2066; width:min(92vw, 380px); box-sizing:border-box; display:grid; grid-template-columns:1fr auto; gap:8px 8px; padding:12px; border-radius:14px;
|
|
8782
|
+
background:rgba(16,18,24,0.9); color:#fff; box-shadow:0 10px 28px rgba(0,0,0,0.5), 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; }
|
|
8783
|
+
.nx-ai-card.in { opacity:1; transform:translate(-50%, 0); }
|
|
8784
|
+
.nx-ai-card-text { font-size:13px; line-height:1.45; grid-column:1; }
|
|
8785
|
+
.nx-ai-card-x { grid-column:2; grid-row:1; align-self:start; width:28px; height:28px; border:none; border-radius:50%; background:rgba(255,255,255,0.12); color:#fff; font-size:11px; cursor:pointer; }
|
|
8786
|
+
.nx-ai-card-go { grid-column:1 / -1; border:none; border-radius:10px; background:#69f0ae; color:#061009; font:800 14px/1 inherit; font-family:inherit; padding:12px 14px; cursor:pointer; }
|
|
8787
|
+
.nx-ai-card-go:disabled { opacity:0.8; }
|
|
8788
|
+
.nx-resume-go { border:none; border-radius:10px; background:#69f0ae; color:#061009; font:800 13px/1 inherit; font-family:inherit; padding:10px 14px; cursor:pointer; }
|
|
8789
|
+
.nx-resume-x { width:28px; height:28px; border:none; border-radius:50%; background:rgba(255,255,255,0.12); color:#fff; font-size:11px; cursor:pointer; }
|
|
8685
8790
|
.nx-mode-head { display:flex; align-items:center; gap:7px; font-weight:800; font-size:14px; padding-right:26px; }
|
|
8686
8791
|
.nx-mode-sub { margin-top:4px; font-size:12.5px; line-height:1.4; opacity:0.85; }
|
|
8687
8792
|
.nx-mode-row { display:flex; gap:7px; margin-top:9px; flex-wrap:wrap; }
|
|
@@ -9501,15 +9606,13 @@ async function handle(m) {
|
|
|
9501
9606
|
if (!video || video.readyState === 0) {
|
|
9502
9607
|
video = Array.from(document.querySelectorAll('video')).find(v => v.readyState > 0 && !v.paused) || video;
|
|
9503
9608
|
}
|
|
9609
|
+
// The video plays inside a frame: asked there (this page cannot reach it).
|
|
9610
|
+
const frame = STATE.cinemaIframe;
|
|
9611
|
+
if ((!video || video.readyState === 0) && frame) { FRAME.postToFrame(frame, { type: 'NXU_MEDIA_CMD', action: 'pip' }); return; }
|
|
9504
9612
|
if (!video || video.readyState === 0) { showToast(t('noPlayingVideo')); return; }
|
|
9505
|
-
|
|
9506
|
-
|
|
9507
|
-
|
|
9508
|
-
else if (video.webkitPresentationMode === 'picture-in-picture') video.webkitSetPresentationMode('inline');
|
|
9509
|
-
else if (typeof video.requestPictureInPicture === 'function') await video.requestPictureInPicture();
|
|
9510
|
-
else if (typeof video.webkitSetPresentationMode === 'function') video.webkitSetPresentationMode('picture-in-picture');
|
|
9511
|
-
else showToast(t('pipUnsupported'));
|
|
9512
|
-
} catch (_) { showToast(t('pipBlocked')); }
|
|
9613
|
+
const state = await PIP.toggle(video);
|
|
9614
|
+
if (state === 'unsupported') showToast(t('pipUnsupported'));
|
|
9615
|
+
else if (state === 'blocked') showToast(t('pipBlocked'));
|
|
9513
9616
|
};
|
|
9514
9617
|
btnDraw.onclick = () => {
|
|
9515
9618
|
clearUINotify(btnDraw);
|
|
@@ -10486,6 +10589,50 @@ async function handle(m) {
|
|
|
10486
10589
|
|
|
10487
10590
|
// ───────────────────────── Subtitles in cinema: the video's own tracks, a file, or
|
|
10488
10591
|
// OpenSubtitles — drawn by NexusSync in one consistent style, with timing and size.
|
|
10592
|
+
// The subtitles you picked from the video's own tracks are remembered per site, by name
|
|
10593
|
+
// ("Korean 2"), and picked again for the next episode or when the site rebuilds its player.
|
|
10594
|
+
// "Off" in the menu forgets them.
|
|
10595
|
+
const SUB_MEMORY = {
|
|
10596
|
+
key() { return 'nxu_sub_pick_' + HOST; },
|
|
10597
|
+
names() { const v = STORE.get(this.key(), null); return Array.isArray(v) ? v.filter(s => typeof s === 'string').slice(0, 3) : []; },
|
|
10598
|
+
save() { STORE.set(this.key(), SUBS.layers.filter(l => l.kind === 'track').map(l => l.label)); },
|
|
10599
|
+
clear() { STORE.set(this.key(), []); },
|
|
10600
|
+
_seen: new WeakSet(),
|
|
10601
|
+
watch(v) {
|
|
10602
|
+
if (!IS_TOP || !v?.textTracks) return;
|
|
10603
|
+
if (!this._seen.has(v)) {
|
|
10604
|
+
this._seen.add(v);
|
|
10605
|
+
const again = () => { if (v === STATE.video) { SUBS.prune(); this.restore(); } };
|
|
10606
|
+
try { v.textTracks.addEventListener('addtrack', again); v.textTracks.addEventListener('removetrack', again); } catch (_) { }
|
|
10607
|
+
v.addEventListener('loadstart', again);
|
|
10608
|
+
}
|
|
10609
|
+
SUBS.prune();
|
|
10610
|
+
this.restore();
|
|
10611
|
+
},
|
|
10612
|
+
restore() {
|
|
10613
|
+
const want = this.names();
|
|
10614
|
+
if (!want.length) return;
|
|
10615
|
+
clearTimeout(this._timer);
|
|
10616
|
+
let tries = 0;
|
|
10617
|
+
const run = () => {
|
|
10618
|
+
this._timer = 0;
|
|
10619
|
+
const v = STATE.video;
|
|
10620
|
+
if (!v) return;
|
|
10621
|
+
const missing = want.filter(n => !SUBS.layers.some(l => l.kind === 'track' && l.label === n));
|
|
10622
|
+
if (!missing.length) return;
|
|
10623
|
+
const picked = [];
|
|
10624
|
+
for (const n of missing) {
|
|
10625
|
+
const tr = SUBS.tracks().find(x => !SUBS.hasTrack(x) && SUBS.trackName(x) === n);
|
|
10626
|
+
if (tr && SUBS.layers.length < SUBS.MAX) { SUBS.useTrack(tr); picked.push(n); }
|
|
10627
|
+
}
|
|
10628
|
+
if (picked.length) { logDebug('Subtitles picked again: ' + picked.join(', '), 'info'); showToast(t('subRestored', { name: picked.join(', ') })); }
|
|
10629
|
+
// Tracks often appear a little after the video: look again for a few seconds.
|
|
10630
|
+
if (picked.length < missing.length && ++tries < 12) this._timer = setTimeout(run, 800);
|
|
10631
|
+
};
|
|
10632
|
+
this._timer = setTimeout(run, 400);
|
|
10633
|
+
}
|
|
10634
|
+
};
|
|
10635
|
+
|
|
10489
10636
|
const SUBS = {
|
|
10490
10637
|
// Up to three subtitle layers at once (e.g. Dutch + English + Korean for learning):
|
|
10491
10638
|
// each is a track of the page's video or a loaded file, drawn in its own colour.
|
|
@@ -10509,10 +10656,10 @@ async function handle(m) {
|
|
|
10509
10656
|
if (lang === code || lang.startsWith(code + '-') || lang.startsWith(code + '_')) return true;
|
|
10510
10657
|
const three = { ko: ['kor'], en: ['eng'], ja: ['jpn', 'jap'], zh: ['chi', 'zho'], es: ['spa'], fr: ['fre', 'fra'], de: ['ger', 'deu'], pt: ['por'], ru: ['rus'], it: ['ita'], vi: ['vie'], th: ['tha'], id: ['ind'] }[code] || [];
|
|
10511
10658
|
if (three.includes(lang)) return true;
|
|
10512
|
-
|
|
10513
|
-
|
|
10514
|
-
|
|
10515
|
-
|
|
10659
|
+
const names = (SUBS._langNames ||= {})[code] ||= (() => {
|
|
10660
|
+
try { return [new Intl.DisplayNames(['en'], { type: 'language' }).of(code), new Intl.DisplayNames([code], { type: 'language' }).of(code)].map(s => String(s).toLowerCase()); } catch (_) { return []; }
|
|
10661
|
+
})();
|
|
10662
|
+
return names.some(n => n && label.startsWith(n));
|
|
10516
10663
|
};
|
|
10517
10664
|
return is(want) ? 1 : want !== 'en' && is('en') ? 2 : 3;
|
|
10518
10665
|
},
|
|
@@ -10526,6 +10673,18 @@ async function handle(m) {
|
|
|
10526
10673
|
_drop(l) {
|
|
10527
10674
|
if (l.track) { try { l.track.removeEventListener('cuechange', this._onCue); l.track.mode = 'disabled'; } catch (_) { } }
|
|
10528
10675
|
},
|
|
10676
|
+
// Track layers of a video that is gone (next episode, the site rebuilt its player) show
|
|
10677
|
+
// nothing but still took one of the three places: they are dropped. File/search
|
|
10678
|
+
// subtitles stay.
|
|
10679
|
+
prune() {
|
|
10680
|
+
const live = new Set(this.tracks());
|
|
10681
|
+
const stale = this.layers.filter(l => l.kind === 'track' && !live.has(l.track));
|
|
10682
|
+
if (!stale.length) return false;
|
|
10683
|
+
stale.forEach(l => this._drop(l));
|
|
10684
|
+
this.layers = this.layers.filter(l => !stale.includes(l));
|
|
10685
|
+
if (!this.layers.length) this.off(); else this.tick(true);
|
|
10686
|
+
return true;
|
|
10687
|
+
},
|
|
10529
10688
|
off() {
|
|
10530
10689
|
this.layers.forEach(l => this._drop(l));
|
|
10531
10690
|
this.layers = [];
|
|
@@ -10576,7 +10735,8 @@ async function handle(m) {
|
|
|
10576
10735
|
_askSite(tr) {
|
|
10577
10736
|
const v = STATE.video;
|
|
10578
10737
|
if (!v || tr._nxuAsked) return;
|
|
10579
|
-
|
|
10738
|
+
// One at a time: two picks at once would open and close the site's menu over each other.
|
|
10739
|
+
const job = async () => {
|
|
10580
10740
|
if (!this.hasTrack(tr) || tr.cues?.length) return;
|
|
10581
10741
|
// A <track src> loads its own file: nothing to ask the site for.
|
|
10582
10742
|
if ([...v.querySelectorAll('track')].some(el => el.track === tr && el.src)) return;
|
|
@@ -10605,7 +10765,8 @@ async function handle(m) {
|
|
|
10605
10765
|
if (!this.hasTrack(tr)) return;
|
|
10606
10766
|
if (tr.cues?.length) { this.tick(true); logDebug(`Subtitles: "${label}" loaded through the site's own menu.`, 'info'); }
|
|
10607
10767
|
else showToast(t('subSiteOnly'));
|
|
10608
|
-
}
|
|
10768
|
+
};
|
|
10769
|
+
setTimeout(() => { this._askQ = (this._askQ || Promise.resolve()).then(job).catch(() => { }); }, 1500);
|
|
10609
10770
|
},
|
|
10610
10771
|
useCues(cues, label) { this._add({ kind: 'cues', cues: cues.sort((a, b) => a.s - b.s), label }); },
|
|
10611
10772
|
_loop() { clearInterval(this._timer); this._timer = setInterval(() => this.tick(), 150); this.tick(true); },
|
|
@@ -10642,7 +10803,10 @@ async function handle(m) {
|
|
|
10642
10803
|
if (!force && sig === this._last && this._box?.isConnected) return;
|
|
10643
10804
|
this._last = sig;
|
|
10644
10805
|
const any = groups.some(g => g.text);
|
|
10645
|
-
|
|
10806
|
+
const shown = groups.filter(g => g.text).map(g => ({ c: g.c, lines: g.text.split('\n').filter(Boolean).slice(0, 3) }));
|
|
10807
|
+
// In the video's own fullscreen each subtitle keeps its colour too (WebVTT classes).
|
|
10808
|
+
const esc = (s) => s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
|
|
10809
|
+
FS_SUBS.feed(shown.map(g => g.lines.join('\n')).join('\n'), this.layers.length > 1 ? shown.map(g => g.lines.map(l => `<c.nxl${g.c}>${esc(l)}</c>`).join('\n')).join('\n') : '');
|
|
10646
10810
|
const box = any ? this._ensureBox() : this._box;
|
|
10647
10811
|
if (!box) return;
|
|
10648
10812
|
const kids = [];
|
|
@@ -11193,6 +11357,76 @@ async function handle(m) {
|
|
|
11193
11357
|
} catch (_) { }
|
|
11194
11358
|
}, 1200);
|
|
11195
11359
|
|
|
11360
|
+
// ───────────────────────── Continue watching
|
|
11361
|
+
// Where you stopped in a long video (5 min+) is kept per page, and when you open that page
|
|
11362
|
+
// again on your own (not in a room) a small card offers to continue from there — only an
|
|
11363
|
+
// offer, nothing is skipped by itself, and not when the site already continued for you.
|
|
11364
|
+
// Kept for the last 80 videos; finished videos are forgotten.
|
|
11365
|
+
const RESUME = {
|
|
11366
|
+
KEY: 'nxu_resume', MAX: 80,
|
|
11367
|
+
enabled() { return STORE.get('nxu_resume_on', true) !== false; },
|
|
11368
|
+
_key() {
|
|
11369
|
+
const q = location.search.replace(/([?&])(utm_[^&]*|fbclid=[^&]*|gclid=[^&]*|t=\d+[^&]*|start=\d+)(&|$)/g, (m, a, b, c) => (c ? a : '')).replace(/[?&]$/, '');
|
|
11370
|
+
return (location.origin + location.pathname + q).slice(0, 300);
|
|
11371
|
+
},
|
|
11372
|
+
_all() { const m = STORE.get(this.KEY, null); return m && typeof m === 'object' && !Array.isArray(m) ? m : {}; },
|
|
11373
|
+
save(v) {
|
|
11374
|
+
if (!v || !this.enabled()) return;
|
|
11375
|
+
const d = v.duration, tm = v.currentTime;
|
|
11376
|
+
if (!Number.isFinite(d) || d < 300 || !Number.isFinite(tm)) return;
|
|
11377
|
+
const k = this._key(), m = this._all();
|
|
11378
|
+
if (tm < 60) return; // just started (or started over): what was kept stays
|
|
11379
|
+
if (d - tm < Math.max(90, d * 0.04)) { if (!(k in m)) return; delete m[k]; }
|
|
11380
|
+
else {
|
|
11381
|
+
const prev = m[k];
|
|
11382
|
+
if (prev && Math.abs(prev.t - tm) < 5) return;
|
|
11383
|
+
m[k] = { t: Math.floor(tm), d: Math.round(d), at: Date.now() };
|
|
11384
|
+
const keys = Object.keys(m);
|
|
11385
|
+
if (keys.length > this.MAX) keys.sort((a, b) => (m[a].at || 0) - (m[b].at || 0)).slice(0, keys.length - this.MAX).forEach(x => delete m[x]);
|
|
11386
|
+
}
|
|
11387
|
+
STORE.set(this.KEY, m);
|
|
11388
|
+
},
|
|
11389
|
+
_seen: new WeakSet(),
|
|
11390
|
+
watch(v) {
|
|
11391
|
+
if (!IS_TOP || !v || this._seen.has(v)) return;
|
|
11392
|
+
this._seen.add(v);
|
|
11393
|
+
let last = 0;
|
|
11394
|
+
const tick = () => { if (v !== STATE.video || v.paused) return; const now = Date.now(); if (now - last > 15000) { last = now; this.save(v); } };
|
|
11395
|
+
v.addEventListener('timeupdate', tick);
|
|
11396
|
+
v.addEventListener('pause', () => { if (v === STATE.video) this.save(v); });
|
|
11397
|
+
v.addEventListener('ended', () => { if (v === STATE.video) { const m = this._all(); const k = this._key(); if (k in m) { delete m[k]; STORE.set(this.KEY, m); } } });
|
|
11398
|
+
const offer = () => setTimeout(() => this._offer(v), 1200);
|
|
11399
|
+
if (v.readyState >= 1) offer(); else v.addEventListener('loadedmetadata', offer, { once: true });
|
|
11400
|
+
},
|
|
11401
|
+
_offer(v) {
|
|
11402
|
+
if (v !== STATE.video || !this.enabled() || STATE.handshakeVerified || this._offeredFor === this._key()) return;
|
|
11403
|
+
const e = this._all()[this._key()];
|
|
11404
|
+
if (!e || !Number.isFinite(v.duration) || Math.abs(e.d - v.duration) > 5 || e.t < 60 || v.currentTime > 15) return;
|
|
11405
|
+
const container = getContainer();
|
|
11406
|
+
if (!container) { if ((this._wait = (this._wait || 0) + 1) < 8) setTimeout(() => this._offer(v), 1000); return; }
|
|
11407
|
+
this._offeredFor = this._key();
|
|
11408
|
+
logDebug(`Continue watching: offered from ${formatTime(e.t)}.`, 'info');
|
|
11409
|
+
this._card?.remove();
|
|
11410
|
+
const card = createEl('div', 'nx-resume');
|
|
11411
|
+
const go = createEl('button', 'nx-resume-go', '⏯ ' + t('resumeFrom', { time: formatTime(e.t) }), { type: 'button' });
|
|
11412
|
+
const x = createEl('button', 'nx-resume-x', '✕', { type: 'button', 'aria-label': t('talkClose') });
|
|
11413
|
+
const hide = () => { clearTimeout(this._timer); card.classList.remove('in'); setTimeout(() => card.remove(), 260); if (this._card === card) this._card = null; };
|
|
11414
|
+
go.onclick = (ev) => { ev.stopPropagation(); MEDIA_SAFE.seek(v, e.t); if (v.paused) MEDIA_SAFE.play(v); hide(); };
|
|
11415
|
+
x.onclick = (ev) => { ev.stopPropagation(); hide(); };
|
|
11416
|
+
['pointerdown', 'click', 'touchstart'].forEach(ev => card.addEventListener(ev, (evt) => evt.stopPropagation()));
|
|
11417
|
+
card.append(go, x);
|
|
11418
|
+
container.appendChild(card);
|
|
11419
|
+
this._card = card;
|
|
11420
|
+
requestAnimationFrame(() => card.classList.add('in'));
|
|
11421
|
+
this._timer = setTimeout(hide, 12000);
|
|
11422
|
+
// Playing on past the start (or the site jumping there itself): no longer needed.
|
|
11423
|
+
const watch = () => { if (v.currentTime > 30 || STATE.handshakeVerified) { v.removeEventListener('timeupdate', watch); hide(); } };
|
|
11424
|
+
v.addEventListener('timeupdate', watch);
|
|
11425
|
+
}
|
|
11426
|
+
};
|
|
11427
|
+
window.addEventListener('pagehide', () => { try { if (STATE.video) RESUME.save(STATE.video); } catch (_) { } });
|
|
11428
|
+
document.addEventListener('visibilitychange', () => { try { if (document.hidden && STATE.video) RESUME.save(STATE.video); } catch (_) { } });
|
|
11429
|
+
|
|
11196
11430
|
// ───────────────────────── Next episode
|
|
11197
11431
|
// On series pages (drama/anime sites) the page usually has a "next episode" link or
|
|
11198
11432
|
// button. Near the end of an episode in cinema mode a small card offers it, and when the
|
|
@@ -12019,7 +12253,7 @@ async function handle(m) {
|
|
|
12019
12253
|
const PRESS_COLORS = { '😂': '#ffd54f', '😭': '#82b1ff', '😡': '#ff5252', '💦': '#4fc3f7', '🍪': '#d7a86e', '☕': '#bcaaa4', '😘': '#ff6fae', '🖕': '#ffb74d' };
|
|
12020
12254
|
function pressFx(btn, emoji) {
|
|
12021
12255
|
if (!btn) return;
|
|
12022
|
-
btn.style.setProperty('--pop', '#69f0ae');
|
|
12256
|
+
btn.style.setProperty('--pop', PRESS_COLORS[emoji] || '#69f0ae');
|
|
12023
12257
|
btn.classList.remove('pop');
|
|
12024
12258
|
void btn.offsetWidth;
|
|
12025
12259
|
btn.classList.add('pop');
|
|
@@ -12472,6 +12706,57 @@ async function handle(m) {
|
|
|
12472
12706
|
}
|
|
12473
12707
|
};
|
|
12474
12708
|
|
|
12709
|
+
// Picture-in-picture for the video of this document. Returns 'on' | 'off' | 'blocked' |
|
|
12710
|
+
// 'unsupported'. iPhone/iPad use WebKit's presentation mode first (the long-standing way
|
|
12711
|
+
// there); it never throws, so the result is read back a moment later.
|
|
12712
|
+
const PIP = {
|
|
12713
|
+
supported(v) { return !!v && (typeof v.requestPictureInPicture === 'function' || typeof v.webkitSetPresentationMode === 'function'); },
|
|
12714
|
+
active(v) { return !!v && (document.pictureInPictureElement === v || v.webkitPresentationMode === 'picture-in-picture'); },
|
|
12715
|
+
async toggle(v) {
|
|
12716
|
+
if (!v || v.readyState === 0) return 'unsupported';
|
|
12717
|
+
try { v.removeAttribute('disablepictureinpicture'); v.disablePictureInPicture = false; } catch (_) { }
|
|
12718
|
+
try {
|
|
12719
|
+
if (document.pictureInPictureElement) { await document.exitPictureInPicture(); return 'off'; }
|
|
12720
|
+
if (v.webkitPresentationMode === 'picture-in-picture') { v.webkitSetPresentationMode('inline'); return 'off'; }
|
|
12721
|
+
const webkit = typeof v.webkitSetPresentationMode === 'function' && (typeof v.webkitSupportsPresentationMode !== 'function' || v.webkitSupportsPresentationMode('picture-in-picture'));
|
|
12722
|
+
if (webkit && (IS_IOS || typeof v.requestPictureInPicture !== 'function')) {
|
|
12723
|
+
v.webkitSetPresentationMode('picture-in-picture');
|
|
12724
|
+
await new Promise(r => setTimeout(r, 700));
|
|
12725
|
+
return v.webkitPresentationMode === 'picture-in-picture' ? 'on' : 'blocked';
|
|
12726
|
+
}
|
|
12727
|
+
if (typeof v.requestPictureInPicture === 'function') { await v.requestPictureInPicture(); return 'on'; }
|
|
12728
|
+
return 'unsupported';
|
|
12729
|
+
} catch (err) {
|
|
12730
|
+
return err?.name === 'NotSupportedError' ? 'unsupported' : 'blocked';
|
|
12731
|
+
}
|
|
12732
|
+
},
|
|
12733
|
+
// Inside a frame the request arrives as a message, which browsers may not count as
|
|
12734
|
+
// your tap: then the next tap on the video itself opens the small window.
|
|
12735
|
+
_disarm: null,
|
|
12736
|
+
arm(v) {
|
|
12737
|
+
this._disarm?.();
|
|
12738
|
+
let done = false;
|
|
12739
|
+
const go = () => { if (done) return; off(); this.toggle(v).then(s => FRAME.postToParent({ type: 'NXU_PIP_STATE', state: s })); };
|
|
12740
|
+
const off = () => { done = true; clearTimeout(timer); ['click', 'touchend', 'pointerup'].forEach(n => window.removeEventListener(n, go, true)); this._disarm = null; };
|
|
12741
|
+
['click', 'touchend', 'pointerup'].forEach(n => window.addEventListener(n, go, true));
|
|
12742
|
+
const timer = setTimeout(off, 10000);
|
|
12743
|
+
this._disarm = off;
|
|
12744
|
+
},
|
|
12745
|
+
// Top page: the result of a request sent into a frame.
|
|
12746
|
+
onFrameState(state) {
|
|
12747
|
+
const g = CINEMA_UI.els?.gesture;
|
|
12748
|
+
clearTimeout(this._passTimer);
|
|
12749
|
+
if (g) g.style.pointerEvents = '';
|
|
12750
|
+
CINEMA_UI.els?.pipBtn?.classList.toggle('on', state === 'on');
|
|
12751
|
+
if (state === 'armed') {
|
|
12752
|
+
// Let the next tap through to the video in the frame (for ten seconds).
|
|
12753
|
+
if (g) { g.style.pointerEvents = 'none'; this._passTimer = setTimeout(() => { g.style.pointerEvents = ''; }, 10000); }
|
|
12754
|
+
showToast(t('pipTapVideo'));
|
|
12755
|
+
} else if (state === 'unsupported') showToast(t('pipUnsupported'));
|
|
12756
|
+
else if (state === 'blocked') showToast(t('pipBlocked'));
|
|
12757
|
+
}
|
|
12758
|
+
};
|
|
12759
|
+
|
|
12475
12760
|
// Applies a media command inside a frame (or forwards it further down).
|
|
12476
12761
|
function applyMediaCommand(action, value) {
|
|
12477
12762
|
STATE._lastUserGestureTs = Date.now();
|
|
@@ -12486,6 +12771,12 @@ async function handle(m) {
|
|
|
12486
12771
|
case 'seekBy': MEDIA_SAFE.seek(v, Math.max(0, v.currentTime + value)); break;
|
|
12487
12772
|
case 'volume': v.volume = Math.max(0, Math.min(1, value)); v.muted = value === 0; break;
|
|
12488
12773
|
case 'mute': v.muted = !v.muted; break;
|
|
12774
|
+
case 'pip':
|
|
12775
|
+
PIP.toggle(v).then(s => {
|
|
12776
|
+
if (s === 'blocked' && !PIP.active(v)) { PIP.arm(v); s = 'armed'; }
|
|
12777
|
+
FRAME.postToParent({ type: 'NXU_PIP_STATE', state: s });
|
|
12778
|
+
});
|
|
12779
|
+
break;
|
|
12489
12780
|
}
|
|
12490
12781
|
}
|
|
12491
12782
|
|
|
@@ -12535,7 +12826,8 @@ async function handle(m) {
|
|
|
12535
12826
|
volLow: 'M18.5 12A4.5 4.5 0 0 0 16 7.97v8.05A4.47 4.47 0 0 0 18.5 12zM5 9v6h4l5 5V4L9 9H5z',
|
|
12536
12827
|
volOff: 'M16.5 12A4.5 4.5 0 0 0 14 7.97v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51A8.8 8.8 0 0 0 21 12a9 9 0 0 0-7-8.77v2.06A7 7 0 0 1 19 12zM4.27 3 3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25A7 7 0 0 1 14 18.7v2.06a9 9 0 0 0 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4 9.91 6.09 12 8.18V4z',
|
|
12537
12828
|
cc: 'M19 4H5a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2zm-8 7H9.5v-.5h-2v3h2V13H11v1a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1v-4a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v1zm7 0h-1.5v-.5h-2v3h2V13H18v1a1 1 0 0 1-1 1h-3a1 1 0 0 1-1-1v-4a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v1z',
|
|
12538
|
-
|
|
12829
|
+
// A screen with light around it (the sun is the picture/brightness button).
|
|
12830
|
+
ambient: 'M8 9h8v6H8V9zM6 7v10h12V7H6zM11 2h2v3h-2V2zM11 19h2v3h-2v-3zM2 11h3v2H2v-2zM19 11h3v2h-3v-2zM4.2 5.6l1.4-1.4 2.1 2.1-1.4 1.4-2.1-2.1zM16.3 17.7l1.4-1.4 2.1 2.1-1.4 1.4-2.1-2.1zM4.2 18.4l2.1-2.1 1.4 1.4-2.1 2.1-1.4-1.4zM16.3 6.3l2.1-2.1 1.4 1.4-2.1 2.1-1.4-1.4z',
|
|
12539
12831
|
pip: 'M19 11h-8v6h8v-6zm4 8V4.98C23 3.88 22.1 3 21 3H3c-1.1 0-2 .88-2 1.98V19c0 1.1.9 2 2 2h18c1.1 0 2-.9 2-2zm-2 .02H3V4.97h18v14.05z',
|
|
12540
12832
|
fullscreen: 'M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z',
|
|
12541
12833
|
fullscreenExit: 'M5 16h3v3h2v-5H5v2zm3-8H5v2h5V5H8v3zm6 11h2v-3h3v-2h-5v5zm2-11V5h-2v5h5V8h-3z',
|
|
@@ -12543,7 +12835,7 @@ async function handle(m) {
|
|
|
12543
12835
|
fitCover: 'M3 5v4h2V5h4V3H5a2 2 0 0 0-2 2zm2 10H3v4a2 2 0 0 0 2 2h4v-2H5v-4zm14 4h-4v2h4a2 2 0 0 0 2-2v-4h-2v4zm0-16h-4v2h4v4h2V5a2 2 0 0 0-2-2zM7 7h10v10H7z',
|
|
12544
12836
|
close: 'M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z',
|
|
12545
12837
|
rotate: 'M16.48 2.52c3.27 1.55 5.61 4.72 5.97 8.48h1.5C23.44 4.84 18.29 0 12 0l-.66.03 3.81 3.81 1.33-1.32zm-6.25-.77a1.49 1.49 0 0 0-2.12 0L1.75 8.11a1.49 1.49 0 0 0 0 2.12l12.02 12.02c.59.59 1.54.59 2.12 0l6.36-6.36c.59-.59.59-1.54 0-2.12L10.23 1.75zm4.6 19.44L2.81 9.17l6.36-6.36 12.02 12.02-6.36 6.36zm-7.31.29A10.49 10.49 0 0 1 1.55 13H.05C.56 19.16 5.71 24 12 24l.66-.03-3.81-3.81-1.33 1.32z',
|
|
12546
|
-
view: '
|
|
12838
|
+
view: 'M12 7a5 5 0 1 0 0 10 5 5 0 0 0 0-10zM2 13h2a1 1 0 0 0 0-2H2a1 1 0 0 0 0 2zm18 0h2a1 1 0 0 0 0-2h-2a1 1 0 0 0 0 2zM11 2v2a1 1 0 0 0 2 0V2a1 1 0 0 0-2 0zm0 18v2a1 1 0 0 0 2 0v-2a1 1 0 0 0-2 0zM5.99 4.58a1 1 0 0 0-1.41 1.41l1.06 1.06a1 1 0 0 0 1.41-1.41L5.99 4.58zm12.37 12.37a1 1 0 0 0-1.41 1.41l1.06 1.06a1 1 0 0 0 1.41-1.41l-1.06-1.06zm1.06-10.96a1 1 0 0 0-1.41-1.41l-1.06 1.06a1 1 0 0 0 1.41 1.41l1.06-1.06zM7.05 18.36a1 1 0 0 0-1.41-1.41l-1.06 1.06a1 1 0 0 0 1.41 1.41l1.06-1.06z',
|
|
12547
12839
|
tune: 'M3 17v2h6v-2H3zM3 5v2h10V5H3zm10 16v-2h8v-2h-8v-2h-2v6h2zM7 9v2H3v2h4v2h2V9H7zm14 4v-2H11v2h10zm-6-4h2V7h4V5h-4V3h-2v6z',
|
|
12548
12840
|
film: 'M18 3v2h-2V3H8v2H6V3H4v18h2v-2h2v2h8v-2h2v2h2V3h-2zM8 17H6v-2h2v2zm0-4H6v-2h2v2zm0-4H6V7h2v2zm10 8h-2v-2h2v2zm0-4h-2v-2h2v2zm0-4h-2V7h2v2z',
|
|
12549
12841
|
keyboard: 'M20 5H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2zm-9 3h2v2h-2V8zm0 3h2v2h-2v-2zM8 8h2v2H8V8zm0 3h2v2H8v-2zm-1 2H5v-2h2v2zm0-3H5V8h2v2zm9 7H8v-2h8v2zm0-4h-2v-2h2v2zm0-3h-2V8h2v2zm3 3h-2v-2h2v2zm0-3h-2V8h2v2z'
|
|
@@ -13021,7 +13313,7 @@ async function handle(m) {
|
|
|
13021
13313
|
const tracks = SUBS.tracks();
|
|
13022
13314
|
const nothing = !SUBS.active() && !TRANSLATOR.active && !DOM_SUBS._src;
|
|
13023
13315
|
const kids = [createEl('div', 'cc-menu-title', t('subMenu')),
|
|
13024
|
-
item(t('xsubOff'), nothing, () => { SUBS.off(); if (TRANSLATOR.active) TRANSLATOR.stop(t('subOff')); this.toggleSubMenu(false); })];
|
|
13316
|
+
item(t('xsubOff'), nothing, () => { SUBS.off(); SUB_MEMORY.clear(); if (TRANSLATOR.active) TRANSLATOR.stop(t('subOff')); this.toggleSubMenu(false); })];
|
|
13025
13317
|
// Several can be on at once (up to three): tap to add, tap again to take away.
|
|
13026
13318
|
const name = (tr, i) => tr.label || tr.language || t('subTrack') + ' ' + (i + 1);
|
|
13027
13319
|
const seen = {}, total = {};
|
|
@@ -13035,7 +13327,7 @@ async function handle(m) {
|
|
|
13035
13327
|
shown.forEach(r => {
|
|
13036
13328
|
const layer = SUBS.layers.find(l => l.track === r.tr);
|
|
13037
13329
|
const b = layer ? swatch(layer, r.label, '🎞') : item('🎞 ' + r.label, false, () => { });
|
|
13038
|
-
b.onclick = (ev) => { ev.stopPropagation(); SUBS.useTrack(r.tr); this.toggleSubMenu(true); };
|
|
13330
|
+
b.onclick = (ev) => { ev.stopPropagation(); SUBS.useTrack(r.tr); SUB_MEMORY.save(); this.toggleSubMenu(true); };
|
|
13039
13331
|
kids.push(b);
|
|
13040
13332
|
});
|
|
13041
13333
|
if (fold && shown.length < rows.length) kids.push(item(t('subMoreLangs', { n: rows.length - shown.length }), false, () => { this._subAll = true; this.toggleSubMenu(true); }));
|
|
@@ -13224,7 +13516,7 @@ async function handle(m) {
|
|
|
13224
13516
|
this.els.rotateBtn.classList.toggle('on', !!ROTATE.deg);
|
|
13225
13517
|
this.els.fsBtn.style.display = fullscreenSupported() ? '' : 'none';
|
|
13226
13518
|
this.els.volume.style.display = IS_IOS ? 'none' : '';
|
|
13227
|
-
this.els.pipBtn.style.display = STATE.video
|
|
13519
|
+
this.els.pipBtn.style.display = (STATE.video ? PIP.supported(STATE.video) : !!STATE.cinemaIframe) ? '' : 'none';
|
|
13228
13520
|
const msTitle = !MEDIA_SESSION._owned && navigator.mediaSession?.metadata?.title;
|
|
13229
13521
|
this.els.title.textContent = msTitle || document.title || HOST;
|
|
13230
13522
|
this._barAt = 0;
|
|
@@ -13259,7 +13551,7 @@ async function handle(m) {
|
|
|
13259
13551
|
e.rateBtn.classList.toggle('on', Math.abs(rate - 1) > 0.01);
|
|
13260
13552
|
e.subBtn.classList.toggle('on', TRANSLATOR.state !== 'idle' || SUBS.active());
|
|
13261
13553
|
e.viewBtn?.classList.toggle('on', Math.abs(BRIGHTNESS.level - 1) > 0.01);
|
|
13262
|
-
e.pipBtn.classList.toggle('on',
|
|
13554
|
+
if (STATE.video) e.pipBtn.classList.toggle('on', PIP.active(STATE.video));
|
|
13263
13555
|
e.fsBtn.classList.toggle('on', fullscreenActive());
|
|
13264
13556
|
[e.rateBtn, e.subBtn, e.viewBtn, e.ambientBtn, e.fitBtn, e.pipBtn, e.fsBtn, this.els.rotateBtn].forEach(b => b && b.setAttribute('aria-pressed', String(b.classList.contains('on'))));
|
|
13265
13557
|
const canStyle = info.kind === 'video' || !!STATE.cinemaIframe;
|
|
@@ -13815,6 +14107,7 @@ async function handle(m) {
|
|
|
13815
14107
|
if (!IS_TOP) this._hookBridgeVideo(nextVideo);
|
|
13816
14108
|
if (STATE.isCinema) keepInline(nextVideo);
|
|
13817
14109
|
if (STATE.handshakeVerified) attachVideoHooks();
|
|
14110
|
+
if (IS_TOP) { try { SUB_MEMORY.watch(nextVideo); } catch (_) { } try { RESUME.watch(nextVideo); } catch (_) { } }
|
|
13818
14111
|
} else if (nextFrame) {
|
|
13819
14112
|
logDebug('Media: player inside embedded frame ' + String(nextFrame.src || '').slice(0, 60), 'success');
|
|
13820
14113
|
} else {
|
|
@@ -14037,6 +14330,10 @@ async function handle(m) {
|
|
|
14037
14330
|
if (data.event === 'play' || data.event === 'pause') this.scheduleScan(60);
|
|
14038
14331
|
break;
|
|
14039
14332
|
}
|
|
14333
|
+
case 'NXU_PIP_STATE':
|
|
14334
|
+
if (!isTarget) break;
|
|
14335
|
+
if (!IS_TOP) FRAME.postToParent(data); else PIP.onFrameState(data.state);
|
|
14336
|
+
break;
|
|
14040
14337
|
case 'NXU_FULLSCREEN_STATE':
|
|
14041
14338
|
case 'NXU_HOTKEY':
|
|
14042
14339
|
case 'NXU_CINEMA_EXIT_REQ':
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kangsicj/nexussync",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.15",
|
|
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",
|