Skip to content
All work

WayinVideo · walkthrough

Save 99% of your time on long videos.

00:00 / 10:30

WayinVideo: A Chrome extension that summarises YouTube and Bilibili videos, with clickable timestamps and chat about what's on screen.

WayinVideo

Browser extension · AI video

Chrome Web Store
Video sites
2 video sites
UI languages
90+ uI languages
Tracked events
49 tracked events
Build targets
3 build targets
When
2024

Wayin AI · Chrome extension, Manifest V3

The UI lives inside YouTube's and Bilibili's own single-page apps, so most of the work is getting in, staying in, and passing messages between Chrome's extension contexts.

…more
  • Video summary

    A summary and highlights in one request, editable in place.

  • Smart timestamps

    Every highlight and sub-point seeks the player; a slider scrubs within the range.

  • Screenshot and ask

    Crop any part of the tab and ask about it.

  • AI chat with history

    Per-video conversations, resumable from history, with answer feedback.

  • Share

    As a rendered image or a hosted link.

  • Accounts

    Email code or Google sign-in, synced with the browser profile.

  • #ChromeExtensions
  • #Serviceworker
  • #Contentscripts
  • #React
  • #TypeScript
  • #AntDesign
  • #Vite
  • #html2canvas
  • #i18next
  • #Mixpanel
00:00

Getting into a page it doesn't own

The host page renders late and changes video without reloading, so mounting is retried, not awaited: each attempt checks for its own element id first, and on every URL change (tabs.onUpdated) the worker tells the tab to mount again. Ant Design runs under a wayin class prefix to avoid CSS clashes.

  1. 1DrawerOpened from the toolbar icon, over the right of the page.
  2. 2Inline panelIn YouTube's sidebar, or under Bilibili's uploader card.
  3. 3Player buttonA “Wayin AI” button in the like/share row.

When it mounts

  1. script load
  2. DOMContentLoaded
  3. +1 s
  4. +3 s
  5. on update-url
01:50

One message bus

The content script owns the UI and the video; the service worker owns the network, tabs and screenshots. Between them is only JSON messages.

Who is allowed to do what

Requests go down as JSON messages; seeks, captured frames and sign-ins come back up (dashed).

A content script’s fetch runs as youtube.com and hits CORS; the worker doesn’t. The catch: sendMessage carries only JSON, so screenshots cross as base64 and become a Blob in the worker.

04:10

A timestamp is a seek

One highlight, as the API returns it

{
  "start": "250000",
  "end":   "380000",
  "desc":  "A timestamp is a seek",
  "events": [
    { "timestamp": "262000", "desc": "Highlights arrive in milliseconds" },
    { "timestamp": "302000", "desc": "The round trip through the worker" }
  ]
}

What a click does

  1. 1PanelMath.round(ms / 1000), then sendMessage change-video-time
  2. 2Service workerfinds the active tab, forwards the same message to it
  3. 3Content scriptfinds .html5-main-video, or else the first <video>
  4. 4VideocurrentTime = seconds; on Bilibili the progress bar is forced visible

No player API, so one line seeks on both sites. The slider clamps with min/max, since a range can arrive reversed.

06:20

Signing in from someone else's tab

An extension has no redirect page on the API’s domain, so the worker opens Google sign-in in a popup and watches its URL.

Google sign-in, finished in a popup

url = startGoogleSignIn() in the service workerwindows.create({ url, type: 'popup' })tabs.onUpdated((tabId, change, tab) =>if isVideoSite(tab.url): lastVideoTab = tabId remembered on every loadif isSignInComplete(change.url):session = readSession(change.url)storage.sync.set({ session })tabs.sendMessage(lastVideoTab, 'login-success')windows.remove(tab.windowId))
The session goes back to the video tab sign-in started from — no longer the active tab.

The session lives in chrome.storage.sync; when it expires, every panel returns to sign-in.

08:10

Ask about a frame

The camera button asks the worker for captureVisibleTab, opens a crop tool, and attaches the selection to the next question.

What is the formula on the board at this point?47 / 1000
  • Screenshot
  • Upload image
  • Chat history
  • New conversation

The image uploads first, then text and image go as one turn. Enter is ignored between compositionstart and compositionend, where a Chinese IME uses it to confirm characters.