Skip to content

Commit f3472b9

Browse files
committed
Added tvOS support
1 parent 6c69b21 commit f3472b9

File tree

3 files changed

+30
-3
lines changed

3 files changed

+30
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [1.0.4]
6+
- Added support for tvOS, enabling all existing features — including engagement tracking, playback quality monitoring, error reporting, and custom metadata — on Apple TV.
7+
- Enhanced device details parameters to accurately capture and report tvOS-specific device information alongside existing metrics.
8+
59
## [1.0.3]
610
- Implemented deinit to remove notification observers when the player is deinitialized, ensuring proper resource cleanup.
711

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
- **Error Management:** Identify and resolve playback failures quickly with detailed error reports.
1111
- **Customizable Tracking:** Flexible configuration to match your specific monitoring needs.
1212
- **Centralized Dashboard:** Visualize and compare metrics on the [FastPix dashboard](https://dashboard.fastpix.io) to make data-driven decisions.
13+
- **Compatible with tvOS:** Monitor and track video playback and analytics specifically on Apple TV, just like on iOS.
1314

1415
# Step 1: Installation and Setup:
1516

Sources/FastpixiOSVideoDataCore/MonitorMetrics/PlaybackEventHandler.swift

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,7 @@ public class PlybackPulseHadler {
5858
"os_name": getOSName() ,
5959
"browser_version": getAppVersion(),
6060
"browser": getAppName(),
61-
"video_source_type": "application/x-mpegurl",
62-
"player_is_fullscreen": "true"
61+
"device_category": getDeviceCategory()
6362
]
6463
var fetchedVideoState : [String : Any] = [:]
6564
if (event != "viewCompleted") {
@@ -114,6 +113,19 @@ public class PlybackPulseHadler {
114113
}
115114
return connectionType
116115
}
116+
117+
public func getDeviceCategory() -> String {
118+
119+
switch UIDevice.current.userInterfaceIdiom {
120+
case .phone: return "Mobile"
121+
case .pad: return "iPad"
122+
case .tv: return "Apple TV"
123+
case .carPlay: return "CarPlay"
124+
case .mac: return "MacBook"
125+
default: return "Unknown"
126+
}
127+
128+
}
117129

118130
public func getAppVersion() -> String {
119131
if let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String,
@@ -254,7 +266,17 @@ public class PlybackPulseHadler {
254266
"iPhone2,1": "iPhone 3GS",
255267

256268
// Original iPhone (2007)
257-
"iPhone1,1": "iPhone (1st generation)"
269+
"iPhone1,1": "iPhone (1st generation)",
270+
271+
// Apple TV
272+
"AppleTV2,1": "Apple TV (2nd generation)",
273+
"AppleTV3,1": "Apple TV (3rd generation)",
274+
"AppleTV3,2": "Apple TV (3rd generation, Rev A)",
275+
"AppleTV5,3": "Apple TV HD",
276+
"AppleTV6,2": "Apple TV 4K",
277+
"AppleTV11,1": "Apple TV 4K (2nd generation)",
278+
"AppleTV14,1": "Apple TV 4K (3rd generation, Wi-Fi)",
279+
"AppleTV14,2": "Apple TV 4K (3rd generation, Wi-Fi + Ethernet)"
258280
]
259281

260282
return deviceMap[identifier] ?? identifier // Return the identifier if not found

0 commit comments

Comments
 (0)