Integrate video data with iOS player
Integrate video data with iOS player
FastPix iOS Player supports data integration for tracking video playback, user interaction, and environment details using the FastpixVideoDataAVPlayer SDK with metadata fields passed via a customMetadata dictionary.
1. How it works
The FastpixVideoDataAVPlayer module provides the tracking primitives used throughout this recipe. Importing it registers the initAvPlayerTracking class and exposes the trackAvPlayerController, trackAvPlayerLayer, and trackAvPlayer binding methods.
2. Initialising the tracking instance
3. Building the metadata dictionary
4. Identifying the workspace
5. Labelling the video
6. Tracking the viewer
7. Describing the content
8. Passing custom fields
9. Binding the SDK to the player
1import FastpixVideoDataAVPlayer
2
3let fpDataSDK = initAvPlayerTracking()
4let customMetadata = [
5 "data": [
6 workspace_id: "WORKSPACE_KEY", // Unique key to identify your workspace (replace with your actual workspace key)
7 video_title: "Test Content", // Title of the video being played (replace with the actual title of your video)
8 video_id: "f01a98s76t90p88i67x", // A unique identifier for the video (replace with your actual video ID for tracking purposes)
9 viewer_id: "user12345", // A unique identifier for the viewer (e.g., user ID, session ID, or any other unique value)
10 video_content_type: "series", // Type of content being played (e.g., series, movie, etc.)
11 video_stream_type: "on-demand", // Type of streaming (e.g., live, on-demand)
12 // Custom fields for additional business logic
13 custom_1: "", // Use this field to pass any additional data needed for your specific business logic
14 custom_2: "", // Use this field to pass any additional data needed for your specific business logic
15 // Add any additional metadata
16 ]
17]
18// Track AVPlayer Controller
19fpDataSDK.trackAvPlayerController(
20 playerController: playerController, // The AVPlayerViewController instance managing the playback
21 customMetadata: customMetadata
22)