The Video Analytics SDK empowers your applications with advanced video analytics capabilities, enabling you to gather valuable insights into viewer behavior. By leveraging powerful analytics tools and data collection mechanisms, it provides a comprehensive analysis of viewer interactions and preferences, allowing you to make data-driven decisions for optimizing the viewer experience and content delivery.

Before you proceed with the setup, make sure you have the following prerequisites in place:

  • Xcode (for iOS)

Getting Started

Downloading the SDK

To begin, download the SDK for your respective platform: 

iOS SDK Setup

Initialize the SDK in your iOS application as follows:

Step 1: Add the library to your application

Step 2: In the Swift files where you intend to use the SDK, import it at the top of the file:

import NWPlayerAnalyticsSDK

Step 3: Initialise the SDK with an AVPlayerViewController

let playerVC = AVPlayerViewController()

Step 4: Set up video parameters such as hash_id, video_url, title, tags, pageLoad as needed for your application

var hash_id = "4gpuj6i3znoio7r4"
        //let video_url = "https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/720/Big_Buck_Bunny_720_10s_5MB.mp4"
        var video_url = "https://woj7lng8dg82-hls-live.5centscdn.com/103_push_2351_001/e5e09742e6d694d40e46bef24fd68815.sdp/playlist.m3u8"
        var title = "title"
        var tags = ["1080p","10s","30MB"]
        var pageLoad = 120
        var showcv = true

Step 5: Create an NSURL from the video URL.

let videoURL = NSURL(string:video_url)

Step 6: Create an AVPlayer with the video URL.

let player = AVPlayer(url: videoURL! as URL)

Step 7: Set the AVPlayer as the player for an AVPlayerViewController.

playerVC.player = player

Step 8: Present the AVPlayerViewController and start video playback.

self.present(playerVC, animated: true) {
            self.playerVC.player!.play()
        }

Step 9: If playback is successful, initialize the SDK with analytics data.

if let player = self.playerVC.player {
            NWVideoAnalyticsSDK.initAVPlayerViewController(playerVC, hash_id: hash_id, url: video_url, title: title, tags: tags, pageLoad: pageLoad, showcv: showcv)
        }