Use extension and fix possible crash

width and height can be null, MediaStream.isLandscape handles this.
This commit is contained in:
Maxr1998
2025-03-17 07:16:27 +01:00
committed by Niels van Velzen
parent 341676279e
commit 26e60cde65
@@ -250,7 +250,7 @@ class PlayerFragment : Fragment(), BackPressInterceptor {
*/
private fun toggleFullscreen() {
val videoTrack = currentVideoStream
if (videoTrack == null || videoTrack.width!! >= videoTrack.height!!) {
if (videoTrack == null || videoTrack.isLandscape) {
val current = resources.configuration.orientation
requireActivity().requestedOrientation = when (current) {
Configuration.ORIENTATION_PORTRAIT -> ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE