SwiftVideoBackground alternatives and similar libraries
Based on the "UI" category.
Alternatively, view SwiftVideoBackground alternatives based on common mentions on social networks and blogs.
-
DZNEmptyDataSet
DISCONTINUED. A drop-in UITableView/UICollectionView superclass category for showing empty datasets whenever the view has no content to display -
IQKeyboardManager
Codeless drop-in universal library allows to prevent issues of keyboard sliding up and cover UITextField/UITextView. Neither need to write any code nor any setup required and much more. -
SkeletonView
☠️ An elegant way to show users that something is happening and also prepare them to which contents they are awaiting -
TTTAttributedLabel
A drop-in replacement for UILabel that supports attributes, data detectors, links, and more -
animated-tab-bar
:octocat: RAMAnimatedTabBarController is a Swift UI module library for adding animation to iOS tabbar items and icons. iOS library made by @Ramotion -
MGSwipeTableCell
An easy to use UITableViewCell subclass that allows to display swippable buttons with a variety of transitions. -
SWTableViewCell
An easy-to-use UITableViewCell subclass that implements a swippable content view which exposes utility buttons (similar to iOS 7 Mail Application) -
JVFloatLabeledTextField
UITextField subclass with floating labels - inspired by Matt D. Smith's design: http://dribbble.com/shots/1254439--GIF-Mobile-Form-Interaction?list=users -
FSPagerView
FSPagerView is an elegant Screen Slide Library. It is extremely helpful for making Banner View、Product Show、Welcome/Guide Pages、Screen/ViewController Sliders. -
JTAppleCalendar
The Unofficial Apple iOS Swift Calendar View. Swift calendar Library. iOS calendar Control. 100% Customizable -
SwipeCellKit
Swipeable UITableViewCell/UICollectionViewCell based on the stock Mail.app, implemented in Swift. -
SideMenu
Simple side/slide menu control for iOS, no code necessary! Lots of customization. Add it to your project in 5 minutes or less. -
Alerts & Pickers
Advanced usage of UIAlertController and pickers based on it: Telegram, Contacts, Location, PhotoLibrary, Country, Phone Code, Currency, Date... -
XLForm
XLForm is the most flexible and powerful iOS library to create dynamic table-view forms. Fully compatible with Swift & Obj-C. -
SwiftEntryKit
SwiftEntryKit is a presentation library for iOS. It can be used to easily display overlays within your iOS apps. -
TPKeyboardAvoiding
A drop-in universal solution for moving text fields out of the way of the keyboard in iOS -
PageMenu
A paging menu controller built from other view controllers placed inside a scroll view (like Spotify, Windows Phone, Instagram) -
CSStickyHeaderFlowLayout
UICollectionView replacement of UITableView. Do even more like Parallax Header, Sticky Section Header. Made for iOS 7. -
SWRevealViewController
A UIViewController subclass for presenting side view controllers inspired on the FaceBook and Wunderlist apps, done right ! -
Material Components
[In maintenance mode] Modular and customizable Material Design UI components for iOS -
expanding-collection
:octocat: ExpandingCollection is an animated material design UI card peek/pop controller. iOS library made by @Ramotion
CodeRabbit: AI Code Reviews for Developers

* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of SwiftVideoBackground or a related project?
README
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.
Features
- [x] Play a video with one line of code
- [x] Supports local videos
&&
videos from a web URL - [x] Automatically adjusts when device orientation changes
- [x] Automatically resumes video when app re-enters foreground
- [x] Pause, resume, restart, and other controls
- [x] Loop videos (optional)
- [x] Mute sound (optional)
- [x] Darken videos so overlying UI stands out more (optional)
- [x] Documentation
Contents
Integration
CocoaPods
You can use CocoaPods to install SwiftVideoBackground
by adding it to your Podfile
:
For Swift 5:
pod 'SwiftVideoBackground'
For Swift 4:
pod 'SwiftVideoBackground', '~> 3.0'
For Swift 3:
pod 'SwiftVideoBackground', '0.06'
Carthage
You can use Carthage to install SwiftVideoBackground
by adding it to your Cartfile
:
github "dingwilson/SwiftVideoBackground"
Manually
To use this library in your project manually you may:
- for Projects, just drag VideoBackground.swift to the project tree
- for Workspaces, include the whole SwiftVideoBackground.xcodeproj
Migration Guide
Version 3.0.0
- Passing in an array of videos support removed. You should merge videos in advance instead. Here is a walk through on concatenating media files with FFmpeg.
alpha
renamed todarkness
Version 2.0.0
See the quick [migration guide](migration-2.0.0.md).
Usage
Example
import UIKit
import SwiftVideoBackground
class MyViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
try? VideoBackground.shared.play(view: view, videoName: "myVideo", videoType: "mp4")
/* or from URL */
let url = URL(string: "https://coolVids.com/coolVid.mp4")!
VideoBackground.shared.play(view: view, url: url)
}
}
Documentation for Version 0.06 (Swift 3) can be found [here](README-0.06.md).
Customization
play()
has four additional optional parameters for customization:
darkness
: CGFloat - Value between0
and1
. The higher the value, the darker the video. Defaults to0
.isMuted
: Bool - Indicates whether video is muted. Defaults totrue
.willLoopVideo
: Bool - Indicates whether video should restart when finished. Defaults totrue
.setAudioSessionAmbient
: Bool - Indicates whether to set the sharedAVAudioSession
to ambient. If this is not done, audio played from your app will pause other audio playing on the device. Defaults totrue
.
So for example:
VideoBackground.shared.play(
view: view,
videoName: "myVideo",
videoType: "mp4",
darkness: 0.25,
isMuted: false,
willLoopVideo: true,
setAudioSessionAmbient: true
)
-> will play the video with the sound on, slightly darkened, continuously looping, and without affecting other sources of audio on the device.
Any combination of the parameters can be included or left out.
setAudioSessionAmbient
only has an effect in iOS 10.0+. For more information, see the docs.
Controls
pause()
- Pauses the video.resume()
- Resumes the video.restart()
- Restarts the video.getThumbnailImage(from: URL, at: CMTime)
- Generate an image from the video to show as thumbnail.darkness
- Change thisCGFloat
to adjust the darkness of the video. Value0
to1
. Higher numbers are darker. Setting to an invalid value does nothing.isMuted
- Change thisBool
to mute/unmute the video.willLoopVideo
- Change thisBool
to set whether the video restarts when it ends.videoGravity
- Default is.resizeAspectFill
. Change to.resizeAspect
(doesn't fill view) or.resize
(doesn't conserve aspect ratio).playerLayer
- TheAVPlayerLayer
that can be accessed for advanced control and customization of the video.
Singleton
SwiftVideoBackground
includes a singleton instance that can be conveniently accessed with VideoBackground.shared
. An instance of VideoBackground
can only play one video on one UIView
at a time. So if you need to play on multiple UIView
s, you need to retain an instance of VideoBackground
for each UIView
:
let videoBackground1 = VideoBackground()
Adding Videos To Your Project
In order to play local videos, you must add them to your project:
- Open project navigator
- Select your target
- Select
Build Phases
- Select
Copy Bundle Resources
- Click
+
to add a video
License
SwiftVideoBackground
is released under an MIT License. See [LICENSE](LICENSE) for details.
Authors
Copyright © 2016-present Wilson Ding.
Please provide attribution, it is greatly appreciated.
*Note that all licence references and agreements mentioned in the SwiftVideoBackground README section above
are relevant to that project's source code only.