HLSCachingReverseProxyServer
A simple local reverse proxy server for HLS segment cache
Install / Use
/learn @StyleShare/HLSCachingReverseProxyServerREADME
HLSCachingReverseProxyServer
A simple local reverse proxy server for HLS segment cache.
How it works

- User sets a reverse proxy url to the
AVPlayerinstead of the origin url.- https://example.com/vod.m3u8 + http://127.0.0.1:8080/vod.m3u8?__hls_origin_url=https://example.com/vod.m3u8 - AVPlayer requests a playlist(
.m3u8) to the local reverse proxy server. - Reverse proxy server fetches the origin playlist and replaces all URIs to point the localhost.
#EXTM3U #EXTINF:12.000, - vod_00001.ts + http://127.0.0.1:8080/vod.m3u8?__hls_origin_url=https://example.com/vod_00001.ts #EXTINF:12.000, - vod_00002.ts + http://127.0.0.1:8080/vod.m3u8?__hls_origin_url=https://example.com/vod_00002.ts #EXTINF:12.000, - vod_00003.ts + http://127.0.0.1:8080/vod.m3u8?__hls_origin_url=https://example.com/vod_00003.ts - AVPlayer requests segments(
.ts) to the local reverse proxy server. - Reverse proxy server fetches the origin segment and caches it. Next time the server will return the cached data for the same segment.
Usage
let server = HLSCachingReverseProxyServer()
server.start(port: 8080)
let playlistURL = URL(string: "http://devstreaming.apple.com/videos/wwdc/2016/102w0bsn0ge83qfv7za/102/0640/0640.m3u8")!
let reverseProxyURL = server.reverseProxyURL(from: playlistURL)!
let playerItem = AVPlayerItem(url: reverseProxyURL)
self.player.replaceCurrentItem(with: playerItem)
Dependencies
Installation
Use CocoaPods with Podfile:
pod 'HLSCachingReverseProxyServer'
Development
$ make project
$ open HLSCachingReverseProxyServer.xcworkspace
License
HLSCachingReverseProxyServer is under MIT license. See the LICENSE for more info.
Related Skills
node-connect
348.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
108.8kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
348.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
348.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
