Skip to content
joric edited this page Apr 8, 2026 · 189 revisions

Welcome to the Xplayer2 wiki! This is about XPlayer2 fork for Android TV. I use it with RayNeo Pocket TV and VITURE One Lite.

This fork originated from the keyboard support, because it's borderline impossible to use a touch control app on Android TV.

TODO

  • Use exclusively Leanback views maybe? Pretty sure you can navigate between views without keycode handlers.
  • Show 3d movies as 2d (currently button only toggles hardware 3d mode for the VITURE glasses).
  • 3d UI support in 3d mode (double seekbar, duplicate buttons and everything).
  • Real-time 2d to 3d conversion, a-la Immersive 3D.

Pictures

Screenshot 2026-04-07 143956
Besides OU-SBS conversion, XPlayer2 also supports outer-clipped letterbox OU videos (Shift button to fix the image).

Building

I use WSL2 (Ubuntu) on Windows. Real Windows has multiple issues with gradle and backslashes in paths.

Installation log (click to expand)
wsl --install -d Ubuntu --location E:\WSL\Ubuntu
sudo apt update
mkdir -p ~/Android/cmdline-tool
wget https://dl.google.com/android/repository/commandlinetools-linux-11076708_latest.zip
sudo apt install unzip
unzip commandlinetools-linux-*.zip -d cmdline-tools
mv cmdline-tools/cmdline-tools cmdline-tools/latest
echo 'export ANDROID_HOME=$HOME/Android' >> ~/.bashrc
echo 'export PATH=$PATH:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/emulator' >> ~/.bashrc
source ~/.bashrc 
sudo apt install openjdk-17-jdk -y
sdkmanager "platform-tools" "platforms;android-34" "build-tools;34.0.0" "ndk;27.0.12077973" "emulator"
sdkmanager --licenses
git clone --recurse-submodules https://github.com/joric/Xplayer2.git
cd ~/Xplayer2/
git checkout android-tv
curl -L -o viture_sdk.tar.xz https://static.viture.dev/external-file/sdk/viture_android_sdk_v1.0.7.tar.xz
tar -xf viture_sdk.tar.xz
mkdir -p app/libs
cp aar/VITURE-SDK-1.0.7.aar app/libs/

Use emulator on Windows from Android Studo -> More Actions -> Virtual Device Manager -> Create Device -> Google TV (Android 12). Add this to Windows ~/.wslconfig to see emulator adb over network:

[wsl2]
networkingMode=mirrored

Install VSCode using code . in WSL console. Install Android Launcher extension and use Ctrl+Shift+P, Run & Stream Logs.

You can run it with all the messages to build manually, from VSCode terminal:

./gradlew :app:assembleDebug --stacktrace

To build releases on GitHub with actions you would need secrets to sign the build (you don't need a Play Store account).

ANDROID_KEYSTORE_BASE64
ANDROID_KEYSTORE_PASSWORD
ANDROID_KEY_ALIAS
ANDROID_KEY_PASSWORD

To generate a key:

keytool -genkey -v -keystore my-release-keystore.jks -alias key-alias -keyalg RSA -keysize 2048 -validity 100000

Then Base64 it with base64 -w0 my-release-keystore.jks and use as BASE64 secret. Keystore and key passwords are matching. key alias is in keytool parameters. Then use repository settings to add secrets. Then just use tags to publish:

git tag v1.0.6-dev && git push origin --tags

VITURE

Latest release implements hardware 2D/3D switching. I used 1.0.7 SDK (1.0.1 crashes, newest SDK doesn't have JNI bindings):

Read the documentation on how to implement 2D/3D switching in your project. It's pretty easy. The call you want is:

public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
    if (mSdkInitSuccess == Constants.ERROR_INIT_SUCCESS) {
        mArManager.set3D(b);
    }
}

Alternatives

XPlayer2 is essentially the only good open-source Android TV player with OU-SBS conversion. Other players worth noticing:

  • NOVA - SBS only, great OSD, sound boost, best player (letterbox frame in 3D is pitch black, not overexposed as on KODI).
  • KODI - SBS only (on Android). Can show 3D as 2D. Working TVDB v4 scraper, sound boost, excellent keyboard support.
  • VLC - SBS only, classic and very popular player, generally not recommended, because there is NOVA and KODI.
  • DDDPlayer - can play OU as SBS, very simple, made for Cardboard VR (fisheye by default), open source.
  • DiME 3D Player - plays OU as SBS, thick grey outline, lacks keyboard support (no seeking with the keyboard).
  • VaR's VR Video Player - plays OU as SBS, a lot of formats and buttons, but no keyboard support at all, made with Unity.
  • MPV - libmpv-based barebone player, poor controls but can convert OU to SBS with some tinkering.
MPV Settings (click to expand)

It supports shaders in mpv.conf (it can be edited in the extended settings menu), like this:

glsl-shaders="/storage/emulated/0/Android/media/is.xyz.mpv/files/test.glsl"

Example test.glsl file (you would need ADB to push it to the accessible path:

//!HOOK MAIN
//!BIND HOOKED
//!DESC OU to SBS (simple)
vec4 hook() {
    vec2 pos = HOOKED_pos;
    if (pos.x < 0.5) {
        vec2 uv = vec2(pos.x * 2.0, pos.y * 0.5);
        return HOOKED_tex(uv);
    } else {
        vec2 uv = vec2((pos.x - 0.5) * 2.0, 0.5 + pos.y * 0.5);
        return HOOKED_tex(uv);
    }
}

But they are somehow slower than vf filters so just use vf filters instead. They say vf filters work on GPU (put into mpv.conf):

hwdec=mediacodec
vf=stereo3d=abl:sbsl
video-aspect-override=0.5

References

Clone this wiki locally