Home

Awesome

<p align="center"> <img src="https://raw.githubusercontent.com/killergerbah/asbplayer/main/extension/src/assets/icon128.png" width="75" height="75" style="border-radius: 16px" alt="asbplayer" /> </p> <div align="center">

GitHub Workflow Status (with event) Github All Releases GitHub Sponsors Static Badge GitHub License

</div>

asbplayer

asbplayer is a browser-based media player and Chrome extension developed for language learners who learn their target language through subtitled media. With asbplayer, you can:

Thanks

Thank you to all of my sponsors:

@vivekchoksi, @nzarbayezid, @ManuJapan, AdamM, realgoodsmiley, Alex, @m4eko, Simon, Attenius, medyas, @zaerald, Suna, @tony7253, @voothi, kibo, @genericdave, Daniel, Cristian, Joey Potter, @InteractiveNinja, @agloo, @Venous771, @Viterkim, Julian, DanglingSabSuu, @nikkovc, @ganqqwerty, @mathiaslovnes, @MF-Billings

and to those who have donated privately.

Thank you to all those who have contributed to asbplayer:

@Renji-XD, @MatiasIslaA, @cyphar, @alexbofa, @Zyphdoz, @artjomsR, @iam6lake, @bpwhelan, @pooky-programs, @m-edlund, @nekorushi, @Viterkim, @s-cork, @shekhirin, @ShanaryS, @kayden1940

Thank you to all those who have translated asbplayer:

Mana Tsutsumi (Japanese, initial translation), Kai Böse (German), Triline, nekorushi (Polish), NeverWinterSwor (Simplified Chinese), Yagxter (Brazilian Portuguese), Leo Gonzalez (Spanish), Yuri (ganqqwerty) (Russian)

If you are a non-English native, and would like to help translate asbplayer, join the Crowdin project. If your language isn't there, feel free to create an issue to add it on the issues page.

Getting Started

[!NOTE]
asbplayer is both a subtitle control and flashcard creation tool. If you are not interested in flashcards, and only want to use asbplayer's subtitle features, you can read about them under Subtitle features.

First, see if you can get started by following one of the community guides.

