-
Notifications
You must be signed in to change notification settings - Fork 301
/
sndcpy.bat
executable file
·33 lines (28 loc) · 1 KB
/
sndcpy.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
@echo off
if not defined ADB set ADB=adb
if not defined VLC set VLC="C:\Program Files\VideoLAN\VLC\vlc.exe"
if not defined SNDCPY_APK set SNDCPY_APK=sndcpy.apk
if not defined SNDCPY_PORT set SNDCPY_PORT=28200
if not "%1"=="" (
set serial=-s %1
echo Waiting for device %1...
) else (
echo Waiting for device...
)
%ADB% %serial% wait-for-device || goto :error
%ADB% %serial% install -t -r -g %SNDCPY_APK% || (
echo Uninstalling existing version first...
%ADB% %serial% uninstall com.rom1v.sndcpy || goto :error
%ADB% %serial% install -t -g %SNDCPY_APK% || goto :error
)
%ADB% %serial% shell appops set com.rom1v.sndcpy PROJECT_MEDIA allow
%ADB% %serial% forward tcp:%SNDCPY_PORT% localabstract:sndcpy || goto :error
%ADB% %serial% shell am start com.rom1v.sndcpy/.MainActivity || goto :error
timeout 2
echo Playing audio...
%VLC% -Idummy --demux rawaud --network-caching=0 --play-and-exit tcp://localhost:%SNDCPY_PORT%
goto :EOF
:error
echo Failed with error #%errorlevel%.
pause
exit /b %errorlevel%