Skip to content

A View Controller that shows a video in the background, like Spotify

License

Notifications You must be signed in to change notification settings

PiXeL16/VideoBackgroundViewController

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Banner

Build Status codecov.io GitHub licenseswift4

VideoBackgroundViewController

A View Controller that shows a video in the background, like Spotify!

VideoBackgroundViewControllerGif

⭐ Features

  • Customizable video URL.
  • Play video with sound or not.
  • Customizable sound level.
  • Customizable video alpha channel.
  • Loop the video or not
  • Customizable video scaling mode. Resize, ResizeAspect, ResizeAspectFill(Default)
  • Works in portrait and landscape orientation

:octocat: Installation

Get VideoBackgroundViewController on CocoaPods, just add pod 'VideoBackgroundViewController' to your Podfile and then run pod install.

🤘 Usage

Usage is pretty easy, just inherid your ViewController from VideoBackgroundViewController and set your initial video URL like:

import VideoBackgroundViewController

override func viewDidLoad() {
     super.viewDidLoad()

     let url = NSURL.fileURLWithPath(NSBundle.mainBundle().pathForResource("spotifyVideo", ofType: "mp4")!)

     self.videoURL = url
 }

You can also customize the default values like:

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
 }

TODO

  • Protocolize the f*ck out of this
  • Better code coverage

👽 Author

Chris Jimenez - http://chrisjimenez.net, @chrisjimeneznat

Some ideas where taken from https://github.com/allenwong/30DaysofSwift

🍺 Donate

If you want to buy me a beer, you can donate to my coin addresses below:

BTC

1BeGBew4CBdLgUSmvoyiU1LrM99GpkXgkj

ETH

0xa59a3793E3Cb5f3B1AdE6887783D225EDf67192d

LTC

Ld6FB3Tqjf6B8iz9Gn9sMr7BnowAjSUXaV

License

VideoBackgroundViewController is released under the MIT license. See LICENSE for details.

About

A View Controller that shows a video in the background, like Spotify

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •