{"id":13588310,"url":"https://github.com/StyleShare/HLSCachingReverseProxyServer","last_synced_at":"2025-04-08T03:33:22.110Z","repository":{"id":53483714,"uuid":"222515214","full_name":"StyleShare/HLSCachingReverseProxyServer","owner":"StyleShare","description":"A simple local reverse proxy server for HLS segment cache","archived":false,"fork":false,"pushed_at":"2021-03-29T09:40:37.000Z","size":13,"stargazers_count":150,"open_issues_count":9,"forks_count":29,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-11-05T14:52:23.552Z","etag":null,"topics":["cache","hls","ios","reverse-proxy-server","segment"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/StyleShare.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-11-18T18:22:36.000Z","updated_at":"2024-10-06T03:07:58.000Z","dependencies_parsed_at":"2022-08-18T03:01:10.086Z","dependency_job_id":null,"html_url":"https://github.com/StyleShare/HLSCachingReverseProxyServer","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StyleShare%2FHLSCachingReverseProxyServer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StyleShare%2FHLSCachingReverseProxyServer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StyleShare%2FHLSCachingReverseProxyServer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StyleShare%2FHLSCachingReverseProxyServer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StyleShare","download_url":"https://codeload.github.com/StyleShare/HLSCachingReverseProxyServer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223300739,"owners_count":17122679,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cache","hls","ios","reverse-proxy-server","segment"],"created_at":"2024-08-01T15:06:37.681Z","updated_at":"2024-11-06T07:31:20.156Z","avatar_url":"https://github.com/StyleShare.png","language":"Swift","readme":"# HLSCachingReverseProxyServer\n\n![Swift](https://img.shields.io/badge/Swift-5.1-orange.svg)\n[![CocoaPods](http://img.shields.io/cocoapods/v/HLSCachingReverseProxyServer.svg)](https://cocoapods.org/pods/HLSCachingReverseProxyServer)\n[![Build Status](https://github.com/StyleShare/HLSCachingReverseProxyServer/workflows/CI/badge.svg)](https://github.com/StyleShare/HLSCachingReverseProxyServer/actions)\n[![CodeCov](https://img.shields.io/codecov/c/github/StyleShare/HLSCachingReverseProxyServer.svg)](https://codecov.io/gh/StyleShare/HLSCachingReverseProxyServer)\n\nA simple local reverse proxy server for HLS segment cache.\n\n## How it works\n\n![HLSCachingReverseProxyServer Concept](https://user-images.githubusercontent.com/931655/69081879-45206a80-0a82-11ea-8fca-3c09f3b1ebb1.png)\n\n1. **User** sets a reverse proxy url to the `AVPlayer` instead of the origin url.\n    ```diff\n    - https://example.com/vod.m3u8\n    + http://127.0.0.1:8080/vod.m3u8?__hls_origin_url=https://example.com/vod.m3u8\n    ```\n2. **AVPlayer** requests a playlist(`.m3u8`) to the local reverse proxy server.\n3. **Reverse proxy server** fetches the origin playlist and replaces all URIs to point the localhost.\n    ```diff\n      #EXTM3U\n      #EXTINF:12.000,\n    - vod_00001.ts\n    + http://127.0.0.1:8080/vod.m3u8?__hls_origin_url=https://example.com/vod_00001.ts\n      #EXTINF:12.000,\n    - vod_00002.ts\n    + http://127.0.0.1:8080/vod.m3u8?__hls_origin_url=https://example.com/vod_00002.ts\n      #EXTINF:12.000,\n    - vod_00003.ts\n    + http://127.0.0.1:8080/vod.m3u8?__hls_origin_url=https://example.com/vod_00003.ts\n    ```\n4. **AVPlayer** requests segments(`.ts`) to the local reverse proxy server.\n5. **Reverse proxy server** fetches the origin segment and caches it. Next time the server will return the cached data for the same segment.\n\n## Usage\n\n```swift\nlet server = HLSCachingReverseProxyServer()\nserver.start(port: 8080)\n\nlet playlistURL = URL(string: \"http://devstreaming.apple.com/videos/wwdc/2016/102w0bsn0ge83qfv7za/102/0640/0640.m3u8\")!\nlet reverseProxyURL = server.reverseProxyURL(from: playlistURL)!\nlet playerItem = AVPlayerItem(url: reverseProxyURL)\nself.player.replaceCurrentItem(with: playerItem)\n```\n\n## Dependencies\n\n* [GCDWebServer](https://github.com/swisspol/GCDWebServer)\n* [PINCache](https://github.com/pinterest/PINCache)\n\n## Installation\n\nUse CocoaPods with **Podfile**:\n\n```ruby\npod 'HLSCachingReverseProxyServer'\n```\n\n## Development\n\n```console\n$ make project\n$ open HLSCachingReverseProxyServer.xcworkspace\n```\n\n## License\n\nHLSCachingReverseProxyServer is under MIT license. See the [LICENSE](LICENSE) for more info.\n","funding_links":[],"categories":["Swift","HarmonyOS","Video Streaming \u0026 Distribution Solutions"],"sub_categories":["Windows Manager","Edge Computing \u0026 Caching Solutions"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FStyleShare%2FHLSCachingReverseProxyServer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FStyleShare%2FHLSCachingReverseProxyServer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FStyleShare%2FHLSCachingReverseProxyServer/lists"}