wxxsw / Videoplayer
Licence: mit
📽 A video player for SwiftUI, support for caching, preload and custom control view. SwiftUI 视频播放器,支持边下边播、预加载、自定义控制层
Stars: ✭ 212
Programming Languages
swift
15916 projects
Projects that are alternatives of or similar to Videoplayer
Sjvideoplayer
iOS VideoPlayer MediaPlayer video player media player 短视频播放器 可接入 ijkplayer aliplayer alivodplayer plplayer
Stars: ✭ 2,066 (+874.53%)
Mutual labels: player, avplayer, videoplayer
Ezplayer
基于AVPlayer封装的视频播放器,功能丰富,快速集成,可定制性强,支持react-native。
Stars: ✭ 377 (+77.83%)
Mutual labels: player, avplayer
Magicalexoplayer
The Easiest Way To Play/Stream Video And Audio Using Google ExoPlayer In Your Android Application
Stars: ✭ 171 (-19.34%)
Mutual labels: player, videoplayer
Fradioplayer
A simple radio player framework for iOS, macOS, tvOS.
Stars: ✭ 183 (-13.68%)
Mutual labels: player, avplayer
KingPlayer
🎬 一个专注于 Android 视频播放器的基础库,无缝切换内核。(IjkPlayer、ExoPlayer、VlcPlayer、MediaPlayer)
Stars: ✭ 35 (-83.49%)
Mutual labels: player, videoplayer
Zftplayer
iOS平台下基于IJKplayer封装的视频播放器,主要适用于视频点播。针对视频格式,前后台切换,内存管理控件的层级分离做了相应优化
Stars: ✭ 273 (+28.77%)
Mutual labels: player, videoplayer
Xgplayer
A HTML5 video player with a parser that saves traffic
Stars: ✭ 4,792 (+2160.38%)
Mutual labels: player, videoplayer
React Native Ezplayer
EZPlayer component for react-native apps
Stars: ✭ 47 (-77.83%)
Mutual labels: player, avplayer
Mkvideoplayer
MKVideoPlayer library is a video player have some basic features that need to develop an video player application in android studio
Stars: ✭ 54 (-74.53%)
Mutual labels: player, videoplayer
Kjplayerdemo
视频播放壳子:动态切换内核,支持边下边播边缓存的播放器方案,视频支持格式:mp4、m3u8、wav、avi,音频支持格式:midi、mp3
Stars: ✭ 60 (-71.7%)
Mutual labels: player, avplayer
MBVideoPlayer
A video player on top of AVQueuePlayer with custom header, playlist items, play, pause, seek to slider, time, resize to fullscreen, forward, backward horizontal, vertical capabilities.
Stars: ✭ 103 (-51.42%)
Mutual labels: avplayer, videoplayer
VideoPlayerBot
An Telegram Bot By @AsmSafone To Stream Videos in Telegram Voice Chat. This is Also The Source Code of The Bot Which is Being Used In Our Support Group! ❤️
Stars: ✭ 187 (-11.79%)
Mutual labels: player, videoplayer
Fwplayer
A video player SDK for iOS, it is based on AVPlayer. https://se.linkedin.com/in/foks-huiwang, https://fokswang.wixsite.com/home
Stars: ✭ 321 (+51.42%)
Mutual labels: player, avplayer
AutoVideoPlayer
Easily Play/Pause videos in any UIView subclass especially UITableViewCell subclass
Stars: ✭ 88 (-58.49%)
Mutual labels: avplayer, videoplayer
audioStreamDemo
A music player created in swift using AVPlayer to stream audio from server.
Stars: ✭ 33 (-84.43%)
Mutual labels: player, avplayer
Ios P2p Engine
Let your viewers become your unlimitedly scalable CDN.
Stars: ✭ 31 (-85.38%)
Mutual labels: player, avplayer
Demo
- Clone or download the project.
- In the terminal, run
swift package resolve
. - Open
VideoPlayer.xcodeproj
and runDemo
target.
Features
- [x] Fully customizable UI.
- [x] Plays local media or streams remote media over HTTP.
- [x] Built-in caching mechanism to support playback while downloading.
- [x] Can preload multiple videos at any time.
- [x] Support seek to duration.
- [x] Simple API.
Quick Start
struct ContentView : View {
@State private var play: Bool = true
var body: some View {
VideoPlayer(url: someVideoURL, play: $play)
}
}
Advances
struct ContentView : View {
@State private var autoReplay: Bool = true
@State private var mute: Bool = false
@State private var play: Bool = true
@State private var time: CMTime = .zero
var body: some View {
VideoPlayer(url: someVideoURL, play: $play, time: $time)
.autoReplay(autoReplay)
.mute(mute)
.onBufferChanged { progress in
// Network loading buffer progress changed
}
.onPlayToEndTime {
// Play to the end time.
}
.onReplay {
// Replay after playing to the end.
}
.onStateChanged { state in
switch state {
case .loading:
// Loading...
case .playing(let totalDuration):
// Playing...
case .paused(let playProgress, let bufferProgress):
// Paused...
case .error(let error):
// Error...
}
}
}
}
Preload
Set the video urls to be preload queue. Preloading will automatically cache a short segment of the beginning of the video and decide whether to start or pause the preload based on the buffering of the currently playing video.
VideoPlayer.preload(urls: [URL])
Set the preload size, the default value is 1024 * 1024, unit is byte.
VideoPlayer.preloadByteCount = 1024 * 1024 // = 1M
Cache
Get the total size of the video cache.
let size = VideoPlayer.calculateCachedSize()
Clean up all caches.
VideoPlayer.cleanAllCache()
Installation
Swift Package Manager
- Select
Xcode -> File -> Swift Packages -> Add Package Dependency...
- Enter
https://github.com/wxxsw/VideoPlayer
. - Click
Next
, then select the version, complete.
Requirements
- iOS 13+
- Xcode 11+
- Swift 5+
Thanks
Banner Design by @aduqin
License
VideoPlayer is released under the MIT license. See LICENSE for details.
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].