0.1.12 • Published 9 months ago

@mpv-easy/play-with v0.1.12

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

mpv-play-with

tampermonkey script for using local mpv player to play web videos, which requires local support for mpv-easy:// protocol

If you use mpv-easy, you only need to start mpv once, and mpv-easy will automatically register the mpv-easy:// protocol

Inspired by https://github.com/LuckyPuppy514/Play-With-MPV

install tampermonkey script

You need to install the tampermonkey extension first

Then install script mpv-easy-play-with.user.js

When play-with detects videos in the page, you can add all videos to the mpv player through the mpv icon in the bottom left corner

install yt-dlp

You need to make sure that mpv has been configured correctly yt-dlp You can execute the following powershell command in the folder where mpv.exe is located to test whether youtube videos can be played

.\mpv.exe --log-file=a.log 'https://www.youtube.com/watch?v=BnnbP7pCIvQ'

install protocol by mpv-easy

You only need to run the mpv player once, and mpv-easy will automatically register the protocol.

manual install protocol

Make sure you have already installed yt-dlp

protocol test

You can test whether the protocol is installed successfully by opening the test link

mpv-easy://H4sIAIYBvmYAAyXLQQqCQBSA4as83jp0GQgRpC6CCIM2ES3UeenQOCP6xmkwITpDV+oinSSh1b/5vxFblXsle8ZoxH/PI9pOYYQ1c9tHYeicC7yxbAsKStOELueyXg+rjdZFtmzj7XDABbJkRbOKfUFda/UtglRU1Fmtqevh+3xDqoXUFRxraggesCOGk7GQGKeh8JDkTgrIjOhlLj4vMy974quSd5wu0/QDJfFha6wAAAA=

npm

npm i @mpv-easy/play-with
import { sendToMpv, encodeToBase64 } from '@mpv-easy/play-with';
import type { PlayItem, PlayWith } from '@mpv-easy/play-with';

const list: PlayItem[] = [
  url: 'http://hello.mp4',
  title: 'mpv-easy'
];
const playWith: PlayWith= { playlist:{ list }, start: 0 } ;

const base64 = encodeToBase64(playWith);
sendToMpv(base64);

chunk

When the data length exceeds 2048, you can use chunks to pass the data. You only need to concatenate the current chunk id and the total number of chunks after base64. To prevent errors in the order of chunk merging, it is recommended to wait 100ms after each chunk is sent to allow the program enough time to write the file.

base64?chunkId&chunkCount

short key

ctrl+shift+r

reset icon position to bottom left

rules

youtube

https://www.youtube.com/
https://www.youtube.com/watch?v=xxx
https://www.youtube.com/watch?v=xxx&list=xxx
https://www.youtube.com/@xxx
https://www.youtube.com/@xxx/videos

jellyfin

host/web/index.html#!/movies.html?topParentId=xxx
host/web/index.html#!/details?id=xxx&serverId=xxx
host/web/index.html#!/video

bilibili

https://www.bilibili.com/
https://www.bilibili.com/video/BVxxx
https://live.bilibili.com/xxx

twitch

https://www.twitch.tv/xxx
https://www.twitch.tv/xxx/video/xxx
0.1.12

9 months ago

0.1.1

12 months ago

0.1.0

12 months ago