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

[BUG] App crash when re-entering full screen from a player that was previously sent into PIP mode whilst full screen #94

Merged
merged 1 commit into from
Oct 23, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import android.view.Choreographer;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

Expand All @@ -41,8 +39,8 @@
import com.facebook.react.uimanager.events.RCTEventEmitter;
import com.google.common.collect.ImmutableMap;
import com.google.gson.Gson;
import com.jwplayer.pub.api.JsonHelper;
import com.jwplayer.pub.api.JWPlayer;
import com.jwplayer.pub.api.JsonHelper;
import com.jwplayer.pub.api.UiGroup;
import com.jwplayer.pub.api.background.MediaServiceController;
import com.jwplayer.pub.api.configuration.PlayerConfig;
Expand Down Expand Up @@ -113,15 +111,15 @@
import com.jwplayer.pub.api.media.playlists.PlaylistItem;
import com.jwplayer.ui.views.CueMarkerSeekbar;

import org.json.JSONObject;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;

import org.json.JSONObject;

public class RNJWPlayerView extends RelativeLayout implements
VideoPlayerEvents.OnFullscreenListener,
VideoPlayerEvents.OnReadyListener,
Expand Down Expand Up @@ -622,6 +620,9 @@ public void onFullscreenExitRequested() {
mPlayerViewContainer.post(new Runnable() {
@Override
public void run() {
// View may not have been removed properly (especially if returning from PiP)
mPlayerViewContainer.removeView(mPlayerView);

mPlayerViewContainer.addView(mPlayerView, new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT));
Expand Down Expand Up @@ -714,6 +715,11 @@ public void onReceive(Context context, Intent intent) {
mPlayer.setForceControlsVisibility(true);
mPlayer.setForceControlsVisibility(false);

// If player was in fullscreen when going into PiP, we need to force it back out
if (mPlayer.getFullscreen()) {
mPlayer.setFullscreen(false, true);
}

// Strip player view
rootView.removeView(mPlayerView);

Expand Down