mirror of
				https://framagit.org/tom79/fedilab-tube
				synced 2025-06-05 21:09:11 +02:00 
			
		
		
		
	Fix mini video view not supported on some devices
This commit is contained in:
		| @@ -18,6 +18,7 @@ import android.Manifest; | |||||||
| import android.annotation.SuppressLint; | import android.annotation.SuppressLint; | ||||||
| import android.app.Activity; | import android.app.Activity; | ||||||
| import android.app.Dialog; | import android.app.Dialog; | ||||||
|  | import android.app.PictureInPictureParams; | ||||||
| import android.content.BroadcastReceiver; | import android.content.BroadcastReceiver; | ||||||
| import android.content.Context; | import android.content.Context; | ||||||
| import android.content.Intent; | import android.content.Intent; | ||||||
| @@ -220,8 +221,8 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd | |||||||
|             binding.writeCommentContainer.setVisibility(View.GONE); |             binding.writeCommentContainer.setVisibility(View.GONE); | ||||||
|         } |         } | ||||||
|         playInMinimized = sharedpreferences.getBoolean(getString(R.string.set_video_minimize_choice), true); |         playInMinimized = sharedpreferences.getBoolean(getString(R.string.set_video_minimize_choice), true); | ||||||
|         if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N |         if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O | ||||||
|                 && !getPackageManager().hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE)) { |                 || !getPackageManager().hasSystemFeature(PackageManager.FEATURE_PICTURE_IN_PICTURE)) { | ||||||
|             playInMinimized = false; |             playInMinimized = false; | ||||||
|         } |         } | ||||||
|  |  | ||||||
| @@ -911,7 +912,7 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     private void enterVideoMode() { |     private void enterVideoMode() { | ||||||
|         if (playInMinimized && Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && player != null) { |         if (playInMinimized && Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && player != null) { | ||||||
|             isPlayInMinimized = true; |             isPlayInMinimized = true; | ||||||
|             MediaSessionCompat mediaSession = new MediaSessionCompat(this, getPackageName()); |             MediaSessionCompat mediaSession = new MediaSessionCompat(this, getPackageName()); | ||||||
|             MediaSessionConnector mediaSessionConnector = new MediaSessionConnector(mediaSession); |             MediaSessionConnector mediaSessionConnector = new MediaSessionConnector(mediaSession); | ||||||
| @@ -920,7 +921,8 @@ public class PeertubeActivity extends AppCompatActivity implements CommentListAd | |||||||
|             controlView.hide(); |             controlView.hide(); | ||||||
|             binding.mediaVideo.setControllerAutoShow(false); |             binding.mediaVideo.setControllerAutoShow(false); | ||||||
|             mediaSession.setActive(true); |             mediaSession.setActive(true); | ||||||
|             enterPictureInPictureMode(); |             PictureInPictureParams params = new PictureInPictureParams.Builder().build(); | ||||||
|  |             enterPictureInPictureMode(params); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user