FLUTTER PLUGIN

Installation

Instructions for adding the plugin via the pub.dev portal and setting up native dependencies on iOS and Android.

Add via pub.dev and configure native iOS/Android dependencies.

  1. Add the plugin
    In your pubspec.yaml:

    dependencies:
      targetvideo_flutter_plugin: ^x.x.x
    
  • or run:

flutter pub add targetvideo_flutter_plugin

pub.dev link: pub.dev/packages/targetvideo_flutter_plugin

  1. iOS Setup

  • In ios/Podfile, ensure:

platform :ios, '15.0'
install! 'cocoapods', :disable_input_output_paths => true  
use_frameworks!
  • Install CocoaPods dependencies:

cd ios
pod install
  1. Android Setup

  • In android/settings.gradle add:

include ':targetvideo_flutter_plugin'  
project(':targetvideo_flutter_plugin').projectDir = file('../.pub-cache/.../targetvideo_flutter_plugin/android')
  • In android/app/build.gradle, set:

minSdkVersion = 21

Sync/gradle-sync your project.
  1. Rebuild

flutter clean  
flutter pub get  
flutter run
  • import 'package:targetvideo_flutter_plugin/targetvideo_player.dart'; in your class and start using our plugin.

  • We provide custom platform view you can use for easy testing, import 'package:targetvideo_flutter_plugin/targetvideo_player_platform_view.dart'; to use it.

  • It is necessary to add NSUserTrackingUsageDescription to your app info.plist file.

  • Add this line in your ios Podfile, just under 'plaftorm :ios. 'x.x'

    install! 'cocoapods', :disable_input_output_paths => true

  • Add pod 'Protobuf' to your Podfile and add it to Frameworks, Libraries, and Embedded Content with do not embed option under your app's Xcode options.

  • Create a player with its player reference: 'final TargetVideoPlayer _player = TargetVideoPlayer(playerReference: "playerName")'

  • Call 'load' player method to start a video reproduction in your view.

You’re now ready to embed TargetVideoPlayerView in your Flutter app!

Example App

Explore the official example app demonstrating the basic usage of the targetvideo_flutter_plugin at the following link.

Installation · TargetVideo Developer Docs