Home

A free C++ BitTorrent/HTTP/FTP Download Client

webui_invoking_the_local_video_player
 

WebUI Invoking Local Video Player

This page provides a detailed description of the functionality, usage, and precautions for WebUI invoking a local video player, offering users a complete operation guide.

1. Overview of Features

WebUI supports launching a locally installed video player on the user's device (such as VLC or PotPlayer) via custom protocols (e.g., vlc://, potplayer://) to directly play the HTTP links of specified video files in download tasks. This feature bypasses browser playback format limitations and fully utilises the advanced functions of the local player.

2. Core Advantages

- Strong format compatibility: Supports playback of special video formats not natively supported by the browser (e.g., MKV, FLV in high definition).

- Richer features: Can invoke advanced decoding, multiple audio track switching, subtitle adjustment, speed control and other exclusive functions of the local player.

- Performance enhancement: The local player can utilise hardware acceleration to improve playback smoothness of high-bitrate videos.

3. Prerequisites

All of the following conditions must be met, otherwise the local player cannot be launched properly.

- A supported video player must be installed on the local device (official recommendation: VLC Media Player, PotPlayer).

- The player must complete custom protocol registration (e.g., the vlc:// protocol must be associated with VLC Player). Registration method is provided in the next section.

- The browser has not blocked custom protocol calls (on first use, the browser may prompt a message, requiring selection of “Allow” or “Always Allow”).

4. Appendix: Protocol Registration Method

4.1 VLC Player Protocol Registration

After installing the VLC player normally, the following batch file must be used to register the custom protocol:

vlc_reg.bat
@echo off
setlocal enabledelayedexpansion
 
:: Check if the script is running with Administrator privileges
fltmc >nul 2>&1 || (
    echo ERROR: This script requires Administrator privileges!
    echo Please right-click and select "Run as administrator".
    pause
    exit /b 1
)
 
:: Find VLC installation directory
for /f "tokens=1,2* delims=:" %%a in (
  'reg query "HKLM\SOFTWARE\VideoLAN\VLC" /v "" 2^>nul ^| findstr "(Default)"'
) do (
  for /f "tokens=1,2,3" %%l in ("%%a") do (
    set "player_disk=%%n"
  )
  set "player_exe=!player_disk!:%%b"
)
 
:: Verify vlc.exe exists
if not exist "!player_exe!" (
  echo VLC executable not found: !player_exe!
  pause
  exit /b 1
) else (
  echo Found VLC executable path: !player_exe!
)
 
:: Start registering registry entries
 
:: Create vlc root key with default value
reg add "HKCR\vlc" /ve /t REG_SZ /d "URL:VLC Protocol" /f >nul
 
:: Create URL Protocol entry (empty value)
reg add "HKCR\vlc" /v "URL Protocol" /t REG_SZ /d "" /f >nul
 
:: Create shell\open\command entry with properly quoted executable path
:: powershell -Command "$url = '%1' -replace '^vlc://(http|https)//', '$1://' ; & \"C:\Program Files\VideoLAN\VLC\vlc.exe\" \"$url\""
reg add "HKCR\vlc\shell\open\command" /ve /t REG_SZ /d "powershell -Command \"$url = '%%1' -replace '^vlc://(http^|https)//', '$1://' ; ^& \\\"!player_exe!\\\" \\\"$url\\\"\"" /f >nul
 
:: Verify registration result
if %errorlevel% equ 0 (
  echo VLC protocol registered successfully!
) else (
  echo Failed to write to registry. Please run this script as Administrator.
  pause
  exit /b 1
)
 
endlocal
pause

After saving this .bat file locally, right-click and select 'Run as administrator' to register the VLC custom protocol.

7.2 PotPlayer Player Protocol Registration

After installing the PotPlayer player (64-bit version) normally, the PotPlayer custom protocol is configured by default. If the custom protocol fails, you can use the following batch file to repair it.

potplayer_reg.bat
@echo off
setlocal enabledelayedexpansion
 
:: Check if the script is running with Administrator privileges
fltmc >nul 2>&1 || (
    echo ERROR: This script requires Administrator privileges!
    echo Please right-click and select "Run as administrator".
    pause
    exit /b 1
)
 
:: Find PotPlayer installation directory
for /f "tokens=1,2* delims=:" %%a in (
  'reg query "HKLM\SOFTWARE\DAUM\PotPlayer64" /v "ProgramPath" 2^>nul ^| findstr "ProgramPath"'
) do (
  for /f "tokens=1,2,3" %%l in ("%%a") do (
    set "player_disk=%%n"
  )
  set "player_exe=!player_disk!:%%b"
)
 
:: Verify PotPlayerMini64.exe exists
if not exist "!player_exe!" (
  echo PotPlayer executable not found: !player_exe!
  pause
  exit /b 1
) else (
  echo Found PotPlayer executable path: !player_exe!
)
 
:: Start registering registry entries
 
:: Create potplayer root key with default value
reg add "HKCR\potplayer" /ve /t REG_SZ /d "URL:PotPlayer Protocol" /f >nul
 
:: Create URL Protocol entry (empty value)
reg add "HKCR\potplayer" /v "URL Protocol" /t REG_SZ /d "" /f >nul
 
:: Create shell\open\command entry with properly quoted executable path
reg add "HKCR\potplayer\shell\open\command" /ve /t REG_SZ /d "\"!player_exe!\" \"%%1\"" /f >nul
 
:: Verify registration result
if %errorlevel% equ 0 (
  echo PotPlayer protocol registered successfully!
) else (
  echo Failed to write to registry. Please run this script as Administrator.
  pause
  exit /b 1
)
 
endlocal
pause

After saving this .bat file locally, right-click and select 'Run as administrator' to register the VLC custom protocol.

 
webui_invoking_the_local_video_player.txt · Last modified: 2025/10/30 17:05 by wxhere
Recent changes RSS feed Driven by DokuWiki