Problem
Tizen 2.3 (Chrome 28) does not support the audioTracks API, and hls.js 0.14 cannot switch audio groups in HLS master playlists. This makes runtime audio track switching impossible for both HTTP and HLS streams.
KPSTV solves this with a lightweight HLS manifest rewriter proxy.
Goal
Implement a minimal HLS manifest proxy that rewrites the master playlist to select a specific audio track and quality, so hls.js on Tizen 2.3 can play the correct audio without needing multi-audio support.
Implementation Plan
1. Proxy endpoint
- URL:
GET /api/hls-proxy.m3u8?url=<base64_hls2_url>&audio=<index>&quality=<value>
- Parameters:
url — base64-encoded HLS2 master playlist URL from KinoPub
audio — audio track index (1-based, matches audios[].index from API)
quality — auto or specific quality string (e.g. 720p), optional
- Response: rewritten
.m3u8 playlist with correct Content-Type: application/vnd.apple.mpegurl
2. Playlist rewriting logic
- Fetch the original HLS2 master playlist from KinoPub CDN
- Parse
#EXT-X-MEDIA:TYPE=AUDIO entries — keep only the one matching the requested audio index
- Parse
#EXT-X-STREAM-INF entries:
- Update
AUDIO group reference to point to the remaining audio track
- If
quality is specified (not auto), filter to keep only matching resolution
- Return the modified playlist
- Do NOT proxy video/audio segments — they are fetched directly from CDN by the player
3. Hosting options
- Cloudflare Worker (free tier, simplest, no server needed)
- Vercel Edge Function
- Standalone Node.js/Python server
4. Client integration
- In
player.ts, when streaming type is HLS2 and audio switch is requested:
- Build proxy URL:
PROXY_BASE + '/api/hls-proxy.m3u8?url=' + btoa(originalHls2Url) + '&audio=' + audioIndex
- Reload hls.js with the proxy URL
- Keep direct HLS4/HLS/HTTP playback unchanged (proxy only needed for audio switching)
- Add proxy base URL to app settings/config
5. CORS
- Proxy must return
Access-Control-Allow-Origin: * headers
- KinoPub CDN already serves segments with permissive CORS
6. Caching
- Cache rewritten playlists for ~30s (same audio+quality+url = same result)
- No caching of video segments (not proxied)
Complexity estimate
- Proxy: ~50 lines of code (Cloudflare Worker / Node.js)
- Client changes: ~20 lines in
player.ts
- Total: small task, biggest part is deployment setup
Problem
Tizen 2.3 (Chrome 28) does not support the
audioTracksAPI, and hls.js 0.14 cannot switch audio groups in HLS master playlists. This makes runtime audio track switching impossible for both HTTP and HLS streams.KPSTV solves this with a lightweight HLS manifest rewriter proxy.
Goal
Implement a minimal HLS manifest proxy that rewrites the master playlist to select a specific audio track and quality, so hls.js on Tizen 2.3 can play the correct audio without needing multi-audio support.
Implementation Plan
1. Proxy endpoint
GET /api/hls-proxy.m3u8?url=<base64_hls2_url>&audio=<index>&quality=<value>url— base64-encoded HLS2 master playlist URL from KinoPubaudio— audio track index (1-based, matchesaudios[].indexfrom API)quality—autoor specific quality string (e.g.720p), optional.m3u8playlist with correctContent-Type: application/vnd.apple.mpegurl2. Playlist rewriting logic
#EXT-X-MEDIA:TYPE=AUDIOentries — keep only the one matching the requested audio index#EXT-X-STREAM-INFentries:AUDIOgroup reference to point to the remaining audio trackqualityis specified (notauto), filter to keep only matching resolution3. Hosting options
4. Client integration
player.ts, when streaming type is HLS2 and audio switch is requested:PROXY_BASE + '/api/hls-proxy.m3u8?url=' + btoa(originalHls2Url) + '&audio=' + audioIndex5. CORS
Access-Control-Allow-Origin: *headers6. Caching
Complexity estimate
player.ts