Setting Up the SDK

This guide walks through adding the Inkrypt Video Player SDK to your Flutter project and completing the required platform-specific configuration for Android and iOS.


Step 1: Add the Package

Open your project's pubspec.yaml and add inkrypt_video_player under dependencies.

From pub.dev

dependencies:
  flutter:
    sdk: flutter

  inkrypt_video_player: ^1.0.0   # Replace with the target version

From a Git Repository

dependencies:
  flutter:
    sdk: flutter

  # Via HTTPS
  inkrypt_video_player:
    git:
      url: https://gitlab.com/inkrypt-mobile/mobile-sdk-flutter.git

  # Or via SSH
  # inkrypt_video_player:
  #   git:
  #     url: [email protected]:inkrypt-mobile/mobile-sdk-flutter.git

  # Or from a local Git repository
  # inkrypt_video_player:
  #   git:
  #     url: /absolute/path/to/local/mobile-sdk-flutter

From a Local Path

dependencies:
  flutter:
    sdk: flutter

  inkrypt_video_player:
    path: /absolute/path/to/local/mobile-sdk-flutter

Step 2: Install the Package

Run the following command from your project root (the directory containing pubspec.yaml):

flutter pub get

Alternatively, open pubspec.yaml in Android Studio and click the Pub get button in the toolbar.

If there are errors, common causes are network connectivity issues or version conflicts with other packages.


Step 3: Android Setup

The following steps configure the native Android layer of your Flutter app. All files referenced are inside your app's android/ directory.

3.1 Set Minimum SDK Version

Open android/app/build.gradle and ensure minSdk (or minSdkVersion) is set to at least 25:

android {
    defaultConfig {
        minSdk 25
        // ... other config
    }
}

3.2 Set Kotlin Version

Kotlin 2.0.0 and above currently causes Gradle build failures when used with this SDK. Keep the Kotlin Android plugin below 2.0.0. This constraint will be lifted in a future SDK release.

Open android/settings.gradle and set the Kotlin Android plugin version in the plugins block:

plugins {
    // ...
    id("org.jetbrains.kotlin.android") version "1.9.24" apply false
    // ...
}

If your project uses a build.gradle (Groovy DSL) instead of settings.gradle for plugin versions, set it there instead.

3.3 Add the Maven Repository

The SDK's Android binaries are distributed via a Maven repository. The repository URL is either:

  • A remote URL: a private hosted Maven endpoint provided by Inkrypt
  • A local path: an absolute path to a locally published Maven repository (used during offline development)

The location where you declare this depends on your project's Gradle structure:

Modern Gradle (Kotlin DSL + settings.gradle.kts) - Recommended

Open android/settings.gradle.kts and add the Maven URL inside dependencyResolutionManagement:

dependencyResolutionManagement {
    repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
    repositories {
        google()
        mavenCentral()
        maven {
            url = uri("YOUR_MAVEN_REPO_URL_OR_LOCAL_PATH")
        }
    }
}

Legacy Gradle (Groovy DSL + build.gradle)

Open android/build.gradle: the project-level file at the same level as gradle.properties:

allprojects {
    repositories {
        google()
        mavenCentral()
        maven {
            url 'YOUR_MAVEN_REPO_URL_OR_LOCAL_PATH'
        }
    }
}

In both cases, replace YOUR_MAVEN_REPO_URL_OR_LOCAL_PATH with:

  • The remote Maven URL provided by Inkrypt, or
  • The absolute local path to the published Maven repository (e.g. /Users/yourname/inkrypt-android-maven-repo)

3.4 Add the Media3 Dependency

The SDK exposes some ExoPlayer APIs that your consuming app must explicitly declare. Open android/app/build.gradle, the app-level file, and add:

dependencies {
    implementation 'androidx.media3:media3-common:1.4.0'
    // ... your other dependencies
}

3.5 Update MainActivity

The SDK requires Android Fragment support. You must change your MainActivity to extend FlutterFragmentActivity instead of the default FlutterActivity.

Open android/app/src/main/kotlin/…/MainActivity.kt (or .java):

Kotlin:

import io.flutter.embedding.android.FlutterFragmentActivity

class MainActivity : FlutterFragmentActivity() {
    // No overrides required — the class can remain empty
}

Java:

import io.flutter.embedding.android.FlutterFragmentActivity;

public class MainActivity extends FlutterFragmentActivity {
    // No overrides required — the class can remain empty
}

3.6 Verify the Android Setup

  1. Run flutter pub get in your project root
  2. Open the project in Android Studio and sync Gradle files (File → Sync Project with Gradle Files)
  3. Build the project (Build → Make Project) and confirm no errors

Step 4: iOS Setup

The following steps configure the native iOS layer. All commands run inside your app's ios/ directory unless noted otherwise.

4.1 Set the iOS Deployment Target

The SDK requires iOS 16.1 or later. Set this in Xcode:

  1. Open ios/Runner.xcworkspace (or Runner.xcodeproj) in Xcode
  2. In the Project Navigator, click your project name (the blue icon at the top)
  3. Select your app target under TARGETS
  4. Go to the General tab
  5. Under Minimum Deployments, set iOS to 16.6

You can also set this directly in ios/Podfile by adding or updating the platform line at the top:

platform :ios, '16.6'

4.2 Prefetch iOS Artifacts

From your project root, run:

flutter precache --ios

This downloads the iOS-specific build tools cached by Flutter. It is required before pod install on fresh environments or after a clean Flutter installation.

4.3 Install CocoaPods Dependencies

From inside your app's ios/ directory, run:

pod install

This resolves the SDK's native framework and links it into your Xcode workspace.

4.4 Troubleshooting Pod Issues

If pod install fails or the SDK does not appear to update:

Stale pod references:

pod repo update 
pod update

Dart Pub cache corruption:

Remove the SDK from pubspec.yaml, run flutter pub get, re-add it, run flutter pub get again, then re-run pod install from the ios/ directory.

4.5 Verify the iOS Setup

  1. Open ios/Runner.xcworkspace in Xcode
  2. Select a connected physical device (not the Simulator) from the device selector
  3. Press ⌘ B to build
  4. Confirm the build succeeds with no errors

FairPlay DRM requires a physical device. Simulator builds will succeed, but video playback will not work.