Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ version '0.11.0'
apply plugin: 'com.android.library'

android {
compileSdkVersion 30
namespace 'com.befovy.fijkplayer'
compileSdkVersion 35

defaultConfig {
minSdkVersion 16
minSdkVersion 21
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
lintOptions {
Expand Down
38 changes: 1 addition & 37 deletions android/src/main/java/com/befovy/fijkplayer/FijkPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugin.common.MethodChannel.Result;
import io.flutter.plugin.common.PluginRegistry.Registrar;
import io.flutter.view.TextureRegistry;
import tv.danmaku.ijk.media.player.IjkMediaPlayer;

Expand All @@ -81,7 +80,6 @@ public class FijkPlugin implements MethodCallHandler, FlutterPlugin, ActivityAwa

private WeakReference<Activity> mActivity;
private WeakReference<Context> mContext;
private Registrar mRegistrar;
private FlutterPluginBinding mBinding;

// Count of playable players
Expand All @@ -96,22 +94,6 @@ public class FijkPlugin implements MethodCallHandler, FlutterPlugin, ActivityAwa
private Object mAudioFocusRequest;
private boolean mAudioFocusRequested = false;


/**
* Plugin registration.
*/
@SuppressWarnings("unused")
public static void registerWith(Registrar registrar) {
final MethodChannel channel = new MethodChannel(registrar.messenger(), "befovy.com/fijk");
FijkPlugin plugin = new FijkPlugin();
plugin.initWithRegistrar(registrar);
channel.setMethodCallHandler(plugin);

final FijkPlayer player = new FijkPlayer(plugin, true);
player.setupSurface();
player.release();
}

@Override
public void onAttachedToEngine(@NonNull FlutterPluginBinding binding) {
final MethodChannel channel = new MethodChannel(binding.getBinaryMessenger(), "befovy.com/fijk");
Expand Down Expand Up @@ -167,8 +149,6 @@ public void onDetachedFromActivity() {
public TextureRegistry.SurfaceTextureEntry createSurfaceEntry() {
if (mBinding != null) {
return mBinding.getTextureRegistry().createSurfaceTexture();
} else if (mRegistrar != null) {
return mRegistrar.textures().createSurfaceTexture();
}
return null;
}
Expand All @@ -178,8 +158,6 @@ public TextureRegistry.SurfaceTextureEntry createSurfaceEntry() {
public BinaryMessenger messenger() {
if (mBinding != null) {
return mBinding.getBinaryMessenger();
} else if (mRegistrar != null) {
return mRegistrar.messenger();
}
return null;
}
Expand All @@ -195,9 +173,7 @@ public Context context() {

@Nullable
private Activity activity() {
if (mRegistrar != null) {
return mRegistrar.activity();
} else if (mActivity != null) {
if (mActivity != null) {
return mActivity.get();
} else {
return null;
Expand All @@ -215,23 +191,11 @@ public String lookupKeyForAsset(@NonNull String asset, @Nullable String packageN
//noinspection ConstantConditions
path = mBinding.getFlutterAssets().getAssetFilePathByName(asset, packageName);
}
} else if (mRegistrar != null) {
if (TextUtils.isEmpty(packageName)) {
path = mRegistrar.lookupKeyForAsset(asset);
} else {
path = mRegistrar.lookupKeyForAsset(asset, packageName);
}
}
return path;
}


private void initWithRegistrar(@NonNull Registrar registrar) {
mRegistrar = registrar;
mContext = new WeakReference<>(registrar.activeContext());
init(registrar.messenger());
}

private void initWithBinding(@NonNull FlutterPluginBinding binding) {
mBinding = binding;
mContext = new WeakReference<>(binding.getApplicationContext());
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ repository: https://github.com/befovy/fijkplayer
issue_tracker: https://github.com/befovy/fijkplayer/issues

environment:
sdk: ">=2.14.0 <4.0.0"
flutter: ">=1.12.0"
sdk: ">=3.3.0 <4.0.0"
flutter: ">=3.3.0"

dependencies:
flutter:
Expand Down