Skip to content

mohammadsyuhada/nextui-video-player

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NextUI Video Player

A video playback application for NextUI featuring local file playback, YouTube streaming, IPTV/Online TV, and channel subscriptions.

Supported Platforms

  • tg5040 - TrimUI Smart Pro / TrimUI Brick / Brick Hammer
  • tg5050 - TrimUI Smart Pro S

ko-fi

main

Installation

Manual Installation

  1. Mount your NextUI SD card to a computer.
  2. Download the latest release file named Video.Player.pak.zip from Github.
  3. Copy the zip file to /Tools/<PLATFORM>/Video.Player.pak.zip (replace <PLATFORM> with your device: tg5040 or tg5050).
  4. Extract the zip in place, then delete the zip file.
  5. Confirm that there is a /Tools/<PLATFORM>/Video.Player.pak folder on your SD card.
  6. Rename the Video.Player.pak folder to Video Player.pak.
  7. Unmount your SD Card and insert it into your TrimUI device.

Pak Store Installation

  1. Open Pak Store application in your TrimUI device.
  2. Navigate to the Browse then Media menu.
  3. Select Video Player to install.

Update

  1. You can update the application directly via Settings page in the application.
  2. Or, you can update via Pak Store.

Features

General

  • Automatic screen off (Follow system screen timeout).
  • Resume playback from where you left off.
  • Self-update from GitHub releases.

Local Video Playback

  • Supports MP4, MKV, AVI, WEBM, MOV, FLV, M4V, WMV, MPEG, 3GP formats
  • File browser for navigating video libraries (Video files must be placed in ./Videos folder)
  • Subtitle support:
    • External subtitles (.srt, .ass, .ssa, .sub): Place the subtitle file next to the video with a matching name. Works with any file size.
    • Embedded subtitles (e.g., ASS/SSA tracks inside .mkv): Automatically rendered for files under 500 MB. For larger files, use external subtitle files instead.
  • On-screen display with progress bar, elapsed/total time

YouTube Streaming

  • Search YouTube videos directly from the device
  • Thumbnail previews in search results
  • Stream resolution selection
  • Channel subscriptions (bookmarks)

IPTV / Online TV

  • M3U/M3U8 playlist support
  • Bundled curated channel list
  • Browse channels by category
  • Add custom playlist URLs

Controls

Main Menu Navigation

  • D-Pad: Navigate menus and file browser
  • A Button: Select/Confirm
  • B Button: Back/Cancel/Exit
  • Start (short press): Show Controls Help
  • Start (long press): Exit Application

Video Player (during playback)

  • A Button: Play/Pause
  • B Button: Stop and return to browser
  • D-Pad Left/Right: Seek ±10 seconds (hold for continuous seek)
  • D-Pad Up: Cycle audio track
  • D-Pad Down: Cycle subtitle track

Usage

Playing Local Videos

  • Navigate to your video folder using the Local Videos menu
  • Select a file to start playback
  • Place subtitle files (.srt, .ass) alongside video files with matching names for automatic detection

YouTube

  • Navigate to YouTube from the main menu
  • Use the on-screen keyboard to search for videos
  • Select a video to stream
  • Press D-Pad Up to subscribe to a channel

IPTV

  • Navigate to Online TV from the main menu
  • Browse channels by category or flat list
  • Select a channel to stream
  • Add custom M3U playlist URLs

HEVC/H.265 Playback Limitations

The device uses software video decoding (no hardware video decoder is exposed). HEVC/H.265 is significantly more CPU-intensive than H.264, especially at higher resolutions. The following optimizations are applied automatically for the best possible playback experience:

  • Resolution cap: Video is downscaled to the device's screen resolution before rendering, reducing post-decode work for 1080p+ content.
  • Decoder optimizations: Loop filter and IDCT skipping are enabled (-skip_loop_filter all, -skip_idct noref) to reduce decode CPU usage at the cost of minor visual artifacts.
  • Frame dropping: Frames are dropped when decoding falls behind audio to maintain sync.
  • Embedded subtitles disabled for HEVC: The subtitle overlay filter adds significant CPU overhead. Embedded subtitle streams are not rendered for HEVC files. External subtitle files (.srt, .ass) placed next to the video still work.
  • CPU locked at max frequency: The CPU is set to 2GHz (max) during the video player session to avoid frame drops from frequency scaling ramp-up.