Otherwise, the following steps for setting up automated Anki flashcards should work for any language:

  1. Install and set up a dictionary tool for your target language that allows you to do instant lookups. Popular ones are Yomitan (see supported languages) and VocabSieve (tuned for European languages. Works with Asian languages too but doesn't automatically detect word boundaries).

  2. Install Anki, and create a deck and note type. More details on Refold's guide.

  3. Install the AnkiConnect plugin for Anki.

  4. Configure asbplayer to create cards via AnkiConnect using your deck and note type.

  5. Enhance a video using asbplayer and subtitle files.

    • For streaming video: After installing the browser extension, drag-and-drop a subtitle file into the streaming video you want to mine.
    • For local files: Drag-and-drop media/subtitle files into the asbplayer website.

    You may have to adjust the subtitle offset to get the subtitles in sync.

  6. When a subtitle appears that you want to mine, use <kbd>Ctrl + Shift + X</kbd> to open the flashcard creator.

  7. Fill in the definition and word fields and then export the card. To fill in the definition field you may use the dictionary you installed in step 1.

Community guides

Text guides:

Video guides:

Demos

Detailed usage

To use asbplayer with streaming video, install the browser extension. Otherwise, use the website.

In order to make use of any of asbplayer's features, subtitles (or an empty subtitle track) must first be loaded, either onto a streaming video or a local video file. The following section instructs how to do this.


Subtitle features

Enhancing streaming video with asbplayer-controlled subtitles

There are a number of ways to load subtitles onto streaming video:

  1. Drag-and-drop a subtitle file into the video element you want to enhance.
  2. Load a subtitle file into the asbplayer website and click on the camera in the bottom right to pick a video element to enhance. This is the recommended way to load BluRay subtitle files onto streaming video.
  3. Use <kbd>Ctrl + Shift + F</kbd> to select a video element to enhance. From the dialog that appears you can choose whether to load an auto-detected subtitle track or an empty one.
  4. Open the side panel (<kbd>`</kbd> button or Open Side Panel from the extension popup). When a video element is on screen, click on the Load Subtitles button to open the same subtitle track selector in (3).
  5. Right click on a video element and click "asbplayer" → "Load subtitles."

asbplayer features will then be accessible for that video.

Enhancing local video files with asbplayer-controlled subtitles

Drag-and-drop media and subtitle files into the asbplayer website to load them. asbplayer features will then be accessible for those files. Not all media files may be compatible - see the Browser Compatibility section.

Adjusting subtitle offset

Use <kbd>Ctrl + Left/Right</kbd> to adjust subtitle offset so that the previous/next subtitle appears at the current timestamp. Then use <kbd>Ctrl + Shift + Left/Right</kbd> for finer adjustment by 100ms increments.

If you are using the asblayer website, you can also use the Subtitle Offset text field available in the controls UI.

Subtitle track detection for streaming video

Use <kbd>Ctrl + Shift + F</kbd> to see auto-detected subtitle tracks for streaming video. Below are the sites where automatic subtitle detection is supported:

<kbd>Ctrl + Shift + F</kbd> also allows you to load an empty subtitle track so that you can extract audio and screenshots from streaming video without loading subtitles.

Filtering subtitle text

If you'd like to filter out specific instances subtitle text, one way to do so is by using a regular expression (regex). asbplayer can match any sequence following a specified regex pattern and remove the matches.

Under the MISC section in asbplayer settings, locate the "Subtitle regex filter" textbox. Enter an appropriate regex to filter desired content. You can replace filtered content similarly by entering a string into the "Subtitle regex filter text replacement" textbox. Leaving this blank will simply remove the content.

Useful examples of regular expressions:

Regular expressions can be combined with the character | (no spaces needed inbetween). E.g., if you want to use the 2 last regexes from this list, you can use -?\[.*\]|[♪♬#~〜]+. You can combine as many regexes as you wish this way.

Learn how to write and test custom regular expressions at Regex Learn - Playground.

Downloading subtitle files

Once loaded into the extension, you can download the subtitles by opening the side panel and clicking the Download Subtitles as SRT button in the top-right. You can also download subtitles via the website by clicking the same download button in the top-left.

Note: Using the regex feature will alter the .srt that is downloaded.


Anki integration

Creating Anki flashcards

Make sure Anki and AnkiConnect are installed. Integration with AnkiConnect can be configured in the settings as in this video.

When a subtitle that you want to mine appears, use <kbd>Ctrl + Shift + X</kbd> to open the flashcard creator.

See the keyboard shortcuts for other ways to interact with and create cards.

Adjusting Anki flashcards

All text fields can be edited from the flashcard creator prior to flashcard creation.

Adjust the selected time interval for the card using the slider at the bottom of the export dialog. The newly selected time interval can be applied to the card using the buttons available in the sentence and audio sections of the card. See this video for a demo.


Other basic features

Keyboard shortcuts

Keyboard shortcuts are customizable from the settings or from accessing the extension directly. Once asbplayer has been bound to a video, you can use the keyboard shortcuts to access most of asbplayer's features.

Extension side panel UI

Most of the extension features detailed above can be accessed through the extension's side panel UI. The side panel can be opened with the <kbd>`</kbd> button or Open Side Panel from the extension popup.

Extension video overlay

By default some UI appears at the top of streaming video when it is paused. It can be toggled on/off from the settings. It exists primarily to make it possible to sentence mine on Kiwi Browser for Android, with buttons/fields to mine a subtitle, load subtitles, and adjust subtitle offset.

Audio track selection for mkv files

An audio track selector will appear for mkv files if experimental web platform features are enabled from chrome://flags. Note that enabling this flag may cause issues with other features of asbplayer, such as card creation through the Chrome extension.


Advanced features

One-click mining flow

asbplayer can be setup to support one-click mining workflows by integrating with other tools via its WebSocket interface and a locally-running proxy that intercepts AnkiConnect traffic. Below are steps to set up such a workflow using Yomitan:

  1. Install Go.
  2. Clone this repository and start the AnkiConnect proxy server:
    cd scripts/web-socket-server
    go run main.go
    
  3. Enable asbplayer's WebSocket client from the settings.
  4. Point Yomitan at the proxy by configuring http://127.0.0.1:8766 for the AnkiConnect URL.
  5. Configure Yomitan to use the same note type you have configured for asbplayer.
  6. Using Yomitan's + button on asbplayer subtitles will now trigger the flashcard creator with word and definition fields pre-populated by Yomitan.

The proxy is very lightweight, so it's fine to leave it running in the background. On Windows, RBTray can be used to minimise it to the taskbar.

See the proxy's example configuration file for how to further configure it.

WebSocket interface

The asbplayer website can be controlled remotely through a WebSocket connection, which enables one-click mining flows with the right setup. Currently asbplayer responds to two types of payloads:

Usage on Android

asbplayer is best used on computers using Chromium-based browsers, but it is also usable on Android.

  1. Install either Kiwi Browser (preferred for DRM-protected stream audio capture) or Firefox for Android.
  2. Install the extension via the extension store for your browser: Chrome Web Store or AMO.
  3. On webpages with video elements, select the asbplayer button from your browser's main menu to open the subtitle track selector.
  4. When the video is paused, use asbplayer's overlay UI to access asbplayer features.
  5. Use AnkiConnect Android for Anki integration.

Common issues

asbplayer can't connect to Anki. It shows an error message e.g. 'Failed to fetch.'

When using the 'update last card' feature, the card does not update in Anki.

When loading a local file asbplayer either shows a black screen, or doesn't play audio.

My popup dictionary extension (e.g. Yomitan) doesn't work on the side panel

asbplayer isn't detecting streaming video.

Keyboard shortcuts aren't working.

asbplayer isn't including audio/screenshot in flashcards.

asbplayer isn't properly cropping screenshots from streaming video.

Browser compatibility

Website

Local video file playback is supported only for codecs supported by the browser. Firefox does not support many popular video codecs. Later versions of Chrome can decode H.265 video as long as hardware acceleration is enabled. See the animebook readme for a detailed explanation of this and links to browsers that have good compatibility.

Extension

The extension is compatible with most Chromium-based browsers. It is also compatible with Firefox, but on Firefox version of the extension is missing feaures like the side panel and the ability to record DRM-protected audio.

Contributing

Pull requests are welcome! However, to reduce back-and-forth during review ideally consult with me on the corresponding issue or on Discord before attempting changes to UI/UX. When making changes, format code according to the Prettier config and attempt to match the style of surrounding code.

Building and running

# Install yarn
npm install --global yarn

# Make sure you're on yarn 3
yarn set version 3.2.0

# Install dependencies
yarn

# Starts the development server for the website
yarn workspace @project/client run start

# Build the Chromium version of the extension to extension/dist/chromium
yarn workspace @project/extension buildDev

# Build the Firefox version of the extension to extension/dist/firefox
yarn workspace @project/extension buildDev --env firefox

# Build the Firefox for Android version of the extension to extension/dist/firefoxandroid
yarn workspace @project/extension buildDev --env firefoxandroid

If you have problems building try deleting node_modules and re-running yarn.

Contact

Submit bugs or feature requests from the issues page. Join the Discord server to talk with me and other language learners.

Donations

If you've benefited from asbplayer, please consider supporting my work via Github Sponsors or Ko-fi.