Skip to content

feat: enable HLS playback on Android#3

Closed
towneh wants to merge 1 commit into
BasisVR:mainfrom
towneh:feat/android-hls
Closed

feat: enable HLS playback on Android#3
towneh wants to merge 1 commit into
BasisVR:mainfrom
towneh:feat/android-hls

Conversation

@towneh

@towneh towneh commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Enables HLS playback on Android/Quest. The HLS source (protocol/basis_hls.c) is portable C and already ships in the Android build — the only gate was run_hls constructing its HTTP provider under #if defined(_WIN32). This wires the existing JNI HttpsURLConnection byte source in as the Android provider (same code path the push-model https fallback already uses: TLS, redirects and JVM thread-attach handled there), with a 60 s read timeout to sit out LL-HLS blocking playlist reloads.

.m3u8 URLs are also handed to the HLS source ahead of the AMediaExtractor attempt — the extractor can't stitch segments, so trying it first only added a rejected network round-trip. No behaviour change on Windows, where basis_decoder_try_open_url always returns 0.

Delivery semantics carry over unchanged from the portable core: live playlists present at the live edge with AU-level delivery pacing, ENDLIST playlists auto-detect as VOD and play once.

Rebuilt libbasis_media_native.so (arm64-v8a); the Windows DLL is untouched.

Status — draft pending device validation

Code-complete and reviewed, but not yet Quest-tested — keeping this a draft until the headset pass, which covers:

  1. TS-segment live HLS from the test origin (mediamtx, mpegts variant).
  2. VOD (EXT-X-ENDLIST) + real TLS via a public TS-segment HLS VOD stream — also exercises redirects through the JNI fetch.
  3. Stereo/5.1 audio intact (same TS→AAC push path already validated over RTSP on Quest).

Note for testers: http:// origins additionally need a build with cleartext traffic allowed (Android policy); https:// origins need nothing special.


Ported from the pre-split working branch (same commit), now that this repository is the media player's home.

The HLS source (protocol/basis_hls.c) is portable C and already ships in the
Android build; only the HTTP provider selection in run_hls was Windows-only.
Wire the JNI HttpsURLConnection byte source in as the Android provider, so
playlist and segment fetches ride the same code path the push-model https
fallback already uses (TLS, redirects and thread attach handled there). The
read timeout is 60s to sit out LL-HLS blocking playlist reloads.

Also hand .m3u8 URLs to the HLS source ahead of the AMediaExtractor attempt:
the extractor cannot stitch segments, so trying it first only added a
rejected network round-trip before the fallback. No behaviour change on
Windows, where basis_decoder_try_open_url always returns 0.

Delivery semantics carry over unchanged from the portable core: live
playlists present at the live edge with AU-level delivery pacing, ENDLIST
playlists auto-detect as VOD and play once. fMP4/CMAF-segment HLS remains
unsupported on every platform; TS-segment HLS is the working case.

Rebuilt libbasis_media_native.so (arm64-v8a).
@towneh

towneh commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

Re-raised on the main repository as BasisVR/Basis#927 (stacked on the monorepo sync, BasisVR/Basis#926) as part of collapsing this repo back into BasisVR/Basis — same change, rebased over everything the sync carries. Still draft pending the Quest pass listed there.

@towneh towneh closed this Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant