AVPlayer (iOS)

Gumlet Insights integration with AVPlayer for iOS native applications.

This Insights SDK 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.

Step 1: Add the SDK to the Project

Gumlet Insights is available through CocoaPods and Swift package Manager.

Install Gumlet Insights SDK with Cocoapods

  1. Create Podfile or modify Podfile to use SDK(frameworks) by using use_frameworks!
  2. Add the pod inside the Podfile
# platform :ios, '13.0'
use_frameworks!

target 'InsightsDemoApp' do

  # Pods for InsightsDemoApp
    pod 'GumletInsightsSDKAVPlayer', '~>1.0'
    
end

  1. Run pod repo update to add the newly added source and run Pod install to install it.
  2. import SDK on your file
 import GumletInsightsSDKAVPlayer

Install Gumlet Insights SDK with Swift Package Manager(SwiftPM)

  1. In Xcode click “File” > ”Swift Packages” > “Add Package Dependency…”
  2. The package repository URL is - https://github.com/gumlet/gumlet-insights-sdk-avplayer.git
  3. Click Next
  4. Select default Branch of the package main and click Next
  5. Xcode downloads the Gumlet Insights package to the your app target.
  6. import SDK on your file
 import GumletInsightsSDKAVPlayer
  1. 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

 let gumletConfig = GumletInsightsConfig()
 gumletConfig.proprtyId = "Your Property ID"
 
 let userData = GumletInsightsCustomUserData()
 userData.userName ="Gumlet"
 userData.userEmail = "[email protected]"
 userData.userCountry = "India"

 let customVideoData = GumletInsightsCustomVideoData()
 customVideoData.customContentType = "kids"
 customVideoData.customVideoTitle = "Peppa Pig"
 customVideoData.customVideoLanguage = "English"

 let playerData = GumletInsightsCustomPlayerData()
 playerData.GumletPlayerName = "AVPlayer"
 playerData.GumletPlayerIntegrationVersion = "1.0"
 playerData.gumletPageType = "AVPlayerViewController"

 GumletInsightsSDK.initAVPlayerViewController(playerVC, userData: userData, customPlayerData: playerData, customVideoData: customVideoData, config: gumletConfig)

Did this page help you?