Recommendations for HEVC content:

  • Use 720p or lower resolution encodes for smooth playback
  • Prefer 8-bit over 10-bit color depth
  • Use external .srt subtitle files instead of embedded subtitles
  • H.264 encoded videos will always play more smoothly than HEVC on this hardware

Building from Source

Prerequisites

  • Docker (for cross-compilation toolchain)
  • NextUI workspace with platform dependencies

Build Commands

Building the Video Player application

# Enter the toolchain (replace PLATFORM accordingly)
make shell PLATFORM=tg5040

# Once in the toolchain shell
cd ~/workspace/nextui-video-player/src

# Build for TrimUI Brick (tg5040)
make clean && make PLATFORM=tg5040

Building ffplay (video playback engine)

ffplay is a patched build of FFmpeg's ffplay with gamepad input support and custom OSD. It is built separately from the main application.

# Build ffplay using Docker toolchain
docker run --rm -v $(pwd)/workspace:/root/workspace \
  ghcr.io/loveretro/tg5040-toolchain:latest /bin/bash -c \
  'source ~/.bashrc && bash /root/workspace/nextui-video-player/ffplay/build.sh'

The build script will:

  1. Download FFmpeg 6.1 source (cached after first run)
  2. Set up SDL2 headers and device's shared library for cross-compilation
  3. Apply the patched ffplay.c (gamepad controls, OSD, progress bar)
  4. Build and copy the resulting binary to bin/ffplay

Project Structure

workspace/
├── nextui-video-player/        # This project
│   ├── src/                    # Source code
│   ├── ffplay/                 # ffplay build system
│   │   ├── ffplay.c            # Patched ffplay source (gamepad + OSD)
│   │   ├── build.sh            # Cross-compilation build script
│   │   ├── sdl2-headers/       # SDL2 headers for cross-compilation
│   │   └── syslibs/            # Device's SDL2 shared library
│   ├── bin/                    # Platform binaries and runtime tools
│   │   ├── tg5040/             # TrimUI Brick binary (videoplayer.elf)
│   │   ├── tg5050/             # TrimUI Smart Pro S binary (videoplayer.elf)
│   │   ├── ffplay              # Patched ffplay binary (shared across platforms)
│   │   ├── yt-dlp              # YouTube downloader
│   │   ├── wget                # HTTP downloader
│   │   └── keyboard            # On-screen keyboard
│   ├── res/                    # Resources (fonts, images)
│   ├── playlists/              # Bundled IPTV playlists
│   └── state/                  # Runtime state files
├── all/                        # Shared code
│   ├── common/                 # Common utilities, API
│   └── minarch/                # Emulator framework
├── tg5040/                     # TrimUI Brick platform
│   ├── platform/               # Platform-specific code
│   └── libmsettings/           # Settings library
└── tg5050/                     # TrimUI Smart Pro platform
    ├── platform/               # Platform-specific code
    └── libmsettings/           # Settings library

Dependencies

The video player uses:

  • Shared code: workspace/all/common/ (utils, api, config, scaler)
  • Platform code: workspace/<PLATFORM>/platform/
  • Libraries: SDL2, SDL2_image, SDL2_ttf, GLESv2, EGL, libzip, mbedTLS
  • ffplay: Patched FFmpeg 6.1 ffplay (dynamically linked against device's SDL2)

About

NextUI app for playing local video, Youtube and streaming internet TV on TrimUI devices

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages