Skip to main content

Flutter SDK installation and setup

The current plugin is meshstream_p2p 1.0.8, published on pub.dev. It exposes the native playback URL and status to your Flutter player; it does not provide a player or decoder.

Before you start​

  • Flutter 3.22+ and Dart 3.4+;
  • an SDK Key created for the Flutter application in the console;
  • a playable HLS .m3u8, DASH .mpd, or an MP4/MP3 URL with Range support;
  • a Flutter player such as video_player.

The plugin declares Android API 21 and iOS 15.0 as its lower bounds. The application must satisfy the highest requirement from the plugin, Flutter engine, player, and other dependencies; the current example uses Android API 24. The plugin pins the public Android SDK io.meshstream:meshstream-android-sdk:1.0.9 and iOS MeshStreamKit 1.0.8.

The Android dependency includes armeabi-v7a, arm64-v8a, x86, and x86_64. Devices and emulators must also meet the OS and architecture requirements of your framework and player.

Use an arm64 or x86_64 system image supported by your Flutter version for Android emulator debugging.

See native project configuration for Android permissions and compilation requirements, and shrinking and memory for R8 and cache budgets. Retain the Java/Kotlin targets required by your Flutter project.

Install​

dependencies:
meshstream_p2p: 1.0.8
video_player: ^2.9.3

Choose one configuration that matches how your project manages repositories. The examples below use Kotlin DSL.

Default Flutter projects​

Add the MeshStream repository to the existing allprojects.repositories block in android/build.gradle.kts, retaining the other repositories:

allprojects {
repositories {
google()
mavenCentral()
maven {
url = uri("https://sdk.meshstream.net/maven")
content { includeGroup("io.meshstream") }
}
}
}

Projects managing repositories in settings​

Merge the following configuration into dependencyResolutionManagement in android/settings.gradle.kts. Set PREFER_SETTINGS explicitly so settings repositories take precedence. Retain Google, Maven Central, the Flutter engine repository, and any repositories required by your application:

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositories {
google()
mavenCentral()
maven {
val flutterStorageBaseUrl =
System.getenv("FLUTTER_STORAGE_BASE_URL") ?: "https://storage.googleapis.com"
url = uri("$flutterStorageBaseUrl/download.flutter.io")
content { includeGroup("io.flutter") }
}
maven {
url = uri("https://sdk.meshstream.net/maven")
content { includeGroup("io.meshstream") }
}
}
}

Run flutter pub get, then run cd ios && pod install for the iOS host. The plugin resolves its native dependencies from the published channels.

Platform network configuration​

Android​

The SDK playback URL uses an HTTP loopback proxy. Your player needs access to this proxy even when the media source uses HTTPS.

Add this attribute to <application> in android/app/src/main/AndroidManifest.xml:

android:networkSecurityConfig="@xml/meshstream_network_security_config"

Create android/app/src/main/res/xml/meshstream_network_security_config.xml:

<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="false" />
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="false">127.0.0.1</domain>
<domain includeSubdomains="false">localhost</domain>
</domain-config>
</network-security-config>

Place the configuration in src/main so it applies to both Debug and Release builds. Merge the loopback rules into any existing network policy and retain its other settings. Public HTTP media origins require their own domain rules; prefer HTTPS. Applications supporting Android 6.0 (API 23) should also follow the Android network configuration for that system's cleartext policy.

iOS​

Allow local networking in the NSAppTransportSecurity dictionary in ios/Runner/Info.plist. Merge this setting into the dictionary if it already exists:

<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsLocalNetworking</key>
<true/>
</dict>

Retain other ATS restrictions and add only the exceptions required by your media origins.

Next step​

After completing the setup above, continue to Quick integration to create a session, connect your player, and release playback resources.