gumlet-Insights-avplayer
Gumlet Insights integration with AVPlayer for iOS native applications. This Insights enables you to get useful data about video usage in your apps. AVPlayer is an iOS native feature to manage the playback. AVPlayer are two approaches AVPlayerLayer and AVPlayerViewController. This integration is built on SWIFT, allowing thinner wrappers for player.
Step 1: Add the SDK to the Project
Gumlet Insights is available through CocoaPods and Swift package Manager.
Install Gumlet Insights SDK with Cocoapods
- Create Podfile or modify Podfile to use SDK(frameworks) by using use_frameworks!
- Add the pod inside the Podfile
def Gumlet-Insights
pod ‘Gumlet-Insights’ , ‘1.0.0’
end
- Run pod repo update to add the newly added source and run Pod install to install it.
Install Gumlet Insights SDK with Swift Package Manager(SwiftPM)
- In Xcode click “File” > ”Swift Packages” > “Add Package Dependency…”
- The package repository URL is - https://github.com/gumlet/gumlet-Insights-avplayer.git
- Click Next
- Select default version of the package up to next major, version and click Next
- Xcode downloads the Gumlet Insights package to the your app target.
- Click Finish.
Step 2: Setup the Gumlet Insights to the your app
Get Property ID from gumlet dashboard.
With AVPlayerViewController use initAVPlayerViewController method and if you are using AVPlayerLayer , use initAVPlayerLayer method instead.
let playerVC = AVPlayerViewController()
let gumletConfig = GumletInsightsConfig()
gumletConfig.proprtyId = "Your Property ID"
GumletInsightsSDK.initAVPlayerViewController(playerVC, config:gumletConfig)
Step 3: Add additional data
Add MetaData as per your requirement which can elivate your Insights. It allows you to filter your analytics data based on important fields. Gumlet allows metadata for user, player and video via GumletInsightsCustomUserData, GumletInsightsCustomPlayerData and GumletInsightsCustomVideoData
var gumletConfig = GumletInsightsConfig()
gumletConfig.proprtyId = "Your Property ID"
var userData = GumletInsightsCustomUserData()
userData.userName =“Gumlet”
userData.userEmail = “[email protected]”
userData.userCountry = “India”
var customVideoData = GumletInsightsCustomVideoData()
customVideoData.customContentType = “kids”
customVideoData.customVideoTitle = “Peppa Pig”
customVideoData.customVideoLanguage = “English”
var playerData = GumletInsightsCustomPlayerData()
playerData.GumletPlayerName = “AVPlayer”
playerData.GumletPlayerIntegrationVersion = “1.0”
playerData.gumletPageType = “AVPlayerViewController”
GumletInsightsSDK.initAVPlayerViewController(playerVC, userData: userData, customPlayerData: playerData, customVideoData: customVideoData, config: gumletConfig)