trackMediaEvent static method

Future<void> trackMediaEvent({
  1. required String tracker,
  2. required String id,
  3. required Event event,
  4. List<SelfDescribing>? contexts,
  5. MediaPlayerEntity? player,
  6. MediaAdEntity? ad,
  7. MediaAdBreakEntity? adBreak,
})

Tracks a media player event along with the media entities (e.g., player, session, ad).

Implementation

static Future<void> trackMediaEvent({
  required String tracker,
  required String id,
  required Event event,
  List<SelfDescribing>? contexts,
  MediaPlayerEntity? player,
  MediaAdEntity? ad,
  MediaAdBreakEntity? adBreak,
}) async {
  await _channel.invokeMethod(event.endpoint(), {
    'tracker': tracker,
    'mediaTrackingId': id,
    'eventData': event.toMap(),
    'contexts': contexts?.map((c) => c.toMap()).toList(),
    'player': player?.toMap(),
    'ad': ad?.toMap(),
    'adBreak': adBreak?.toMap(),
  });
}