Installing Firework Flutter SDK requires the following step:
Install Flutter plugin package
Setup Native project
Install Flutter plugin Package
flutter pub add fw_flutter_sdk
Setup Native Project
iOS
Run pod install in the root directory of the iOS project. And if you encountered the following issues, you could run pod repo update && pod update FireworkVideo FireworkVideoUI in the root directory of the iOS project.
CocoaPods could not find compatible versions for pod "FireworkVideo"
CocoaPods could not find compatible versions for pod "FireworkVideoUI"
Android
build.gradle
buildscript {
repositories {
...
// This should be added
mavenCentral()
}
dependencies {
// We suggest the Gradle plugin version greater or equal to 7.4.2.
classpath("com.android.tools.build:gradle:7.4.2")
...
}
}
allprojects {
repositories {
...
mavenCentral()
}
}
gradle-wrapper.properties
...
# We suggest the Gradle version greater or equal to 7.5.
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
...
app/src/.../MainActivity.kt
The MainActivity should extend FlutterFragmentActivity.
class MainActivity: FlutterFragmentActivity()
app/build.gradle
...
apply from: 'firework.gradle'
add android:windowSoftInputMode="adjustPan" to the file app/src/Androidmanifest.xml if there is a story block in your app and use the live stream
android {
packagingOptions {
exclude 'META-INF/*.kotlin_module'
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation "com.firework:sdk:+"
// Uncomment the next line if you want to integrate the single-host live stream
// implementation "com.firework.external.livestream:singleHostPlayer:+"
// Uncomment the next line if you want to integrate the multi-host live stream
// implementation "com.firework.external.livestream:multiHostPlayer:+"
}
configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.firework' && details.requested.name == 'sdk') {
details.useVersion rootProject.ext.get("fwNativeVersion")
}
if (details.requested.group == 'com.firework.external.livestream' && details.requested.name == 'singleHostPlayer') {
details.useVersion rootProject.ext.get("fwNativeVersion")
}
if (details.requested.group == 'com.firework.external.livestream' && details.requested.name == 'multiHostPlayer') {
details.useVersion rootProject.ext.get("fwNativeVersion")
}
}
}
App Id Configuration
iOS
Include the app ID in your app Info.plist file using the key FireworkVideoAppID .
See the image below:
Android
Include the appid in your app AndroidManifest.xml file, like below:
<application
...
>
<activity .../>
...
// Include the app ID
<meta-data
android:name="Firework:Appid"
android:value="your firework appid" />
</application>
SDK Initialization
iOS
Import fw_flutter_sdk and call FWFlutterSDK.initializeSDK() in application(:, didFinishLaunchingWithOptions:) -> Bool
We support passing an option to the SDK initialization method. The sample codes are:
FWFlutterSDK.initializeSDK(
SDKInitOptions(
videoLaunchBehavior: .muteOnFirstLaunch // or .default
)
)
The SDK init option structure is:
public struct SDKInitOptions: Codable {
public var userId: String?
public var videoLaunchBehavior: FWFVideoLaunchBehavior?
public init(userId: String? = nil, videoLaunchBehavior: FWFVideoLaunchBehavior? = nil) {
self.userId = userId
self.videoLaunchBehavior = videoLaunchBehavior
}
}
Android
Step 1: Add the FWFlutterSDK.init(this) method to your FlutterApplication class.
class MainApplication: FlutterApplication() {
override fun onCreate() {
super.onCreate()
// ...
FWFlutterSDK.init(this)
// ...
}
}
// If you have the modules below, you need to add the modules before the SDK init method
// FWFlutterSDK.addLivestreamPlayerInitializer(SingleHostLivestreamPlayerInitializer())
// FWFlutterSDK.addLivestreamPlayerInitializer(MultiHostLivestreamPlayerInitializer())
// FWFlutterSDK.setImageLoader(GlideImageLoaderFactory.createInstance(this))
// FWFlutterSDK.setImageLoader(PicassoImageLoaderFactory.createInstance(this))
FWFlutterSDK.init(this)
Android initialization options
We support passing an option to the SDK initialization method. The sample codes are:
data class FWSDKInitOptionsModel(
val userId: String? = null,
val videoLaunchBehavior: FWPlayerLaunchBehavior? = null,
)
Dart
Call FireworkSDK.getInstance().markInitCalled() on the Dart side.
import 'package:fw_flutter_sdk/fw_flutter_sdk.dart';
/// Optional: set listener for SDK init
FireworkSDK.getInstance().onSDKInit = (event) {
};
/// Although we call the initialization method on the native side,
/// we also need to mark the initialization method as being called
/// on the Dart side.
FireworkSDK.getInstance().markInitCalled();
Please don't call FireworkSDK.getInstance().init() on the Dart side anymore.
Next
ATT compliance
Video Feed
Story Block
Customization
Live stream support
Shopping
Analytics
Sample Project
Step 2: Please check the section. Choose an image loader( or ) that works for you. If you're not sure which one to use, Glide image loader is recommended.
To ensure compliance with Apple privacy guidelines and regulations, we don't track data if users don't allow it.Please refer to .
If you want to integrate the video feed, please follow the instruction .
If you want to integrate the story block, please follow the instruction .
If you want to customize SDK, please refer to .
If you want to integrate the live stream, please follow the instruction .
If you want to integrate video shopping, please follow the instruction .
If you want to integrate video shopping, please follow the instruction .