Skip to content

Conversation

protheeuz
Copy link

@protheeuz protheeuz commented Oct 16, 2025

What does this pull request do?

This PR implements the MapRecorder API for Flutter SDK, exposing functionality that already exists in Android and iOS native SDKs.

API Surface:

  • mapboxMap.recorder.startRecording() - Begin recording map interactions
  • mapboxMap.recorder.stopRecording() - Stop and retrieve recorded sequence
  • mapboxMap.recorder.replay() - Replay recorded sequence with customization options
  • mapboxMap.recorder.togglePause() - Pause/resume playback
  • mapboxMap.recorder.getState() - Get current playback state

Implementation approach:

  • Uses Pigeon v25.2.0 for type-safe platform communication
  • Wraps native MapboxMaps.MapRecorder (iOS) and MapboxMapRecorder (Android)
  • Marked as @experimental to match native SDK status

Example usage:

// Record map interactions
await mapboxMap.recorder.startRecording(
  timeWindow: 60000,
  loggingEnabled: true,
  compressed: true,
);

final sequence = await mapboxMap.recorder.stopRecording();

// Replay at 2x speed
await mapboxMap.recorder.replay(
  sequence,
  playbackCount: 2,
  playbackSpeedMultiplier: 2.0,
);

Files added:

  • Generated platform interfaces (Dart, Kotlin, Swift) via Pigeon
  • Native controllers for Android and iOS
  • Dart wrapper class with public API
  • Integration into MapboxMap
  • Working example with UI controls

What is the motivation and context behind this change?

Issue: #1034

Context:
MapRecorder is available in both native SDKs but missing from Flutter SDK, creating a feature gap for Flutter devs.

Use cases (per native SDK documentation):

  • Debug issues that require multiple steps to reproduce
  • Performance testing of custom scenarios

Native SDK references:

Implementation notes:

  • Created Pigeon definition file (pigeons/map_recorder.dart) as Mapbox internal tooling doesn't provide one for MapRecorder
  • Follows existing SDK patterns for consistency (similar to how Snapshotter, Offline, etc. are implemented)
  • API marked @experimental with no version compatibility guarantee for recorded file format

Testing:

  • Verified on Android emulator (API 34) and iOS simulator (iPhone 16 Plus)
  • Recording captures interactions correctly
  • Replay functionality works with speed multiplier and pause/resume
  • Example app demonstrates all features

Demo Videos:

Android (Pixel 9 - API 34)

tested-android.mp4

iOS (iPhone 16 Plus)

Simulator.Screen.Recording.-.iPhone.16.Plus.-.2025-10-16.at.11.16.59.mp4

Pull request checklist:

  • Add a changelog entry.
  • Write tests for all new functionality. If tests were not written, please explain why.
  • Add documentation comments for any added or updated public APIs.

Note on tests:
Unit tests were not added as this follows the existing pattern in the SDK. The codebase currently only has events_test.dart for event data serialization. Other features (annotations, offline, snapshotter) also don't have unit tests. Integration testing is handled via the example app, which demonstrates all MapRecorder features with UI controls.

Note on changelog:
Will add changelog entry once PR is approved, to match the appropriate version number.

Implements MapRecorder functionality to achieve feature parity with Android and iOS native SDKs.
- Add Pigeon-generated platform communication layer
- Implement MapRecorderController for Android and iOS platforms
- Create MapRecorder wrapper class with user-facing API
- Integrate into MapboxMap via recorder property
- Add working example demonstrating record/replay/pause features
- Mark API as @experimental matching native SDK status
@protheeuz protheeuz requested a review from a team as a code owner October 16, 2025 05:15
@protheeuz protheeuz requested a review from maios October 16, 2025 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant