Hi @vipcreater,
Welcome to the Amazon Developer Community, and thank you for the detailed write-up.
Here are answers to each question.
1. Recommended player architecture
Use the VideoPlayer from @amazon-devices/react-native-w3cmedia with KeplerVideoSurfaceView, and pick the playback mode by content type:
- HLS .m3u8 (live and VOD): MSE mode, using VideoPlayer + KeplerVideoSurfaceView + Shaka Player (or hls.js / dash.js)
- Flat VOD files (.mp4, .mkv): URL mode, using VideoPlayer + KeplerVideoSurfaceView, then set videoPlayer.src = url
Some notes for an IPTV app:
- Live HLS with MPEG-TS segments: turn on sequence mode in Shaka:
player.configure('manifest.hls.sequenceMode', true). The Media Player FAQ recommends this for MPEG2-TS streams, because live playback may not start without it.
- URL mode limits: in URL mode, audioTracks and textTracks aren’t populated, and the event set is limited (you get loadstart, play, waiting, timeupdate, but not loadedmetadata or canplay). Subtitles embedded in MKV also aren’t rendered. If you need audio-track or subtitle selection, use MSE mode. In URL mode you can add external subtitles with
addTextTrack().
- Manifest services: declare the media services under [wants] in
manifest.toml, as listed in Media Player Setup. Missing entries can cause playback not to start or a black screen.
- WebView UI: the KeplerVideoSurfaceView has to be rendered in the React Native layer, not inside the web page. We don’t currently have a documented pattern for drawing WebView UI on top of the video surface. The simplest option is a native React Native playback screen that your WebView opens through postMessage, with RN sending commands back through injectJavaScript.
References: Media Player overview , Selecting the Playback Mode, Media Player FAQ
2. Direct MPEG-TS URLs vs. TS segments in HLS
The MPEG2TS container is supported in both URL mode and MSE mode (as segments in an HLS presentation). For direct, continuous raw .ts live URLs, I’m confirming the expected behavior with our media team and will update this thread.
Until then, if your provider offers an HLS (.m3u8) version of the same channel, we recommend using it with Shaka Player in MSE mode, which is the documented path for live streaming.
If you test a raw .ts URL in URL mode, make sure await videoPlayer.initialize() has resolved and setSurfaceHandle() has been called before you assign src. If it still fails, please share the loggingctl log lines around the failure (W3CMEDIA, MEDIA_PLAYER, and set_src_uri) so I can pass them to the team.
About the error you’re seeing: if the native log shows set_src_uri ... failed apiStatus=50004 followed by makeMediaError: code = 4, before any request reaches the server, the usual causes are:
- The URL is plain
http:// and is blocked by the cleartext policy (see 6).
- The pipeline wasn’t ready. Wait for await
videoPlayer.initialize() to resolve and call setSurfaceHandle() before you assign src. Setting src without a connected surface also gives error code 4.
3. MKV in URL mode
MKV is officially supported in URL mode. The same codecs apply inside MKV:
- Video: H.264 (up to High Profile L5.2), H.265/HEVC (Main 10), AV1, VP9, VP8, MPEG-2, MPEG-4 Part 2 (Simple/Advanced Simple, up to 1080p30)
- Audio: AAC, HE-AAC v1/v2, xHE-AAC, MP3, MP2, AC3, eAC3, AC4, Opus, FLAC, Vorbis, PCM. DTS is HDMI passthrough only.
Some of these depend on the TV hardware (4K, Dolby, HDR). Check before playback with canPlayType() or MediaSource.isTypeSupported().
About your symptoms:
- Stuck loading or error code 4: first check the setup order. Wait for
await videoPlayer.initialize() to resolve, then call setSurfaceHandle(), and only then assign src. Setting src without a connected surface also returns error code 4. If the file is served over http://, please also try the same file over https:// if you can. That tells us whether this is related to the cleartext question in 6. Then check the file’s codecs with ffprobe. DTS audio, or a profile/level above the limits listed above, are common causes.*
- Seeking: for seeking to work, the MKV needs a Cues (seek index) element. A platform fix for MKV seeking over HTTP has also been made for an upcoming platform build.
- Audio plays but video freezes: this usually points to the video stream itself, such as interlaced content, an unsupported profile/level, or broken PTS/DTS. Please share
ffprobe -show_streams output for an affected file.
4. Can Shaka load a standalone .ts?
Not in MSE mode. Shaka needs a manifest (HLS .m3u8, DASH .mpd, or SmoothStreaming). Play flat .ts, .mp4, and .mkv by setting src on the VideoPlayer directly.
A custom MSE player that streams an endless TS feed in JavaScript isn’t practical on Vega either. The MSE porting guide says the ReadableStream interface of the Fetch API isn’t supported, so an endless HTTP response can’t be read incrementally.
5. Another native API for raw MPEG-TS?
No. VideoPlayer (URL mode) is the native path, and there’s no separate API.
6. Cleartext HTTP in production
Cleartext (HTTP) traffic is blocked by default on Vega. I’m confirming the exact manifest configuration for HTTP media playback through @amazon-devices/react-native-w3cmedia with our team and will follow up here.
In the meantime, could you tell us:
- Whether your HTTPS streams play correctly while the HTTP versions of the same streams fail
- The device OS version (
cat /etc/os-release)
7. Vega Virtual Device vs. physical devices
Yes, they differ. The VVD is emulated and doesn’t have the device’s hardware decoders, so codec support, performance, and A/V timing can differ from Fire TV hardware. 4K, HDR, Dolby, and hardware DRM can only be checked on real devices.
Please confirm your MKV, .ts, and frozen-video results on a physical Vega Fire TV device before concluding a format is unsupported. Media apps must be validated on a physical Fire TV Stick 4K Select before submission anyway (Test Your App Before Submission).
8. Official sample project
The official reference is vega-video-sample from Sample Apps Home. It shows MP4 in URL mode and HLS/DASH through Shaka in MSE mode. There’s no official IPTV sample yet that covers raw MPEG-TS and MKV, but the sample’s URL-mode code path is the same one you’d use for .mkv and .ts.
If problems continue after the manifest changes, please share:
vega --version, your @amazon-devices/react-native-w3cmedia version, and cat/etc/os-release
- Whether the problem also happens on a physical Fire TV device
- A loggingctl log capture around the failure (W3CMEDIA, MEDIA_PLAYER, and
set_src_uri lines)
ffprobe -show_streams output for one failing .ts file and one failing .mkv file
- A test URL
Warm Regards,
Ivy