https://github.com/douking/stmurlasset
A subclass of AVURLAsset that can cache data downloaded by AVPlayer.
https://github.com/douking/stmurlasset
avplayer avurlasset cache
Last synced: 12 months ago
JSON representation
A subclass of AVURLAsset that can cache data downloaded by AVPlayer.
- Host: GitHub
- URL: https://github.com/douking/stmurlasset
- Owner: DouKing
- License: mit
- Created: 2020-10-28T11:48:08.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-06-25T08:06:34.000Z (almost 2 years ago)
- Last Synced: 2025-06-11T01:18:14.599Z (about 1 year ago)
- Topics: avplayer, avurlasset, cache
- Language: Swift
- Homepage:
- Size: 182 KB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# STMURLAsset
`STMURLAsset` is a subclass of `AVURLAsset` that can cache data downloaded by `AVPlayer`.
### Usage
Just use it like `AVURLAsset`
```swift
let url = URL(string: "http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4")!
let asset = STMURLAsset(url: url)
asset.preloadAsynchronously()
let playerItem = AVPlayerItem(asset: asset)
let player = AVPlayer(playerItem: playerItem)
let playerView = PlayerView()
playerView.playerLayer.player = player
```
### Installation
##### Swift Package Manager
- File > Swift Packages > Add Package Dependency
- Add `https://github.com/douking/STMURLAsset`
- Select "Up to Next Major" with "0.1.0"
##### Cocoapods
Add the following line to your Podfile:
```ruby
pod 'STMURLAsset'
```
### License
`STMURLAsset` is available under the MIT license. See the LICENSE file for more info.