BackgroundVideoiOS
A swift and objective-C object that lets you add a background video to iOS views
Install / Use
/learn @Guzlan/BackgroundVideoiOSREADME
BackgroundVideoiOS
This is an Object/Class which lets you add a background video to iOS app views. This is seen at login views of some famous apps like Spotify, tumbler and Vimeo
This is how they look..
<section> <img src="Screenshots/SpotifyGif.gif" width="32%" height="auto"> <img src="Screenshots/VimeoGif.gif" width="32%" height="auto"> <img src="Screenshots/TumblerGif.gif" width="32%" height="auto"> </section> ##### It does the following: * *Creates an AVPlayer object for you and plays a video from your app bundle*-
Handles video looping
-
Handles app going to background and coming back to foreground
-
Handles seguing away and back again to the view that plays the video
-
Mutes the video and does not allow it to interrupt other audio services. For example, it does not stop music playing from your music app or a VoIP call
Instructions for Swift:
-
Have an awesome video that you want to show as your background
-
Drag and drop
<img src="Screenshots/dragdrop1.png">BackgroundVideo.swiftfile to your Project navigator -
Drag and drop the video to your project and make sure to check
Copy items if neededas well asAdd to targets(This is because the object will look at your app's main bunddle)
<img src="Screenshots/dragdrop2.png"> <img src="Screenshots/instruction.png">
-
Go to the view controller where you want to display the video and declare an instance.
var backgroundPlayer : BackgroundVideo? // Declare an instance of BackgroundVideo called backgroundPlayer -
In your
viewDidLoad()method, initialize your instance with the view controller you're using and the name of thevideo file with it's extensionas parameters (make sure you seperate your name and extension by a period). In the following code I'm passing the same view controller where I declared my instance, namelyself. Then, just call the functionsetUpBackground()on your instance.
override func viewDidLoad() {
super.viewDidLoad()
// Initializing your instance
backgroundPlayer = BackgroundVideo(onViewController: self, withVideoURL: "test.mp4") // Passing self and video name with extension
backgroundPlayer?.setUpBackground()
}
Instructions for Objective-C:
-
Do steps 1-3 from the Swift steps above, but instead of dragging
BackgroundVideo.swift, drag and dropBackgroundVideoObjC.handBackgroundVideoObjC.m. -
Go to the view controller where you want to display the video and declare an instance.
@property (strong, nonatomic) BackgroundVideoObjC *backgroundVideo; -
Same as 5 from Swift steps, except use this code:
- (void)viewDidLoad {
self.backgroundVideo = [[BackgroundVideoObjC alloc] initOnViewController:self withVideoURL:@"test.mp4"];
[self.backgroundVideo setUpBackground];
}
That's it, you're ready to go :)!
Related Skills
qqbot-channel
343.3kQQ 频道管理技能。查询频道列表、子频道、成员、发帖、公告、日程等操作。使用 qqbot_channel_api 工具代理 QQ 开放平台 HTTP 接口,自动处理 Token 鉴权。当用户需要查看频道、管理子频道、查询成员、发布帖子/公告/日程时使用。
docs-writer
99.7k`docs-writer` skill instructions As an expert technical writer and editor for the Gemini CLI project, you produce accurate, clear, and consistent documentation. When asked to write, edit, or revie
model-usage
343.3kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
project-overview
FlightPHP Skeleton Project Instructions This document provides guidelines and best practices for structuring and developing a project using the FlightPHP framework. Instructions for AI Coding A
