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

Bugfix/updateframwork changes #224

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
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
2 changes: 1 addition & 1 deletion android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

<application>
<receiver android:name="androidx.media.session.MediaButtonReceiver">
<receiver android:name="androidx.media.session.MediaButtonReceiver" android:exported="false">
<intent-filter>
<action android:name="android.intent.action.MEDIA_BUTTON" />
</intent-filter>
Expand Down
24 changes: 20 additions & 4 deletions android/src/main/java/com/appgoalz/rnjwplayer/RNJWPlayerView.java
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,15 @@ public class RNJWPlayerView extends RelativeLayout implements
private MediaServiceController mMediaServiceController;

private void doBindService() {
mMediaServiceController.bindService();
if(mMediaServiceController!=null) {
mMediaServiceController.bindService();
}
}

private void doUnbindService() {
mMediaServiceController.unbindService();
if(mMediaServiceController!=null){
mMediaServiceController.unbindService();
}
}

private static boolean contextHasBug(Context context) {
Expand Down Expand Up @@ -242,8 +246,12 @@ public Activity getActivity() {
}

public void destroyPlayer() {
if (mPlayerView != null) {
mPlayer.stop();
try{
if (mPlayerView != null) {
mPlayer.stop();
mPlayer.pauseAd(true);
mPlayer.removeAllListeners(this);
mPlayerView = null;

mPlayer.removeListeners(this,
// VideoPlayerEvents
Expand Down Expand Up @@ -283,12 +291,20 @@ public void destroyPlayer() {

mPlayerView = null;

audioManager = null;

doUnbindService();
}
}catch(Exception e){
Log.e(TAG,e.getLocalizedMessage());
}finally {
getReactContext().removeLifecycleEventListener(this);

audioManager = null;

doUnbindService();
}

}

public void setupPlayerView(Boolean backgroundAudioEnabled) {
Expand Down