--- title: "Media Tracking" slug: "mapp-intelligence-ios-sdk-v5-media-tracking" updated: 2026-04-30T11:49:00Z published: 2026-04-30T11:49:00Z canonical: "docs.mapp.com/mapp-intelligence-ios-sdk-v5-media-tracking" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.mapp.com/llms.txt > Use this file to discover all available pages before exploring further. # Media Tracking Media tracking captures audio and video playback in your iOS app — initialization, play, pause, position changes, and end of playback. Each event is tied to a page name and identifies the media item by name. Before you start, complete the [Quickstart](/v1/docs/mapp-intelligence-ios-sdk-v5-quickstart) so the SDK is initialized. --- ## Method | Method | Description | | --- | --- | | `trackMedia(_ event: MIMediaEvent)` | Records a media playback event. Each event represents one state change for one media item on one page. | --- ## Build a media event ### MIMediaEvent Initialize with the page name and a populated `MIMediaParameters`. You can additionally attach `MIEventParameters`, `MISessionParameters`, or `MIEcommerceParameters`. ```swift MIMediaEvent(pageName: String, parameters: MIMediaParameters) ``` ### MIMediaParameters | Property | Description | | --- | --- | | `name` | Media item identifier (for example the video title or asset ID). | | `action` | One of `"init"`, `"play"`, `"pause"`, `"stop"`, `"pos"`, `"seek"`, `"eof"`. | | `position` | Current playback position in seconds. | | `duration` | Total duration of the media item in seconds. | | `bandwith` | Optional bandwidth in kbps. | | `soundIsMuted` | Optional `NSNumber` (boolean) indicating muted state. | | `soundVolume` | Optional volume value (0.0–1.0). | | `customCategories` | Dictionary of numbered custom media categories. | --- ## Examples ### Track a play event Build an `MIMediaParameters` with the media name, action, position, and duration, wrap it in an `MIMediaEvent`, and send it. **Swift** ```swift let mediaParams = MIMediaParameters(    "intro-video",    action: "play",    position: 12,    duration: 120 ) let mediaEvent = MIMediaEvent(pageName: "Onboarding", parameters: mediaParams) MappIntelligence.shared()?.trackMedia(mediaEvent) ``` **Objective-C** ```objectivec MIMediaParameters *mediaParams = [[MIMediaParameters alloc]    initWith:@"intro-video"      action:@"play"    position:@12    duration:@120]; MIMediaEvent *mediaEvent = [[MIMediaEvent alloc]    initWithPageName:@"Onboarding"          parameters:mediaParams]; [[MappIntelligence shared] trackMedia:mediaEvent]; ``` --- ## Recommended cadence - Send `"init"` when the player loads the media item. - Send `"play"` on play and `"pause"` on pause. - Send `"pos"` at a regular interval (for example every 30 seconds) while the media is playing. - Send `"seek"` when the user scrubs the timeline. - Send `"eof"` when playback completes. > [!NOTE] > The SDK throttles repeated init events for the same media name and action — different episodes can therefore safely send `"init"` in rapid succession (this behavior was tightened in version 5.1.1). --- ## Related - [Quickstart](/v1/docs/mapp-intelligence-ios-sdk-v5-quickstart) - [Object Oriented Tracking](/v1/docs/mapp-intelligence-ios-sdk-v5-object-oriented-tracking) - [Pages](/v1/docs/mapp-intelligence-ios-sdk-v5-pages)