{"id":49783218,"url":"https://github.com/foyoodo/mediacache","last_synced_at":"2026-05-11T23:04:41.491Z","repository":{"id":342244778,"uuid":"1165816058","full_name":"foyoodo/MediaCache","owner":"foyoodo","description":"Async AVPlayer media streaming with pluggable caching","archived":false,"fork":false,"pushed_at":"2026-03-05T09:47:32.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-05T13:55:55.401Z","etag":null,"topics":["async-await","avplayer","caching","http-range","ios","macos","media-streaming","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/foyoodo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-02-24T15:20:21.000Z","updated_at":"2026-03-05T09:47:36.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/foyoodo/MediaCache","commit_stats":null,"previous_names":["foyoodo/mediacache"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/foyoodo/MediaCache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foyoodo%2FMediaCache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foyoodo%2FMediaCache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foyoodo%2FMediaCache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foyoodo%2FMediaCache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/foyoodo","download_url":"https://codeload.github.com/foyoodo/MediaCache/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/foyoodo%2FMediaCache/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32916340,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-11T17:09:15.040Z","status":"ssl_error","status_checked_at":"2026-05-11T17:08:45.420Z","response_time":120,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["async-await","avplayer","caching","http-range","ios","macos","media-streaming","swift"],"created_at":"2026-05-11T23:04:37.554Z","updated_at":"2026-05-11T23:04:41.477Z","avatar_url":"https://github.com/foyoodo.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MediaCache\n\n`MediaCache` is an asynchronous media loading layer for `AVPlayer`.\nIt uses `AVAssetResourceLoader` + HTTP range requests to stream remote media as async chunks, while keeping caching pluggable.\n\n## Requirements\n\n- Swift 6.0+\n- iOS 14+ / macOS 11+\n\n## Features\n\n- Async content metadata loading (`ContentInfo`)\n- Async chunk streaming (`AsyncThrowingStream\u003cData, Error\u003e`)\n- HTTP `Range`-based segmented fetching\n- `AVURLAsset` integration via `ResourceLoader.asset()`\n- Pluggable cache interface via `Cache` protocol\n\n## Installation\n\n### Swift Package Manager\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/foyoodo/MediaCache.git\", branch: \"main\")\n]\n```\n\nThen link `MediaCache` in your target:\n\n```swift\ntargets: [\n    .target(\n        name: \"YourTarget\",\n        dependencies: [\"MediaCache\"]\n    )\n]\n```\n\n## Quick Start\n\n### Audio\n\n```swift\nimport AVFoundation\nimport MediaCache\n\nlet audioURL = URL(string: \"https://example.com/audio/sample.mp3\")!\nlet loader = ResourceLoader(resource: audioURL)\nlet asset = loader.asset()\n\nlet playerItem = AVPlayerItem(asset: asset)\nlet player = AVPlayer(playerItem: playerItem)\nplayer.play()\n```\n\n## Custom Cache\n\nImplement the `Cache` protocol to add persistent caching:\n\n```swift\nstruct MyCache: Cache {\n    func contentInfo(of media: Media) async throws -\u003e ContentInfo? {\n        // Read from persistent storage\n    }\n\n    func save(contentInfo: ContentInfo, of media: Media) async {\n        // Persist content info\n    }\n\n    func read(at offset: Int, length: Int, of media: Media) async throws -\u003e Data? {\n        // Read cached data range\n    }\n\n    func write(data: Data, at offset: Int, of media: Media) async {\n        // Persist data chunk\n    }\n}\n\n// Use with MediaTask\nlet cache = MyCache()\nlet task = MediaTask(session: session, media: media, cache: cache)\n```\n\n## Architecture\n\n```\nSources/MediaCache\n├── ResourceLoader/       # AVAssetResourceLoader adapter and request routing\n├── Networking/           # URLSession delegate + chunked data flow\n├── Cache/                # Cache protocol definitions\n├── MediaTask.swift       # Per-media task lifecycle and streaming logic\n└── MediaManager.swift    # Global media task manager\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoyoodo%2Fmediacache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffoyoodo%2Fmediacache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffoyoodo%2Fmediacache/lists"}