Skip to content

workerindex/sudo-mpv-launcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sudo-mpv-launcher

Provides a sudo-mpv-launcher:// protocol handler for Windows. Launches mpv from browsers with arbitrary arguments.

WARNING: Since it allows arbitrary arguments, NO ONE SHOULD USE IT WITHOUT KNOWING WHAT IT MEANS AND WHAT HE/SHE IS DOING!

Protocol Scheme Encoding

interface MpvLauncherScheme {
  player: "mpv"; // currently only mpv is supported
  args: string[]; // array of command line arguments append to the player executable
}

function encodeMpvLaucherScheme(scheme: MpvLauncherScheme): string {
  // Serialize in JSON format
  const json = JSON.stringify(scheme);

  // Base64-RAW-URL Encode
  const base64 = btoa(json)
    .replace(/\+/g, "-")
    .replace(/\//g, "_")
    .replace(/=/g, "");

  // Append to protocol
  return "sudo-mpv-launcher://" + base64;
}

About

Windows sudo-mpv-launcher:// protocol handler to open mpv with arbitrary arguments

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages