You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- renamed class from `BackgroundVideo` to `VideoBackground` for consistency with package name
6
+
- class is no longer a subclass of `UIView`
7
+
- instantiate an instance simply with `let videoBackground = VideoBackground()`
8
+
- only one API is exposed, `play()`. `play()` requires a `UIView` passed in. It will play your video on this view. Typical usage would just be to pass in the `UIView` class property of your `UIViewController`.
9
+
10
+
For more information, please see the [documentation](http://wilsonding.com/SwiftVideoBackground/)
11
+
12
+
For an example and help with migrating from previous verisons, please see the [migration guide](migration-2.0.0.md)
SwiftVideoBackground is an easy to use Swift framework that provides the ability to add a UIView of a video playing in the background to any ViewController. This provides a beautiful UI for login screens, or splash pages, as implemented by Spotify and many others.
18
+
19
+
1.[Requirements](#requirements)
20
+
2.[Integration](#integration)
21
+
-[Cocoapods](#cocoapods)
22
+
-[Carthage](#carthage)
23
+
-[Manually](#manually)
24
+
3.[Usage](#usage)
25
+
4.[License](#license)
26
+
27
+
## Requirements
28
+
29
+
- Swift 3+
30
+
- iOS 8+
31
+
32
+
## Integration
33
+
34
+
#### CocoaPods
35
+
You can use [CocoaPods](http://cocoapods.org/) to install `SwiftVideoBackground` by adding it to your `Podfile`:
36
+
37
+
For Swift 3:
38
+
```ruby
39
+
pod 'SwiftVideoBackground', '~> 0.06'
40
+
```
41
+
42
+
#### Carthage
43
+
You can use [Carthage](https://github.com/Carthage/Carthage) to install `SwiftVideoBackground` by adding it to your `Cartfile`:
44
+
```
45
+
github "dingwilson/SwiftVideoBackground"
46
+
```
47
+
48
+
#### Manually
49
+
50
+
To use this library in your project manually you may:
51
+
52
+
1. for Projects, just drag BackgroundVideo.swift to the project tree
53
+
2. for Workspaces, include the whole SwiftVideoBackground.xcodeproj
54
+
55
+
## Usage
56
+
57
+
Import the framework into the ViewController
58
+
```swift
59
+
importSwiftVideoBackground
60
+
```
61
+
62
+
Link a UIView within a ViewController within the Storyboard to a BackgroundVideo item, or link it programmatically.
63
+
```swift
64
+
var backgroundVideo : BackgroundVideo!
65
+
```
66
+
67
+
Use the `createBackgroundVideo` function, with the name of the video or gif under `name`, and the file type under `type`. You can also include an alpha value between 0 and 1 under `alpha`, to adjust the brightness of the video.
Note: Make sure you have added a video file to the project, and targeted the project. Also, make sure that you have set the module to `SwiftVideoBackground` for the BackgroundVideo UIView.
76
+
77
+
## License
78
+
79
+
`SwiftVideoBackground` is released under an [MIT License][mitLink]. See `LICENSE` for details.
SwiftVideoBackground is an easy to use Swift framework that provides the ability to add a UIView of a video playing in the background to any ViewController. This provides a beautiful UI for login screens, or splash pages, as implemented by Spotify and many others.
17
+
SwiftVideoBackground is an easy to use Swift framework that provides the ability to play a video on any UIView. This provides a beautiful UI for login screens, or splash pages, as implemented by Spotify and many others.
18
18
19
-
1.[Requirements](#requrements)
19
+
1.[Requirements](#requirements)
20
20
2.[Integration](#integration)
21
-
-[Cocoapods](#cocoapods)
21
+
-[CocoaPods](#cocoapods)
22
22
-[Carthage](#carthage)
23
23
-[Manually](#manually)
24
-
3.[Usage](#usage)
25
-
4.[License](#license)
24
+
3.[Migration Guide](#migration-guide)
25
+
4.[Usage](#usage)
26
+
5.[License](#license)
27
+
6.[Authors](#authors)
26
28
27
29
## Requirements
28
30
@@ -36,7 +38,7 @@ You can use [CocoaPods](http://cocoapods.org/) to install `SwiftVideoBackground`
To use this library in your project manually you may:
56
58
57
-
1. for Projects, just drag BackgroundVideo.swift to the project tree
59
+
1. for Projects, just drag VideoBackground.swift to the project tree
58
60
2. for Workspaces, include the whole SwiftVideoBackground.xcodeproj
59
61
62
+
## Migration Guide
63
+
64
+
Version 2.0.0 brings improvements and breaking changes. See the quick migration guide [here](migration-2.0.0.md).
65
+
60
66
## Usage
61
67
62
-
Import the framework into the ViewController
63
-
```swift
64
-
importSwiftVideoBackground
65
-
```
68
+
#### Example
66
69
67
-
Link a UIView within a ViewController within the Storyboard to a BackgroundVideo item, or link it programmatically.
68
-
```swift
69
-
var backgroundVideo : BackgroundVideo!
70
-
```
70
+
```swift
71
+
importUIKit
72
+
importVideoBackground
71
73
72
-
Use the `createBackgroundVideo` function, with the name of the video or gif under `name`, and the file type under `type`. You can also include an alpha value between 0 and 1 under `alpha`, to adjust the brightness of the video.
Note: Make sure you have added a video file to the project, and targeted the project. Also, make sure that you have set the module to `SwiftVideoBackground` for the BackgroundVideo UIView.
85
+
> Documentation for Version 0.06 (Swift 3) can be found [here](README-0.06.md).
86
+
87
+
#### Customization Options
88
+
89
+
`play()` has three additional optional parameters for customization:
90
+
-`isMuted`: Bool - Indicates whether video is muted. Defaults to `true`.
91
+
-`alpha`: CGFloat - Value between 0 and 1. The higher the value, the darker the video. Defaults to `0`.
92
+
-`willLoopVideo`: Bool - Indicates whether video should restart when finished. Defaults to `true`.
81
93
82
-
To mute the video, simply set `isMuted` to true.
83
-
```swift
84
-
backgroundVideo.isMuted=true
94
+
So for example:
95
+
96
+
```swift
97
+
videoBackground.play(view: view,
98
+
videoName: "myvideo",
99
+
videoType: "mp4",
100
+
isMuted: false,
101
+
alpha: 0.25,
102
+
willLoopVideo: true)
85
103
```
86
104
105
+
-> will play the video with the sound on, slightly darkened, and will continuously loop.
106
+
107
+
> Any combination of the three can be included or left out.
108
+
109
+
#### Adding Videos To Your Project
110
+
111
+
You must properly add videos to your project in order to play them. To do this:
112
+
1. Open your project navigator
113
+
2. Select your target
114
+
3. Select `Build Phases`
115
+
4. Select `Copy Bundle Resources`
116
+
5. Click `+` to add a video
117
+
118
+

119
+
87
120
## License
88
121
89
-
`SwiftVideoBackground` is released under an [MIT License][mitLink]. See `LICENSE` for details.
122
+
`SwiftVideoBackground` is released under an [MIT License][mitLink]. See [LICENSE](LICENSE) for details.
s.summary="An easy to use Swift framework that creates a video background for any ViewController."
5
-
s.description="SwiftVideoBackground is an easy to use Swift framework that provides the ability to add a UIView of a video playing in the background to any ViewController. This provides a beautiful user interface for use in login screens, as well as other data input screens, as modeled by Spotify's iOS App Login Screen and others"
5
+
s.description="SwiftVideoBackground is an easy to use Swift framework that provides the ability to play a video on any UIView. This provides a beautiful UI for login screens, or splash pages, as implemented by Spotifyand many others"
0 commit comments