Video Feed
Displaying the Video Feed
Displaying a video feed can be done by using a VideoFeedViewController
either programmatically or in a storyboard.
Programmatic
Import FireworkVideo
Create a new
VideoFeedViewController
Present, show or embed the instantiated
VideoFeedViewController
Storyboard
Adding a VideoFeedViewController
to a storyboard is easy but has limited support. Therefore, layout and customizations can only be made progrgammatically. Both layout and customizations changes can be made at anytime. This allows you to add a VideoFeedViewController
via storyboard then make adjustments programmatically.
Open storyboard
Add and select a
UIViewController
In the Inspector pane, select the Identity inspector
Add
VideoFeedViewController
as the Custom ClassMake sure the Module is set to
FireworkVideo
Custom Call-To-Action Button Handling
Custom Call-To-Action button handling is done via the FireworkVideoCTADelegate
protocol. This provides control over what occurs when a call-to-action button is tapped.
Set the delegate:
2. Confirm to protocol:
Force Refresh
A VideoFeedViewController
can be hard refreshed by calling the refresh()
method on the instance that should be refreshed. This functionality is useful if your feed is embedded along with other components that are also updated and you support features like pull to refresh.
Picture in Picture (PiP)
This feature allows the user to watch media while the application is in a backgrounded state. While in background mode a video will display in a floating, resizable window.
To enable PiP functionality, you’ll need to add Background Modes capability via Signing & Capabilities in your project settings. More information about this can be found here: Apple Documentation
Once the background mode is enabled, moving from an active state to a background state will immediately trigger the Picture In Picture functionality. PictureInPictureController is responsible for handling all of this functionality. PictureInPictureController retains a strong reference of AVPictureInPictureController. AVPictureInPictureController is a controller that responds to user-initiated Picture in Picture playback of video in a floating, resizable window.
Last updated