Install

 

fijkplayer is a Flutter plugin which warps ijkplayer. It supports both Android and iOS, driven by ijkplayer.
fijkplayer brings video render to flutter via Texture insted of PlatformView.

Let’s start building flutter media app by using fijkplayer.
Don’t worry, it’s easy. Too much complicated knowledge is not needed.

This section include a simple installation guide and a more detailed installation guide.

Simple installation guide

Add fijkplayer as a dependency in your pubspec.yaml file.
And update the version number to the latest stable version, see the badge bellow.

dependencies:
  fijkplayer: ^0.2.1

pub package     Build Status    

if you need to use some unpublished feature, you can add dependencies from github.

dependencies:
  fijkplayer:
    git:
      url: https://github.com/befovy/fijkplayer.git
      ref: develop

develop can be replaced with other branch or tag name.

Detailed installation

If you are familiar with build flutter app, the Simple installation guide above in enough for you. The content bellow in this section can just be skipped.

If you are not familiar with the flutter App development process. We assume that you have already configured Flutter’s development environment on your device. That is, you can enter the flutter command in the console and see the correct output.

New Flutter App project

Type the following command in your console to create a new Flutter App project called playerapp.

$ flutter create -t app playerapp

Once the command is finished, flutter will give us the following prompt.

In order to run your application, type:

  $ cd playerapp
  $ flutter run

Your application code is in playerapp/lib/main.dart.

Connect your phone device (or open the Android emulator) to your computer. And run command flutter doctor to check if the device is connected successfully.

$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.7.8+hotfix.4, on Mac OS X 10.14.3 18D109, locale zh-Hans-CN)

[✓] Android toolchain - develop for Android devices (Android SDK version 28.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 10.3)
[✓] iOS tools - develop for iOS devices
[✓] Android Studio (version 3.4)
[✓] IntelliJ IDEA Ultimate Edition (version 2019.1.2)
[✓] VS Code (version 1.36.1)
[✓] Connected device (1 available)

• No issues found!

The output of flutter doctor must have available connected device.

Install fijkplayer

Enter the folder playerapp that created in last step, update file pubspec.yaml in this directory, add fijkplayer: ^0.2.1.

dependencies:
  flutter:
    sdk: flutter
    
+ fijkplayer: ^0.2.1

And then run command in playerapp folder, wait for the command to complete successfully.

$ flutter pub get --verbose

Vertify installation

After install fijkplayer, it’s better to do a verification.

Edit file lib/main.dart, add next line at beginning.

import 'package:fijkplayer/fijkplayer.dart';

Then build iOS and android. The build should not hava error.

$ flutter build apk
$ flutter build ios --no-codesign

Attention

  • fijkplayer use androidx suupport library, so you shuold enable androidx in your android app.

The contents of installing fijkplayer in Flutter are finished.
If you have any questions, please use github issues.
The next section is to write a hello-world player. 👏


Support me in the following ways:

  • Star this project   给该项目点赞
  • Follow me on Github   关注我的 Github
  • Buy me a coffee. Tip Me via PayPal