本页面详细介绍 WebUI 调用本地视频播放器的功能说明、使用方法及注意事项,为用户提供完整的操作指引。
WebUI 支持通过自定义协议(如 vlc://、potplayer://)唤起用户设备上已安装的本地视频播放器(如 VLC、PotPlayer),直接播放下载任务中指定视频文件的HTTP链接。该功能可规避浏览器播放组件的格式限制,充分利用本地播放器的高级功能。
- 格式兼容性强:支持播放浏览器原生不支持的特殊格式视频(如 MKV、FLV 高清格式)。
- 功能更丰富:可调用本地播放器的高级解码、多音轨切换、字幕调节、倍速播放等专属功能。
- 性能提升:本地播放器可调用硬件加速功能,提升大码率视频的播放流畅度。
以下条件需全部满足,否则无法正常唤起本地播放器。
- 本地设备已安装支持的视频播放器(官方推荐:VLC 媒体播放器、PotPlayer)。
- 播放器已完成自定义协议注册(如 vlc:// 协议需关联 VLC 播放器)。注册方法参考下一节。
- 浏览器未拦截自定义协议调用(首次使用时,浏览器可能弹出提示,需选择“允许”或“始终允许”)。
正常安装VLC播放器后,还需使用以下批处理文件注册自定义协议:
@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
将此bat文件保存到本地后,右键单击“以管理员权限运行”,即可注册vlc自定义协议。
正常安装PotPlayer播放器(64位版)后,默认已配置potplayer自定义协议。如果自定义协议失效,可使用以下批处理文件进行修复:
@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
将此bat文件保存到本地后,右键单击“以管理员权限运行”,即可注册potplayer自定义协议。