测试已测试 | ✗ |
语言语言 | SwiftSwift |
许可证 | MIT |
发布最后发布 | 2017年11月 |
SwiftSwift 版本 | 4 |
SPM支持 SPM | ✗ |
由 Chris Jimenez 维护。
一个显示背景视频的视图控制器,就像 Spotify!
在 CocoaPods 上获取 VideoBackgroundViewController
,只需将 pod 'VideoBackgroundViewController'
添加到 Podfile
中,然后运行 pod install
。
用法很简单,只需将您的 ViewController 继承自 VideoBackgroundViewController
并设置初始视频 URL,如下:
import VideoBackgroundViewController
override func viewDidLoad() {
super.viewDidLoad()
let url = NSURL.fileURLWithPath(NSBundle.mainBundle().pathForResource("spotifyVideo", ofType: "mp4")!)
self.videoURL = url
}
您还可以自定义默认值,例如:
import VideoBackgroundViewController
override func viewDidLoad() {
super.viewDidLoad()
let url = NSURL.fileURLWithPath(NSBundle.mainBundle().pathForResource("spotifyVideo", ofType: "mp4")!)
self.videoURL = url
self.videoFrame = view.frame
self.videoShouldLoop = true
self.alpha = 0.5
self.playSound = true
self.videoScalingMode = .ResizeAspectFill
}
Chris Jimenez - http://chrisjimenez.net,@chrisjimeneznat
一些想法来自 https://github.com/allenwong/30DaysofSwift
如果您想给我买杯啤酒,您可以通过以下币地址捐赠:
1BeGBew4CBdLgUSmvoyiU1LrM99GpkXgkj
0xa59a3793E3Cb5f3B1AdE6887783D225EDf67192d
Ld6FB3Tqjf6B8iz9Gn9sMr7BnowAjSUXaV
VideoBackgroundViewController
基于 MIT 许可证发布。有关详情,请参阅 LICENSE。