Fixes a bug that caused a crash when a video was played in picture-in-picture mode and playback for another video was started.
When a new video is played, the onNewIntent of the Activity is invoked. This leads to the construction of a new player Fragment. This new Fragment is committed via commit(). The following tasks included checking whether immersive mode is available by checking the aspect ratio of the player view. But because the Fragment was not yet initialized, this process failed. commitNow() solves this by executing the transaction immediately, effectively synchronizing the lifecycle of Activity and Fragment.
Fixes a bug that caused a crash when a video was played in picture-in-picture mode and playback for another video was started.
When a new video is played, the
onNewIntent
of the Activity is invoked. This leads to the construction of a new player Fragment. This new Fragment is committed viacommit()
. The following tasks included checking whether immersive mode is available by checking the aspect ratio of the player view. But because the Fragment was not yet initialized, this process failed.commitNow()
solves this by executing the transaction immediately, effectively synchronizing the lifecycle of Activity and Fragment.