Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crashed app. #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
- Fix crashed app.
maobui committed Nov 20, 2019
commit 3cf6c77066ebfeba3e9f78e9f314dfcf8a95c15b
Original file line number Diff line number Diff line change
@@ -42,6 +42,7 @@ public class MediaPlayerPlugin implements MethodCallHandler, ViewDestroyListener

private MethodCall call = null;
private Result result = null;
private boolean bound = false;

private ServiceConnection serviceConnection = new ServiceConnection() {
@Override
@@ -50,14 +51,15 @@ public void onServiceConnected(ComponentName componentName, IBinder iBinder) {
audioServiceBinder = (AudioServiceBinder) iBinder;
createVideoPlayer();
Log.i("ServiceConnnection", "Service connection audio service binder complete");
bound = true;
}



@Override
public void onServiceDisconnected(ComponentName componentName) {
Log.i("ServiceConnnection", "Service disconnected");

Log.i("ServiceConnnection", "Service disconnected");
bound = false;
}
};

@@ -113,7 +115,10 @@ private void unBoundService() {
Log.i(TAG, "unbound service called");
if (audioServiceBinder != null){
audioServiceBinder.destroyAllPlayers();
registrar.context().unbindService(serviceConnection);
if(bound) {
registrar.context().unbindService(serviceConnection);
bound = false;
}
Log.i(TAG, "service unbounded");

}