Notable changes in 2.0.0:
- renamed class from
BackgroundVideo
toVideoBackground
for consistency with package name - class is no longer a subclass of
UIView
- only one API is exposed,
play()
, see documentation for more information play()
requires aUIView
passed in. It will play your video on this view. Typical usage would just be to pass in theUIView
class property of yourUIViewController
.
Example:
import UIKit
import SwiftVideoBackground
class MyViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
try? VideoBackground.shared.play(view: view, name: "myvideo", type: "mp4")
}
}
In this example, the class property view
of the UIViewController
was passed in. No need to create a new UIView
.
Be sure to check the docs for info about playing multiple videos, sound, video brightness, and looping options.