Skip to content
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package org.moonfin.androidtv
package org.moonfin.androidtv

import android.app.PendingIntent
import android.app.PictureInPictureParams
Expand Down Expand Up @@ -35,6 +35,8 @@ import com.google.android.gms.cast.framework.CastSession
import com.google.android.gms.cast.framework.SessionManagerListener
import com.google.android.gms.common.images.WebImage
import com.ryanheise.audioservice.AudioServiceActivity
import io.flutter.embedding.android.RenderMode
import io.flutter.embedding.android.TransparencyMode
import io.flutter.embedding.engine.FlutterEngine
import io.flutter.plugin.common.EventChannel
import io.flutter.plugin.common.MethodChannel
Expand Down Expand Up @@ -376,6 +378,12 @@ class MainActivity : AudioServiceActivity() {
}
}

// Must stay surface: media_kit draws video in a native SurfaceView behind Flutter.
// RenderMode.texture (FlutterTextureView) is opaque for that stack — video stays black.
override fun getRenderMode(): RenderMode = RenderMode.surface

override fun getTransparencyMode(): TransparencyMode = TransparencyMode.transparent

override fun onUserLeaveHint() {
super.onUserLeaveHint()
requestEnterPiPIfEligible()
Expand Down
9 changes: 5 additions & 4 deletions lib/playback/media_kit_player_backend.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'dart:async';
import 'dart:async';
import 'dart:convert';
import 'dart:io';

Expand Down Expand Up @@ -134,10 +134,11 @@ class MediaKitPlayerBackend implements PlayerBackend {
Future<void> Function(int handle)? onNativeHandleReady,
}) {
final hwDecodingEnabled = prefs.get(UserPreferences.hardwareDecoding);
// Android: null → AndroidVideoController getDefaultHwdec() (mediacodec-copy).
final String? hwdec = hwDecodingEnabled
? ((PlatformDetection.isAndroid && PlatformDetection.isTV)
? 'auto'
: (PlatformDetection.isLinux ? 'auto-safe' : null))
? (PlatformDetection.isAndroid
? null
: (PlatformDetection.isLinux ? 'auto-safe' : null))
: 'no';

final player = Player(
Expand Down
4 changes: 2 additions & 2 deletions lib/ui/screens/home/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -886,8 +886,8 @@ class _ContentRowsState extends State<_ContentRows>
if (!hwDecodingEnabled) {
return 'no';
}
if (PlatformDetection.isAndroid && PlatformDetection.isTV) {
return 'auto';
if (PlatformDetection.isAndroid) {
return null;
}
if (PlatformDetection.isLinux) {
return 'auto-safe';
Expand Down
4 changes: 2 additions & 2 deletions lib/ui/widgets/media_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -609,8 +609,8 @@ class _MediaBarState extends State<MediaBar>
if (!widget.prefs.get(UserPreferences.hardwareDecoding)) {
return 'no';
}
if (PlatformDetection.isAndroid && PlatformDetection.isTV) {
return 'auto';
if (PlatformDetection.isAndroid) {
return null;
}
if (PlatformDetection.isLinux) {
return 'auto-safe';
Expand Down
Loading