Skip to main content

Auto play in MPV

Automatically redirect to mpv player when playing online video.

Installation / Usage

  1. install auto-play-in-mpv: pip install auto-play-in-mpv or uv tool install auto-play-in-mpv, start the server by executing apim in your terminal.
  2. install tampermonkey/violentmonkey in your browser
  3. install the script from greasyfork
  4. just click a video from supported sites. (this script mainly works on bilibili. youtube support is not tested yet)

mpv config

Note that this is just my config example. You may need to change some settings.

If you find mpv is not playing the video, you may need to run mpv https://bilibili.com/video/xxx to test if your mpv profile is working.

Autostart server

It's better to start the websocket server automatically at startup.

  • On general platforms: please use my another script user-startup-rs!
  • On NixOS: Add this to your configuration.nix
    systemd.user.services.apim = {
      enable = true;
      description = "Open online video in local mpv player";
      script = "~/.local/bin/apim";
      wantedBy = [ "default.target" ];
      path = with pkgs; [
        mpv
        yt-dlp
      ];
    };
    # do not forget to add your current user to some groups
    users.users.<your_user_name> = {
      isNormalUser = true;
      extraGroups = [
        "wheel"
        "networkmanager"
        "video"
        "render"
        "audio"
      ];
    };
    

Supported sites

  • bilibili (video, live)
  • youtube

TODO

  • auto start
  • fix behavior on youtube

License

MIT

Release files for auto-play-in-mpv 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for auto-play-in-mpv 0.1.4
File Size Uploaded
auto_play_in_mpv-0.1.4.tar.gz 21.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for auto-play-in-mpv 0.1.4
File Interpreter ABI Platform
auto_play_in_mpv-0.1.4-py3-none-any.whl Python 3 none any Details

Total release size: 25.7 kB

Release files / auto_play_in_mpv-0.1.4.tar.gz

Download URL auto_play_in_mpv-0.1.4.tar.gz
Size 21.3 kB
Tags Source
SHA-256 checksum
How to use checksums
823653c2ebb17454bc2eec4b57dfd2934634f3abacc79fdf508619dc0b481e58
BLAKE2b-256 checksum
How to use checksums
61863e38f3831f53f6b0c4c19e631bc152a85eb51b88b6a841ec8a2070a5f2cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.22

Release files / auto_play_in_mpv-0.1.4-py3-none-any.whl

Download URL auto_play_in_mpv-0.1.4-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4c669aedccbc76a8e10d14757d2cef233f1cb9c1f512b9afd1eb187d1f518848
BLAKE2b-256 checksum
How to use checksums
3395988fd464490f29e7605c4fe27f78da5e617bedf795be16f6bb0293ee8dfc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.8.22

Release history Release notifications | RSS feed

This release

0.1.4 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page