TBVideoSplashScreen 0.1.1

TBVideoSplashScreen 0.1.1

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Jul 2015
SPMSupports SPM

Maintained by Terry Bu.



  • By
  • Terry Bu

This library is for any iOS Developer who wants to display a video as the splash screen instead of a boring static launch image.

In your AppDelegate.swift, import TBVideoSplashScreen and follow below code in didFinishLaunchingWithOptions. The launch image you pass to makeAndPlayVideoSplashScreen is there for the best visual experience. Get the first frame of your video as a static image and set it as that image. While your video loads, that launch image will be the first thing shown to the user, giving the illusion that videoloading is slightly faster

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    // Override point for customization after application launch.

    TBVideoSplashScreen.makeAndPlayVideoSplashScreen(self, videoNameString: "splashScreen", withExtension: "mp4", launchImageString: "launchScreenImage")

    return true
}

Make sure you implement @objc moviePlayBackDidFinish() as callback method in the same file. This is the method that gets fired automatically upon video playback completion.

@objc
func moviePlayBackDidFinish() {
    //any custom logic for callback goes here
    let vc: UIViewController =  UIStoryboard(name: "Main", bundle: nil).instantiateViewControllerWithIdentifier("ViewController") as! UIViewController
    let navCtrl = UINavigationController(rootViewController: vc)
    window?.rootViewController! = navCtrl
    NSNotificationCenter.defaultCenter().removeObserver(self)
}

Usage

To run the example project, clone repo, and run pod install from the Example directory first.

Requirements

Installation

TBVideoSplashScreen is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "TBVideoSplashScreen"

Author

Terry Bu, [email protected]

License

TBVideoSplashScreen is available under the MIT license. See the LICENSE file for more info.