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.
Method
Method | Description |
|---|---|
| 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. Optionally attach MIEventParameters, MISessionParameters, or MIEcommerceParameters.
MIMediaEvent(pageName: String, parameters: MIMediaParameters)MIMediaParameters
Property | Description |
|---|---|
| Media item identifier (for example the video title or asset ID). |
| One of |
| Current playback position in seconds. |
| Total duration of the media item in seconds. |
| Optional bandwidth in kbps. |
| Optional |
| Optional volume value (0.0–1.0). |
| Dictionary of numbered custom media categories. |
Example: track a play event
let mediaParams = MIMediaParameters(
"intro-video",
action: "play",
position: 12,
duration: 120
)
let mediaEvent = MIMediaEvent(pageName: "Onboarding", parameters: mediaParams)
MappIntelligence.shared()?.trackMedia(mediaEvent)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.
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: Object Oriented Tracking, Pages.