Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eae40938e0 | ||
|
|
9c7cb7439f | ||
|
|
3bf7ff3d48 | ||
|
|
138c8f9fd8 | ||
|
|
3a5cab956d | ||
|
|
796db94896 | ||
|
|
d1dacae581 | ||
|
|
a62a01b9c3 | ||
|
|
ea9e1a3dc6 | ||
|
|
54ceee18a6 | ||
|
|
d0f2122944 | ||
|
|
1d739c74ec | ||
|
|
5dfc5af4c5 | ||
|
|
8a5f1ddea9 | ||
|
|
bbfe7cf783 | ||
|
|
b78bc3e869 | ||
|
|
2405cd179b | ||
|
|
fa9c5afeb8 | ||
|
|
0e84ce9166 | ||
|
|
9f81671603 | ||
|
|
15e1f0b9e2 | ||
|
|
014f9456f6 | ||
|
|
1bb4adfcf1 | ||
|
|
08399e5d37 | ||
|
|
48c9dcae1b | ||
|
|
078f6b29d5 | ||
|
|
60d1431443 | ||
|
|
17182e334f | ||
|
|
5986ac6c79 | ||
|
|
80dc5ffdc5 | ||
|
|
0449be7aa0 | ||
|
|
c02f84dba0 | ||
|
|
a6119414ca | ||
|
|
4929e7d42b | ||
|
|
18614022c0 | ||
|
|
389a9622c3 | ||
|
|
4cebff4367 | ||
|
|
3103cb5ee1 | ||
|
|
7a0a911cd9 | ||
|
|
03d62d2e2b | ||
|
|
5ff5441baa | ||
|
|
c1e9911841 | ||
|
|
00667fe8b8 | ||
|
|
ab2f8cf6ff | ||
|
|
edb285a279 | ||
|
|
11377362cb | ||
|
|
1cdf1890cf | ||
|
|
9e0c3e7b68 | ||
|
|
b549432250 | ||
|
|
b100c356fc | ||
|
|
045295b4c1 | ||
|
|
ad9556e484 | ||
|
|
7f03c15779 | ||
|
|
cc30bee83a | ||
|
|
8559037a50 | ||
|
|
732c09eec1 | ||
|
|
602982d426 | ||
|
|
7472e3a2f7 | ||
|
|
6eeb484c30 | ||
|
|
e9218e0a3d | ||
|
|
4588457319 | ||
|
|
e489a97847 | ||
|
|
2b5923d80b | ||
|
|
5cf5b2f0a0 | ||
|
|
a56ef0e3ca | ||
|
|
8eda892b68 | ||
|
|
4b6c82b071 | ||
|
|
79350b8d71 | ||
|
|
a5fa8a4c99 | ||
|
|
a38aac7829 | ||
|
|
414e5804eb | ||
|
|
cbf9913e8a | ||
|
|
8acb777f65 |
@@ -0,0 +1,27 @@
|
||||
name: SonarQube
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
sonarqube:
|
||||
name: SonarQube
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Flutter
|
||||
uses: subosito/flutter-action@v2
|
||||
with:
|
||||
channel: "stable"
|
||||
cache: true
|
||||
|
||||
- name: Install dependencies
|
||||
run: flutter pub get
|
||||
|
||||
- name: SonarQube Scan
|
||||
uses: SonarSource/sonarqube-scan-action@v6
|
||||
env:
|
||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
||||
@@ -1,4 +1,4 @@
|
||||
name: Update Homebrew Cask
|
||||
name: Update Packages
|
||||
|
||||
on:
|
||||
release:
|
||||
@@ -6,7 +6,7 @@ on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
update-cask:
|
||||
update-homebrew:
|
||||
runs-on: macos-latest
|
||||
permissions:
|
||||
contents: write
|
||||
@@ -43,3 +43,12 @@ jobs:
|
||||
else
|
||||
echo "No cask changes to commit."
|
||||
fi
|
||||
|
||||
update-winget:
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: vedantmgoyal9/winget-releaser@v2
|
||||
with:
|
||||
identifier: edde746.Plezy
|
||||
installers-regex: 'plezy-windows-installer\.exe$'
|
||||
token: ${{ secrets.WINGET_TOKEN }}
|
||||
@@ -32,6 +32,7 @@ migrate_working_dir/
|
||||
.pub-cache/
|
||||
.pub/
|
||||
/build/
|
||||
/debug-info/
|
||||
|
||||
# Symbolication related
|
||||
app.*.symbols
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
cask "plezy" do
|
||||
version "1.21.2"
|
||||
sha256 "65dd027f58b92e9c41601b11b9603a4ba76b15947913164398577fb476021b8b"
|
||||
version "1.22.0"
|
||||
sha256 "94524bb6b7c4779f5416cef7d3a876e081f7ad6e737e828f790e52920b7086f4"
|
||||
|
||||
url "https://github.com/edde746/plezy/releases/download/#{version}/plezy-macos.dmg"
|
||||
name "Plezy"
|
||||
|
||||
@@ -87,8 +87,8 @@ dependencies {
|
||||
// FFmpeg audio decoder for unsupported codecs (ALAC, DTS, TrueHD, etc.)
|
||||
implementation("org.jellyfin.media3:media3-ffmpeg-decoder:1.9.0+1")
|
||||
|
||||
// libass-android for ASS/SSA subtitle rendering
|
||||
implementation("io.github.peerless2012:ass-media:0.4.0-beta01")
|
||||
// libass-android for ASS/SSA subtitle rendering (fork with font buffering fix)
|
||||
implementation(files("libs/ass-media.aar"))
|
||||
// ass-kt core library (needed for AssRender.setFontScale)
|
||||
implementation("io.github.peerless2012:ass-kt:0.4.0-beta01")
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ import android.content.res.Configuration
|
||||
import android.util.Rational
|
||||
import android.view.KeyEvent
|
||||
import android.view.ViewGroup
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
import android.widget.FrameLayout
|
||||
import androidx.core.content.FileProvider
|
||||
import io.flutter.embedding.android.FlutterActivity
|
||||
import io.flutter.embedding.android.RenderMode
|
||||
@@ -19,6 +21,7 @@ import io.flutter.embedding.engine.FlutterEngine
|
||||
import io.flutter.plugin.common.MethodChannel
|
||||
import com.edde746.plezy.exoplayer.ExoPlayerPlugin
|
||||
import com.edde746.plezy.mpv.MpvPlayerPlugin
|
||||
import com.edde746.plezy.shared.ThemeHelper
|
||||
import com.edde746.plezy.watchnext.WatchNextPlugin
|
||||
import java.io.File
|
||||
|
||||
@@ -26,53 +29,71 @@ class MainActivity : FlutterActivity() {
|
||||
|
||||
private val PIP_CHANNEL = "app.plezy/pip"
|
||||
private val EXTERNAL_PLAYER_CHANNEL = "app.plezy/external_player"
|
||||
private val THEME_CHANNEL = "app.plezy/theme"
|
||||
private var watchNextPlugin: WatchNextPlugin? = null
|
||||
private var cachedFlutterView: android.view.View? = null
|
||||
|
||||
// Auto PiP state
|
||||
private var autoPipReady = false
|
||||
private var autoPipWidth: Int = 16
|
||||
private var autoPipHeight: Int = 9
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
// Apply persisted theme color to the window background before anything
|
||||
// else renders. This prevents a white flash between the native splash
|
||||
// screen and Flutter's first frame for non-default themes (e.g. OLED).
|
||||
val prefs = getSharedPreferences("plezy_prefs", Context.MODE_PRIVATE)
|
||||
val savedTheme = prefs.getString("splash_theme", null)
|
||||
ThemeHelper.themeColor(savedTheme)?.let { window.decorView.setBackgroundColor(it) }
|
||||
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
// Disable the Android splash screen fade-out animation to avoid
|
||||
// a flicker before Flutter draws its first frame.
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
splashScreen.setOnExitAnimationListener { splashScreenView -> splashScreenView.remove() }
|
||||
}
|
||||
|
||||
// Disable Android's default focus highlight ring that appears when using
|
||||
// D-pad navigation so the Flutter UI can render its own focus state.
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
window.decorView.defaultFocusHighlightEnabled = false
|
||||
}
|
||||
|
||||
// Wrap the content view in a layout that intercepts DPAD key events
|
||||
// before the IME input stage, which can consume DPAD direction events
|
||||
// from virtual remotes before they reach Flutter's key handler.
|
||||
val content = findViewById<ViewGroup>(android.R.id.content)
|
||||
val wrapper = object : FrameLayout(this) {
|
||||
override fun dispatchKeyEventPreIme(event: KeyEvent): Boolean {
|
||||
when (event.keyCode) {
|
||||
KeyEvent.KEYCODE_DPAD_UP,
|
||||
KeyEvent.KEYCODE_DPAD_DOWN,
|
||||
KeyEvent.KEYCODE_DPAD_LEFT,
|
||||
KeyEvent.KEYCODE_DPAD_RIGHT,
|
||||
KeyEvent.KEYCODE_DPAD_CENTER -> {
|
||||
val imm = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
if (!imm.isAcceptingText) {
|
||||
super.dispatchKeyEvent(event)
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.dispatchKeyEventPreIme(event)
|
||||
}
|
||||
}
|
||||
while (content.childCount > 0) {
|
||||
val child = content.getChildAt(0)
|
||||
content.removeViewAt(0)
|
||||
wrapper.addView(child)
|
||||
}
|
||||
content.addView(wrapper, ViewGroup.LayoutParams(
|
||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT))
|
||||
|
||||
// Handle Watch Next deep link from initial launch
|
||||
handleWatchNextIntent(intent)
|
||||
}
|
||||
|
||||
override fun dispatchKeyEvent(event: KeyEvent): Boolean {
|
||||
// Ensure FlutterView has focus for DPAD events so they reach Flutter's
|
||||
// key event system. Without this, Android's native focus navigation can
|
||||
// consume DPAD direction events (especially from the Google TV virtual
|
||||
// remote) before they reach Flutter.
|
||||
when (event.keyCode) {
|
||||
KeyEvent.KEYCODE_DPAD_UP,
|
||||
KeyEvent.KEYCODE_DPAD_DOWN,
|
||||
KeyEvent.KEYCODE_DPAD_LEFT,
|
||||
KeyEvent.KEYCODE_DPAD_RIGHT,
|
||||
KeyEvent.KEYCODE_DPAD_CENTER -> {
|
||||
val fv = cachedFlutterView ?: findFlutterView(window.decorView)?.also { cachedFlutterView = it }
|
||||
if (fv != null && !fv.hasFocus()) {
|
||||
fv.requestFocus()
|
||||
}
|
||||
}
|
||||
}
|
||||
return super.dispatchKeyEvent(event)
|
||||
}
|
||||
|
||||
private fun findFlutterView(view: android.view.View): android.view.View? {
|
||||
if (view.javaClass.name.contains("FlutterView")) return view
|
||||
if (view is ViewGroup) {
|
||||
for (i in 0 until view.childCount) {
|
||||
val found = findFlutterView(view.getChildAt(i))
|
||||
if (found != null) return found
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
override fun onNewIntent(intent: Intent) {
|
||||
super.onNewIntent(intent)
|
||||
// Handle Watch Next deep link when app is already running
|
||||
@@ -153,6 +174,33 @@ class MainActivity : FlutterActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
// Splash screen theme: persist user's chosen theme for next launch (API 31+)
|
||||
MethodChannel(flutterEngine.dartExecutor.binaryMessenger, THEME_CHANNEL).setMethodCallHandler { call, result ->
|
||||
when (call.method) {
|
||||
"setSplashTheme" -> {
|
||||
val mode = call.argument<String>("mode")
|
||||
|
||||
// Persist for next cold start & update window background now
|
||||
getSharedPreferences("plezy_prefs", Context.MODE_PRIVATE)
|
||||
.edit().putString("splash_theme", mode).apply()
|
||||
ThemeHelper.themeColor(mode)?.let { window.decorView.setBackgroundColor(it) }
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
val themeId = when (mode) {
|
||||
"dark" -> R.style.SplashTheme_Dark
|
||||
"oled" -> R.style.SplashTheme_Oled
|
||||
"light" -> R.style.SplashTheme_Light
|
||||
"system" -> android.content.res.Resources.ID_NULL
|
||||
else -> android.content.res.Resources.ID_NULL
|
||||
}
|
||||
splashScreen.setSplashScreenTheme(themeId)
|
||||
}
|
||||
result.success(true)
|
||||
}
|
||||
else -> result.notImplemented()
|
||||
}
|
||||
}
|
||||
|
||||
// Register Watch Next plugin and keep reference for deep link handling
|
||||
watchNextPlugin = WatchNextPlugin()
|
||||
flutterEngine.plugins.add(watchNextPlugin!!)
|
||||
@@ -168,15 +216,7 @@ class MainActivity : FlutterActivity() {
|
||||
return@setMethodCallHandler
|
||||
}
|
||||
|
||||
// Check if PiP permission is granted via AppOpsManager
|
||||
val appOpsManager = getSystemService(Context.APP_OPS_SERVICE) as AppOpsManager
|
||||
val pipAllowed = appOpsManager.checkOpNoThrow(
|
||||
AppOpsManager.OPSTR_PICTURE_IN_PICTURE,
|
||||
applicationInfo.uid,
|
||||
packageName
|
||||
) == AppOpsManager.MODE_ALLOWED
|
||||
|
||||
if (!pipAllowed) {
|
||||
if (!isPipPermissionGranted()) {
|
||||
result.success(mapOf("success" to false, "errorCode" to "permission_disabled"))
|
||||
return@setMethodCallHandler
|
||||
}
|
||||
@@ -184,31 +224,10 @@ class MainActivity : FlutterActivity() {
|
||||
try {
|
||||
val width = call.argument<Int>("width") ?: 16
|
||||
val height = call.argument<Int>("height") ?: 9
|
||||
|
||||
// Android PiP requires aspect ratio between 0.418410 (5:12) and 2.39 (12:5)
|
||||
val ratio = width.toFloat() / height.toFloat()
|
||||
val clampedWidth: Int
|
||||
val clampedHeight: Int
|
||||
|
||||
when {
|
||||
ratio < 0.42f -> {
|
||||
// Too tall - clamp to minimum ratio (5:12)
|
||||
clampedWidth = 5
|
||||
clampedHeight = 12
|
||||
}
|
||||
ratio > 2.39f -> {
|
||||
// Too wide - clamp to maximum ratio (12:5)
|
||||
clampedWidth = 12
|
||||
clampedHeight = 5
|
||||
}
|
||||
else -> {
|
||||
clampedWidth = width
|
||||
clampedHeight = height
|
||||
}
|
||||
}
|
||||
val clamped = clampAspectRatio(width, height)
|
||||
|
||||
val params = PictureInPictureParams.Builder()
|
||||
.setAspectRatio(Rational(clampedWidth, clampedHeight))
|
||||
.setAspectRatio(Rational(clamped.first, clamped.second))
|
||||
.build()
|
||||
val success = enterPictureInPictureMode(params)
|
||||
if (success) {
|
||||
@@ -221,7 +240,25 @@ class MainActivity : FlutterActivity() {
|
||||
} catch (e: Exception) {
|
||||
result.success(mapOf("success" to false, "errorCode" to "unknown", "errorMessage" to (e.message ?: "Unknown error")))
|
||||
}
|
||||
} else -> result.notImplemented()
|
||||
}
|
||||
"setAutoPipReady" -> {
|
||||
autoPipReady = call.argument<Boolean>("ready") ?: false
|
||||
autoPipWidth = call.argument<Int>("width") ?: 16
|
||||
autoPipHeight = call.argument<Int>("height") ?: 9
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
||||
try {
|
||||
val clamped = clampAspectRatio(autoPipWidth, autoPipHeight)
|
||||
val params = PictureInPictureParams.Builder()
|
||||
.setAspectRatio(Rational(clamped.first, clamped.second))
|
||||
.setAutoEnterEnabled(autoPipReady)
|
||||
.build()
|
||||
setPictureInPictureParams(params)
|
||||
} catch (_: Exception) {}
|
||||
}
|
||||
result.success(true)
|
||||
}
|
||||
else -> result.notImplemented()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -235,4 +272,42 @@ class MainActivity : FlutterActivity() {
|
||||
(plugin as? ExoPlayerPlugin)?.onPipModeChanged(isInPictureInPictureMode)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onUserLeaveHint() {
|
||||
super.onUserLeaveHint()
|
||||
// Auto PiP for API 26-30 (API 31+ uses setAutoEnterEnabled)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O &&
|
||||
Build.VERSION.SDK_INT < Build.VERSION_CODES.S &&
|
||||
autoPipReady && isPipPermissionGranted()) {
|
||||
try {
|
||||
// Notify Flutter to prepare video filter before PiP
|
||||
flutterEngine?.dartExecutor?.binaryMessenger?.let { messenger ->
|
||||
MethodChannel(messenger, PIP_CHANNEL).invokeMethod("onAutoPipEntering", null)
|
||||
}
|
||||
val clamped = clampAspectRatio(autoPipWidth, autoPipHeight)
|
||||
val params = PictureInPictureParams.Builder()
|
||||
.setAspectRatio(Rational(clamped.first, clamped.second))
|
||||
.build()
|
||||
enterPictureInPictureMode(params)
|
||||
} catch (_: Exception) {}
|
||||
}
|
||||
}
|
||||
|
||||
private fun isPipPermissionGranted(): Boolean {
|
||||
val appOpsManager = getSystemService(Context.APP_OPS_SERVICE) as AppOpsManager
|
||||
return appOpsManager.checkOpNoThrow(
|
||||
AppOpsManager.OPSTR_PICTURE_IN_PICTURE,
|
||||
applicationInfo.uid,
|
||||
packageName
|
||||
) == AppOpsManager.MODE_ALLOWED
|
||||
}
|
||||
|
||||
private fun clampAspectRatio(width: Int, height: Int): Pair<Int, Int> {
|
||||
val ratio = width.toFloat() / height.toFloat()
|
||||
return when {
|
||||
ratio < 0.42f -> Pair(5, 12)
|
||||
ratio > 2.39f -> Pair(12, 5)
|
||||
else -> Pair(width, height)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,31 +2,22 @@ package com.edde746.plezy.exoplayer
|
||||
|
||||
import android.app.Activity
|
||||
import android.app.ActivityManager
|
||||
import android.content.ComponentCallbacks2
|
||||
import android.content.Context
|
||||
import android.content.res.Configuration
|
||||
import android.graphics.Color
|
||||
import android.graphics.PixelFormat
|
||||
import android.hardware.display.DisplayManager
|
||||
import android.media.AudioAttributes
|
||||
import android.media.AudioFocusRequest
|
||||
import android.media.AudioManager
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.util.Log
|
||||
import android.view.Gravity
|
||||
import android.view.Surface
|
||||
import android.view.SurfaceView
|
||||
import android.view.TextureView
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.ViewTreeObserver
|
||||
import android.view.WindowManager
|
||||
import android.widget.FrameLayout
|
||||
import androidx.annotation.OptIn
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.media3.common.C
|
||||
import androidx.media3.common.MediaItem
|
||||
import androidx.media3.common.MimeTypes
|
||||
@@ -41,6 +32,7 @@ import androidx.media3.common.util.UnstableApi
|
||||
import androidx.media3.datasource.DefaultDataSource
|
||||
import androidx.media3.exoplayer.DefaultLoadControl
|
||||
import androidx.media3.exoplayer.DefaultRenderersFactory
|
||||
import androidx.media3.exoplayer.mediacodec.MediaCodecSelector
|
||||
import androidx.media3.exoplayer.ExoPlayer
|
||||
import androidx.media3.exoplayer.source.DefaultMediaSourceFactory
|
||||
import androidx.media3.exoplayer.source.ProgressiveMediaSource
|
||||
@@ -49,14 +41,15 @@ import androidx.media3.extractor.DefaultExtractorsFactory
|
||||
import androidx.media3.extractor.mkv.MatroskaExtractor
|
||||
import androidx.media3.ui.CaptionStyleCompat
|
||||
import androidx.media3.ui.SubtitleView
|
||||
import com.edde746.plezy.shared.AudioFocusManager
|
||||
import com.edde746.plezy.shared.FlutterOverlayHelper
|
||||
import com.edde746.plezy.shared.FrameRateManager
|
||||
import io.github.peerless2012.ass.media.AssHandler
|
||||
import io.github.peerless2012.ass.media.extractor.AssMatroskaExtractor
|
||||
import io.github.peerless2012.ass.media.factory.AssRenderersFactory
|
||||
import io.github.peerless2012.ass.media.parser.AssSubtitleParserFactory
|
||||
import io.github.peerless2012.ass.media.type.AssRenderType
|
||||
import io.github.peerless2012.ass.media.widget.AssSubtitleView
|
||||
import java.math.BigDecimal
|
||||
import java.math.RoundingMode
|
||||
|
||||
interface ExoPlayerDelegate {
|
||||
fun onPropertyChange(name: String, value: Any?)
|
||||
@@ -80,7 +73,9 @@ class ExoPlayerCore(private val activity: Activity) : Player.Listener {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "ExoPlayerCore"
|
||||
private const val SHORT_VIDEO_LENGTH_MS = 300000L // 5 minutes
|
||||
|
||||
private const val WATCHDOG_CHECK_INTERVAL_MS = 1000L
|
||||
private const val WATCHDOG_TIMEOUT_MS = 8000L
|
||||
}
|
||||
|
||||
private var surfaceView: SurfaceView? = null
|
||||
@@ -88,27 +83,27 @@ class ExoPlayerCore(private val activity: Activity) : Player.Listener {
|
||||
private var subtitleView: SubtitleView? = null
|
||||
private var assHandler: AssHandler? = null
|
||||
private var overlayLayoutListener: ViewTreeObserver.OnGlobalLayoutListener? = null
|
||||
private var lastVideoSize: VideoSize? = null
|
||||
private var exoPlayer: ExoPlayer? = null
|
||||
private var trackSelector: DefaultTrackSelector? = null
|
||||
private var tunnelingUserEnabled: Boolean = true
|
||||
private var tunnelingDisabledForCodec: Boolean = false
|
||||
private var pendingStartPositionMs: Long = 0L
|
||||
|
||||
// Frame watchdog: detects black screen (audio plays but 0 video frames rendered)
|
||||
private var frameWatchdogRunnable: Runnable? = null
|
||||
private var frameWatchdogStartTime: Long = 0L
|
||||
var delegate: ExoPlayerDelegate? = null
|
||||
var debugLoggingEnabled: Boolean = false
|
||||
var isInitialized: Boolean = false
|
||||
private set
|
||||
|
||||
// Frame rate matching
|
||||
private var currentVideoFps: Float = 0f
|
||||
private var displayListener: DisplayManager.DisplayListener? = null
|
||||
private var frameRateManager: FrameRateManager? = null
|
||||
private val handler = Handler(Looper.getMainLooper())
|
||||
|
||||
// Audio focus
|
||||
private var audioManager: AudioManager? = null
|
||||
private var audioFocusRequest: AudioFocusRequest? = null
|
||||
private var hasAudioFocus: Boolean = false
|
||||
private var wasPlayingBeforeFocusLoss: Boolean = false
|
||||
|
||||
// Memory pressure detection
|
||||
private var memoryCallback: ComponentCallbacks2? = null
|
||||
private var audioFocusManager: AudioFocusManager? = null
|
||||
|
||||
// Track state for event emission
|
||||
private var lastPosition: Long = 0
|
||||
@@ -121,33 +116,37 @@ class ExoPlayerCore(private val activity: Activity) : Player.Listener {
|
||||
private var currentMediaUri: String? = null
|
||||
private var currentHeaders: Map<String, String>? = null
|
||||
|
||||
private val audioFocusChangeListener = AudioManager.OnAudioFocusChangeListener { focusChange ->
|
||||
when (focusChange) {
|
||||
AudioManager.AUDIOFOCUS_GAIN -> {
|
||||
Log.d(TAG, "Audio focus gained")
|
||||
hasAudioFocus = true
|
||||
if (wasPlayingBeforeFocusLoss && isInitialized) {
|
||||
exoPlayer?.play()
|
||||
wasPlayingBeforeFocusLoss = false
|
||||
}
|
||||
}
|
||||
AudioManager.AUDIOFOCUS_LOSS -> {
|
||||
Log.d(TAG, "Audio focus lost permanently")
|
||||
hasAudioFocus = false
|
||||
if (isInitialized) {
|
||||
wasPlayingBeforeFocusLoss = exoPlayer?.isPlaying == true
|
||||
exoPlayer?.pause()
|
||||
}
|
||||
}
|
||||
AudioManager.AUDIOFOCUS_LOSS_TRANSIENT,
|
||||
AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK -> {
|
||||
Log.d(TAG, "Audio focus lost transiently")
|
||||
hasAudioFocus = false
|
||||
if (isInitialized) {
|
||||
wasPlayingBeforeFocusLoss = exoPlayer?.isPlaying == true
|
||||
exoPlayer?.pause()
|
||||
private fun emitLog(level: String, prefix: String, message: String) {
|
||||
when (level) {
|
||||
"error" -> Log.e(TAG, "[$prefix] $message")
|
||||
"warn" -> Log.w(TAG, "[$prefix] $message")
|
||||
"info" -> Log.i(TAG, "[$prefix] $message")
|
||||
else -> Log.d(TAG, "[$prefix] $message")
|
||||
}
|
||||
if (debugLoggingEnabled) {
|
||||
delegate?.onEvent("log-message", mapOf(
|
||||
"prefix" to prefix, "level" to level, "text" to message
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
private fun redactUri(uri: String): String {
|
||||
return try {
|
||||
val parsed = Uri.parse(uri)
|
||||
val params = parsed.queryParameterNames
|
||||
if (params.isEmpty()) return uri
|
||||
val builder = parsed.buildUpon().clearQuery()
|
||||
for (name in params) {
|
||||
val lower = name.lowercase()
|
||||
if (lower.contains("token") || lower.contains("key") || lower.contains("auth")) {
|
||||
builder.appendQueryParameter(name, "[REDACTED]")
|
||||
} else {
|
||||
builder.appendQueryParameter(name, parsed.getQueryParameter(name))
|
||||
}
|
||||
}
|
||||
builder.build().toString()
|
||||
} catch (_: Exception) {
|
||||
uri
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,44 +154,9 @@ class ExoPlayerCore(private val activity: Activity) : Player.Listener {
|
||||
val contentView = activity.findViewById<ViewGroup>(android.R.id.content)
|
||||
contentView.post {
|
||||
if (!isInitialized) return@post
|
||||
var flutterContainer: ViewGroup? = null
|
||||
|
||||
for (i in 0 until contentView.childCount) {
|
||||
val child = contentView.getChildAt(i)
|
||||
if (child is ViewGroup && child.javaClass.name.contains("FlutterView")) {
|
||||
flutterContainer = child
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (flutterContainer == null) {
|
||||
for (i in contentView.childCount - 1 downTo 0) {
|
||||
val child = contentView.getChildAt(i)
|
||||
if (child is ViewGroup && child != surfaceContainer && child.childCount > 0) {
|
||||
flutterContainer = child
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flutterContainer?.let { container ->
|
||||
contentView.bringChildToFront(container)
|
||||
for (j in 0 until container.childCount) {
|
||||
val flutterChild = container.getChildAt(j)
|
||||
if (flutterChild is SurfaceView) {
|
||||
// Don't use setZOrderOnTop - let Flutter render in normal view order
|
||||
// This allows SubtitleView (added via addContentView) to render above
|
||||
flutterChild.setZOrderOnTop(false)
|
||||
flutterChild.setZOrderMediaOverlay(true)
|
||||
flutterChild.holder.setFormat(PixelFormat.TRANSLUCENT)
|
||||
break
|
||||
} else if (flutterChild is TextureView) {
|
||||
flutterChild.isOpaque = false
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val container = FlutterOverlayHelper.findFlutterContainer(contentView, surfaceContainer)
|
||||
?: return@post
|
||||
FlutterOverlayHelper.configureFlutterZOrder(contentView, container, zOrderOnTop = false)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,14 +176,34 @@ class ExoPlayerCore(private val activity: Activity) : Player.Listener {
|
||||
}
|
||||
}
|
||||
|
||||
fun initialize(bufferSizeBytes: Int? = null): Boolean {
|
||||
fun initialize(bufferSizeBytes: Int? = null, tunnelingEnabled: Boolean = true): Boolean {
|
||||
if (isInitialized) {
|
||||
Log.d(TAG, "Already initialized")
|
||||
return true
|
||||
}
|
||||
|
||||
tunnelingUserEnabled = tunnelingEnabled
|
||||
|
||||
try {
|
||||
audioManager = activity.getSystemService(Context.AUDIO_SERVICE) as AudioManager
|
||||
audioFocusManager = AudioFocusManager(
|
||||
context = activity,
|
||||
handler = handler,
|
||||
onPause = { if (isInitialized) exoPlayer?.pause() },
|
||||
onResume = { if (isInitialized) exoPlayer?.play() },
|
||||
isPaused = { exoPlayer?.isPlaying != true },
|
||||
log = { emitLog("debug", "audio", it) }
|
||||
)
|
||||
frameRateManager = FrameRateManager(
|
||||
activity = activity,
|
||||
handler = handler,
|
||||
onDisplayChanged = {
|
||||
if (exoPlayer?.isPlaying == false && audioFocusManager?.wasPlayingBeforeFocusLoss == true) {
|
||||
Log.d(TAG, "Display changed, resuming playback")
|
||||
exoPlayer?.play()
|
||||
}
|
||||
},
|
||||
log = { emitLog("info", "framerate", it) }
|
||||
)
|
||||
|
||||
// Create FrameLayout container for video (enables centering for aspect ratio)
|
||||
surfaceContainer = FrameLayout(activity).apply {
|
||||
@@ -263,30 +247,20 @@ class ExoPlayerCore(private val activity: Activity) : Player.Listener {
|
||||
contentView.addView(surfaceContainer, 0)
|
||||
|
||||
// Find FlutterView and configure z-order
|
||||
// Video SurfaceView is at the bottom (setZOrderOnTop=false, setZOrderMediaOverlay=false)
|
||||
// Flutter SurfaceView uses setZOrderMediaOverlay to render above video and subtitles
|
||||
for (i in 0 until contentView.childCount) {
|
||||
val child = contentView.getChildAt(i)
|
||||
if (child is ViewGroup && child.javaClass.name.contains("FlutterView")) {
|
||||
contentView.bringChildToFront(child)
|
||||
for (j in 0 until child.childCount) {
|
||||
val flutterChild = child.getChildAt(j)
|
||||
if (flutterChild is SurfaceView) {
|
||||
// Use setZOrderMediaOverlay instead of setZOrderOnTop
|
||||
// This puts Flutter above video but below normal views
|
||||
flutterChild.setZOrderOnTop(false)
|
||||
flutterChild.setZOrderMediaOverlay(true)
|
||||
flutterChild.holder.setFormat(PixelFormat.TRANSLUCENT)
|
||||
break
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
// Video SurfaceView is at the bottom, Flutter uses setZOrderMediaOverlay to render above
|
||||
FlutterOverlayHelper.findFlutterContainer(contentView, surfaceContainer)?.let { container ->
|
||||
FlutterOverlayHelper.configureFlutterZOrder(contentView, container, zOrderOnTop = false)
|
||||
}
|
||||
|
||||
ensureFlutterOverlayOnTop()
|
||||
overlayLayoutListener = ViewTreeObserver.OnGlobalLayoutListener {
|
||||
ensureFlutterOverlayOnTop()
|
||||
// Recalculate surface size on layout change (orientation/PiP transitions)
|
||||
lastVideoSize?.let { vs ->
|
||||
if (vs.width > 0 && vs.height > 0) {
|
||||
updateSurfaceViewSize(vs.width, vs.height, vs.pixelWidthHeightRatio)
|
||||
}
|
||||
}
|
||||
}
|
||||
contentView.viewTreeObserver.addOnGlobalLayoutListener(overlayLayoutListener)
|
||||
|
||||
@@ -296,7 +270,7 @@ class ExoPlayerCore(private val activity: Activity) : Player.Listener {
|
||||
trackSelector = DefaultTrackSelector(activity).apply {
|
||||
setParameters(
|
||||
buildUponParameters()
|
||||
.setTunnelingEnabled(true)
|
||||
.setTunnelingEnabled(tunnelingUserEnabled)
|
||||
.setTrackTypeDisabled(C.TRACK_TYPE_TEXT, false)
|
||||
.setPreferredTextLanguage("en")
|
||||
)
|
||||
@@ -310,10 +284,19 @@ class ExoPlayerCore(private val activity: Activity) : Player.Listener {
|
||||
|
||||
// Use DefaultRenderersFactory with FFmpeg fallback for unsupported audio codecs
|
||||
val renderersFactory = DefaultRenderersFactory(activity).apply {
|
||||
// Enable decoder fallback - if MediaCodec fails, try FFmpeg
|
||||
setEnableDecoderFallback(true)
|
||||
// Use FFmpeg decoders as fallback (not preferred over native)
|
||||
setExtensionRendererMode(DefaultRenderersFactory.EXTENSION_RENDERER_MODE_ON)
|
||||
// Force FFmpeg for FLAC — hardware FLAC decoders (e.g. Samsung c2.sec.flac.decoder)
|
||||
// have buggy 32KB input buffer limits causing InsufficientCapacityException.
|
||||
setMediaCodecSelector { mimeType, requiresSecureDecoder, requiresTunnelingDecoder ->
|
||||
if (mimeType == MimeTypes.AUDIO_FLAC) {
|
||||
emptyList()
|
||||
} else {
|
||||
MediaCodecSelector.DEFAULT.getDecoderInfos(
|
||||
mimeType, requiresSecureDecoder, requiresTunnelingDecoder
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create factories for buildWithAssSupport (like AndroidTV-FireTV)
|
||||
@@ -374,7 +357,7 @@ class ExoPlayerCore(private val activity: Activity) : Player.Listener {
|
||||
setBufferDurationsMs(30_000, 60_000, 2_500, 5_000)
|
||||
}
|
||||
}.build()
|
||||
Log.d(TAG, "Buffer: ${targetBufferBytes / 1024 / 1024}MB limit, available=${availableMB}MB")
|
||||
emitLog("info", "init", "Buffer: ${targetBufferBytes / 1024 / 1024}MB limit, available=${availableMB}MB, tunneling=${tunnelingUserEnabled}")
|
||||
|
||||
exoPlayer = ExoPlayer.Builder(activity)
|
||||
.setTrackSelector(trackSelector!!)
|
||||
@@ -408,22 +391,6 @@ class ExoPlayerCore(private val activity: Activity) : Player.Listener {
|
||||
}
|
||||
}
|
||||
|
||||
// Register memory pressure listener to detect impending OOM
|
||||
memoryCallback = object : ComponentCallbacks2 {
|
||||
override fun onTrimMemory(level: Int) {
|
||||
if (level >= ComponentCallbacks2.TRIM_MEMORY_RUNNING_CRITICAL) {
|
||||
Log.w(TAG, "TRIM_MEMORY level $level - critical memory pressure")
|
||||
delegate?.onEvent("memory-pressure", mapOf("level" to "critical"))
|
||||
}
|
||||
}
|
||||
override fun onConfigurationChanged(newConfig: Configuration) {}
|
||||
override fun onLowMemory() {
|
||||
Log.w(TAG, "onLowMemory - system-wide memory pressure")
|
||||
delegate?.onEvent("memory-pressure", mapOf("level" to "critical"))
|
||||
}
|
||||
}
|
||||
activity.registerComponentCallbacks(memoryCallback)
|
||||
|
||||
// Start position update loop
|
||||
startPositionUpdates()
|
||||
|
||||
@@ -438,16 +405,16 @@ class ExoPlayerCore(private val activity: Activity) : Player.Listener {
|
||||
|
||||
private val surfaceCallback = object : android.view.SurfaceHolder.Callback {
|
||||
override fun surfaceCreated(holder: android.view.SurfaceHolder) {
|
||||
Log.d(TAG, "Surface created")
|
||||
emitLog("debug", "surface", "Created")
|
||||
ensureFlutterOverlayOnTop()
|
||||
}
|
||||
|
||||
override fun surfaceChanged(holder: android.view.SurfaceHolder, format: Int, width: Int, height: Int) {
|
||||
Log.d(TAG, "Surface changed: ${width}x${height}")
|
||||
emitLog("debug", "surface", "Changed: ${width}x${height}")
|
||||
}
|
||||
|
||||
override fun surfaceDestroyed(holder: android.view.SurfaceHolder) {
|
||||
Log.d(TAG, "Surface destroyed")
|
||||
emitLog("debug", "surface", "Destroyed")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -514,7 +481,7 @@ class ExoPlayerCore(private val activity: Activity) : Player.Listener {
|
||||
Player.STATE_ENDED -> "ended"
|
||||
else -> "unknown"
|
||||
}
|
||||
Log.d(TAG, "onPlaybackStateChanged: $stateStr")
|
||||
emitLog("debug", "state", stateStr)
|
||||
|
||||
when (state) {
|
||||
Player.STATE_BUFFERING -> {
|
||||
@@ -526,7 +493,7 @@ class ExoPlayerCore(private val activity: Activity) : Player.Listener {
|
||||
if (pendingStartPositionMs > 0L) {
|
||||
val currentPos = exoPlayer?.currentPosition ?: 0L
|
||||
if (currentPos < 1000L) {
|
||||
Log.w(TAG, "Position lost during init (at ${currentPos}ms, expected ${pendingStartPositionMs}ms) — restoring")
|
||||
emitLog("warn", "state", "Position lost (at ${currentPos}ms, expected ${pendingStartPositionMs}ms) — restoring")
|
||||
exoPlayer?.seekTo(pendingStartPositionMs)
|
||||
}
|
||||
pendingStartPositionMs = 0L
|
||||
@@ -534,8 +501,12 @@ class ExoPlayerCore(private val activity: Activity) : Player.Listener {
|
||||
delegate?.onPropertyChange("paused-for-cache", false)
|
||||
delegate?.onEvent("playback-restart", null)
|
||||
emitTrackList()
|
||||
|
||||
// Start frame watchdog to detect black screen (HDR tunneling issue)
|
||||
startFrameWatchdog()
|
||||
}
|
||||
Player.STATE_ENDED -> {
|
||||
stopFrameWatchdog()
|
||||
delegate?.onPropertyChange("eof-reached", true)
|
||||
delegate?.onEvent("end-file", mapOf("reason" to "eof"))
|
||||
}
|
||||
@@ -544,12 +515,28 @@ class ExoPlayerCore(private val activity: Activity) : Player.Listener {
|
||||
|
||||
override fun onTracksChanged(tracks: Tracks) {
|
||||
Log.d(TAG, "onTracksChanged")
|
||||
// Log selected video and audio track details
|
||||
val videoGroup = tracks.groups.firstOrNull { it.type == C.TRACK_TYPE_VIDEO && it.isSelected }
|
||||
val audioGroup = tracks.groups.firstOrNull { it.type == C.TRACK_TYPE_AUDIO && it.isSelected }
|
||||
if (videoGroup != null) {
|
||||
val vf = videoGroup.mediaTrackGroup.getFormat(0)
|
||||
val hdr = vf.colorInfo?.let { ci ->
|
||||
val transfer = ci.colorTransfer
|
||||
if (transfer != null && transfer != 0) " HDR(transfer=$transfer)" else ""
|
||||
} ?: ""
|
||||
emitLog("info", "tracks", "Video: ${vf.codecs} ${vf.width}x${vf.height}$hdr")
|
||||
}
|
||||
if (audioGroup != null) {
|
||||
val af = audioGroup.mediaTrackGroup.getFormat(0)
|
||||
emitLog("info", "tracks", "Audio: ${af.codecs} ${af.channelCount}ch ${af.sampleRate}Hz")
|
||||
}
|
||||
evaluateAudioCodecForTunneling()
|
||||
emitTrackList()
|
||||
}
|
||||
|
||||
override fun onPlayerError(error: PlaybackException) {
|
||||
Log.e(TAG, "Player error: ${error.message} (code: ${error.errorCode})", error)
|
||||
emitLog("error", "player", "Error code=${error.errorCode}: ${error.message}, cause=${error.cause?.javaClass?.simpleName}")
|
||||
stopFrameWatchdog()
|
||||
|
||||
if (currentMediaUri != null) {
|
||||
Log.w(TAG, "ExoPlayer error (code ${error.errorCode}) - attempting fallback to MPV")
|
||||
@@ -577,6 +564,7 @@ class ExoPlayerCore(private val activity: Activity) : Player.Listener {
|
||||
|
||||
override fun onVideoSizeChanged(videoSize: VideoSize) {
|
||||
Log.d(TAG, "Video size changed: ${videoSize.width}x${videoSize.height}, ratio: ${videoSize.pixelWidthHeightRatio}")
|
||||
lastVideoSize = videoSize
|
||||
updateSurfaceViewSize(videoSize.width, videoSize.height, videoSize.pixelWidthHeightRatio)
|
||||
}
|
||||
|
||||
@@ -732,6 +720,9 @@ class ExoPlayerCore(private val activity: Activity) : Player.Listener {
|
||||
// Tunneling control — disabled when audio codec has no hardware decoder (requires FFmpeg)
|
||||
|
||||
private fun hasHardwareAudioDecoder(mimeType: String): Boolean {
|
||||
// FLAC hardware decoders are excluded via MediaCodecSelector (Samsung c2.sec.flac.decoder
|
||||
// has buggy 32KB input buffer limits), so report no hardware decoder for tunneling purposes.
|
||||
if (mimeType == MimeTypes.AUDIO_FLAC) return false
|
||||
try {
|
||||
val codecList = android.media.MediaCodecList(android.media.MediaCodecList.REGULAR_CODECS)
|
||||
for (info in codecList.codecInfos) {
|
||||
@@ -760,10 +751,10 @@ class ExoPlayerCore(private val activity: Activity) : Player.Listener {
|
||||
val selector = trackSelector ?: return
|
||||
val player = exoPlayer ?: return
|
||||
val currentSpeed = player.playbackParameters.speed
|
||||
val shouldTunnel = (currentSpeed == 1f) && !tunnelingDisabledForCodec
|
||||
val shouldTunnel = tunnelingUserEnabled && (currentSpeed == 1f) && !tunnelingDisabledForCodec
|
||||
val currentTunneling = selector.parameters.tunnelingEnabled
|
||||
if (shouldTunnel == currentTunneling) return // No change needed
|
||||
Log.d(TAG, "updateTunnelingState: tunneling $currentTunneling -> $shouldTunnel")
|
||||
emitLog("info", "tunneling", "tunneling $currentTunneling -> $shouldTunnel (user=$tunnelingUserEnabled, speed=$currentSpeed, codecDisabled=$tunnelingDisabledForCodec)")
|
||||
selector.setParameters(
|
||||
selector.buildUponParameters()
|
||||
.setTunnelingEnabled(shouldTunnel)
|
||||
@@ -787,11 +778,61 @@ class ExoPlayerCore(private val activity: Activity) : Player.Listener {
|
||||
val newDisabled = !hasHardwareAudioDecoder(mimeType)
|
||||
if (newDisabled != tunnelingDisabledForCodec) {
|
||||
tunnelingDisabledForCodec = newDisabled
|
||||
Log.i(TAG, "Audio codec ${format.codecs} ($mimeType): tunneling ${if (newDisabled) "DISABLED" else "enabled"}")
|
||||
emitLog("info", "tunneling", "Audio codec ${format.codecs} ($mimeType): tunneling ${if (newDisabled) "DISABLED (no hw decoder)" else "enabled"}")
|
||||
updateTunnelingState()
|
||||
}
|
||||
}
|
||||
|
||||
// Frame watchdog: detects when ExoPlayer plays audio but renders 0 video frames
|
||||
// (common with HDR tunneling on unsupported devices — black screen, no error)
|
||||
|
||||
private fun startFrameWatchdog() {
|
||||
stopFrameWatchdog()
|
||||
emitLog("debug", "watchdog", "Started (timeout=${WATCHDOG_TIMEOUT_MS}ms)")
|
||||
frameWatchdogStartTime = System.currentTimeMillis()
|
||||
frameWatchdogRunnable = object : Runnable {
|
||||
override fun run() {
|
||||
val player = exoPlayer ?: return
|
||||
val renderedFrames = player.videoDecoderCounters?.renderedOutputBufferCount ?: 0
|
||||
|
||||
if (renderedFrames > 0) {
|
||||
emitLog("debug", "watchdog", "$renderedFrames frames rendered, cleared")
|
||||
stopFrameWatchdog()
|
||||
return
|
||||
}
|
||||
|
||||
val elapsed = System.currentTimeMillis() - frameWatchdogStartTime
|
||||
|
||||
// Check if we have a video track selected
|
||||
val hasVideoTrack = player.currentTracks.groups.any {
|
||||
it.type == C.TRACK_TYPE_VIDEO && it.isSelected
|
||||
}
|
||||
|
||||
if (elapsed >= WATCHDOG_TIMEOUT_MS && player.isPlaying && hasVideoTrack) {
|
||||
emitLog("warn", "watchdog", "0 frames rendered after ${elapsed}ms — triggering fallback")
|
||||
stopFrameWatchdog()
|
||||
// Trigger fallback via the same delegate path as player errors
|
||||
val uri = currentMediaUri ?: return
|
||||
delegate?.onFormatUnsupported(
|
||||
uri = uri,
|
||||
headers = currentHeaders,
|
||||
positionMs = player.currentPosition,
|
||||
errorMessage = "Black screen detected: 0 video frames rendered after ${elapsed}ms"
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
handler.postDelayed(this, WATCHDOG_CHECK_INTERVAL_MS)
|
||||
}
|
||||
}
|
||||
handler.postDelayed(frameWatchdogRunnable!!, WATCHDOG_CHECK_INTERVAL_MS)
|
||||
}
|
||||
|
||||
private fun stopFrameWatchdog() {
|
||||
frameWatchdogRunnable?.let { handler.removeCallbacks(it) }
|
||||
frameWatchdogRunnable = null
|
||||
}
|
||||
|
||||
// Public API
|
||||
|
||||
fun open(uri: String, headers: Map<String, String>?, startPositionMs: Long, autoPlay: Boolean, isLive: Boolean = false) {
|
||||
@@ -828,7 +869,7 @@ class ExoPlayerCore(private val activity: Activity) : Player.Listener {
|
||||
playWhenReady = autoPlay
|
||||
}
|
||||
|
||||
Log.d(TAG, "Opened live: $uri, startPosition: ${startPositionMs}ms, autoPlay: $autoPlay")
|
||||
emitLog("info", "media", "Opened live: ${redactUri(uri)}, startPosition: ${startPositionMs}ms, autoPlay: $autoPlay")
|
||||
return
|
||||
}
|
||||
|
||||
@@ -851,7 +892,7 @@ class ExoPlayerCore(private val activity: Activity) : Player.Listener {
|
||||
playWhenReady = autoPlay
|
||||
}
|
||||
|
||||
Log.d(TAG, "Opened: $uri, startPosition: ${startPositionMs}ms, autoPlay: $autoPlay")
|
||||
emitLog("info", "media", "Opened: ${redactUri(uri)}, startPosition: ${startPositionMs}ms, autoPlay: $autoPlay, tunneling=$tunnelingUserEnabled")
|
||||
}
|
||||
|
||||
fun play() {
|
||||
@@ -863,6 +904,7 @@ class ExoPlayerCore(private val activity: Activity) : Player.Listener {
|
||||
}
|
||||
|
||||
fun stop() {
|
||||
stopFrameWatchdog()
|
||||
exoPlayer?.stop()
|
||||
setVisible(false)
|
||||
}
|
||||
@@ -907,7 +949,7 @@ class ExoPlayerCore(private val activity: Activity) : Player.Listener {
|
||||
}
|
||||
|
||||
val currentSpeed = player.playbackParameters.speed
|
||||
val shouldTunnel = (currentSpeed == 1f) && !tunnelingDisabledForCodec
|
||||
val shouldTunnel = tunnelingUserEnabled && (currentSpeed == 1f) && !tunnelingDisabledForCodec
|
||||
|
||||
selector.parameters = selector.buildUponParameters()
|
||||
.setOverrideForType(TrackSelectionOverride(group.mediaTrackGroup, 0))
|
||||
@@ -1104,213 +1146,18 @@ class ExoPlayerCore(private val activity: Activity) : Player.Listener {
|
||||
|
||||
// Audio Focus
|
||||
|
||||
fun requestAudioFocus(): Boolean {
|
||||
val am = audioManager ?: return false
|
||||
fun requestAudioFocus(): Boolean = audioFocusManager?.requestAudioFocus() ?: false
|
||||
|
||||
Log.d(TAG, "Requesting audio focus")
|
||||
|
||||
val result = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
val focusRequest = AudioFocusRequest.Builder(AudioManager.AUDIOFOCUS_GAIN)
|
||||
.setAudioAttributes(
|
||||
AudioAttributes.Builder()
|
||||
.setUsage(AudioAttributes.USAGE_MEDIA)
|
||||
.setContentType(AudioAttributes.CONTENT_TYPE_MOVIE)
|
||||
.build()
|
||||
)
|
||||
.setOnAudioFocusChangeListener(audioFocusChangeListener, handler)
|
||||
.setWillPauseWhenDucked(true)
|
||||
.build()
|
||||
|
||||
audioFocusRequest = focusRequest
|
||||
am.requestAudioFocus(focusRequest)
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
am.requestAudioFocus(
|
||||
audioFocusChangeListener,
|
||||
AudioManager.STREAM_MUSIC,
|
||||
AudioManager.AUDIOFOCUS_GAIN
|
||||
)
|
||||
}
|
||||
|
||||
hasAudioFocus = (result == AudioManager.AUDIOFOCUS_REQUEST_GRANTED)
|
||||
Log.d(TAG, "Audio focus request result: $result, granted: $hasAudioFocus")
|
||||
return hasAudioFocus
|
||||
}
|
||||
|
||||
fun abandonAudioFocus() {
|
||||
val am = audioManager ?: return
|
||||
|
||||
Log.d(TAG, "Abandoning audio focus")
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
audioFocusRequest?.let { am.abandonAudioFocusRequest(it) }
|
||||
audioFocusRequest = null
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
am.abandonAudioFocus(audioFocusChangeListener)
|
||||
}
|
||||
|
||||
hasAudioFocus = false
|
||||
wasPlayingBeforeFocusLoss = false
|
||||
}
|
||||
fun abandonAudioFocus() { audioFocusManager?.abandonAudioFocus() }
|
||||
|
||||
// Frame Rate Matching
|
||||
|
||||
private fun getDisplayManager(): DisplayManager {
|
||||
return activity.getSystemService(Context.DISPLAY_SERVICE) as DisplayManager
|
||||
}
|
||||
|
||||
fun setVideoFrameRate(fps: Float, videoDurationMs: Long) {
|
||||
currentVideoFps = fps
|
||||
if (fps <= 0f) {
|
||||
Log.d(TAG, "setVideoFrameRate: Invalid fps ($fps), skipping")
|
||||
return
|
||||
}
|
||||
|
||||
val surface = surfaceView?.holder?.surface
|
||||
if (surface == null) {
|
||||
Log.d(TAG, "setVideoFrameRate: Surface not available")
|
||||
return
|
||||
}
|
||||
|
||||
Log.d(TAG, "setVideoFrameRate: fps=$fps, duration=${videoDurationMs}ms, API=${Build.VERSION.SDK_INT}")
|
||||
|
||||
when {
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> setFrameRateS(fps, surface, videoDurationMs)
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.R -> setFrameRateR(fps, surface)
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M -> setFrameRateM(fps)
|
||||
}
|
||||
frameRateManager?.setVideoFrameRate(fps, videoDurationMs, surfaceView?.holder?.surface)
|
||||
}
|
||||
|
||||
fun clearVideoFrameRate() {
|
||||
Log.d(TAG, "clearVideoFrameRate")
|
||||
currentVideoFps = 0f
|
||||
displayListener?.let {
|
||||
getDisplayManager().unregisterDisplayListener(it)
|
||||
displayListener = null
|
||||
}
|
||||
}
|
||||
|
||||
private fun registerDisplayListener() {
|
||||
displayListener?.let {
|
||||
getDisplayManager().unregisterDisplayListener(it)
|
||||
}
|
||||
|
||||
displayListener = object : DisplayManager.DisplayListener {
|
||||
override fun onDisplayAdded(displayId: Int) = Unit
|
||||
override fun onDisplayRemoved(displayId: Int) = Unit
|
||||
override fun onDisplayChanged(displayId: Int) {
|
||||
handler.postDelayed({
|
||||
if (exoPlayer?.isPlaying == false && wasPlayingBeforeFocusLoss) {
|
||||
Log.d(TAG, "Display changed, resuming playback")
|
||||
exoPlayer?.play()
|
||||
}
|
||||
}, 2000L)
|
||||
getDisplayManager().unregisterDisplayListener(this)
|
||||
displayListener = null
|
||||
}
|
||||
}
|
||||
getDisplayManager().registerDisplayListener(displayListener, handler)
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.R)
|
||||
private fun setFrameRateR(fps: Float, surface: Surface) {
|
||||
Log.d(TAG, "setFrameRateR: Setting frame rate to $fps")
|
||||
surface.setFrameRate(fps, Surface.FRAME_RATE_COMPATIBILITY_FIXED_SOURCE)
|
||||
registerDisplayListener()
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.S)
|
||||
private fun setFrameRateS(fps: Float, surface: Surface, videoDurationMs: Long) {
|
||||
Log.d(TAG, "setFrameRateS: fps=$fps, duration=${videoDurationMs}ms")
|
||||
|
||||
if (videoDurationMs < SHORT_VIDEO_LENGTH_MS) {
|
||||
Log.d(TAG, "Short video, using seamless-only switching")
|
||||
surface.setFrameRate(
|
||||
fps,
|
||||
Surface.FRAME_RATE_COMPATIBILITY_FIXED_SOURCE,
|
||||
Surface.CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
var seamless = false
|
||||
activity.display?.mode?.alternativeRefreshRates?.let { refreshRates ->
|
||||
for (rate in refreshRates) {
|
||||
if (fps.toString().startsWith(rate.toString()) ||
|
||||
rate.toString().startsWith(fps.toString()) ||
|
||||
rate % fps == 0f) {
|
||||
seamless = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (seamless) {
|
||||
Log.d(TAG, "Seamless switch available, using CHANGE_FRAME_RATE_ALWAYS")
|
||||
surface.setFrameRate(
|
||||
fps,
|
||||
Surface.FRAME_RATE_COMPATIBILITY_FIXED_SOURCE,
|
||||
Surface.CHANGE_FRAME_RATE_ALWAYS
|
||||
)
|
||||
registerDisplayListener()
|
||||
} else {
|
||||
val userPreference = getDisplayManager().matchContentFrameRateUserPreference
|
||||
if (userPreference == DisplayManager.MATCH_CONTENT_FRAMERATE_ALWAYS) {
|
||||
Log.d(TAG, "User preference allows non-seamless switch")
|
||||
surface.setFrameRate(
|
||||
fps,
|
||||
Surface.FRAME_RATE_COMPATIBILITY_FIXED_SOURCE,
|
||||
Surface.CHANGE_FRAME_RATE_ALWAYS
|
||||
)
|
||||
registerDisplayListener()
|
||||
} else {
|
||||
Log.d(TAG, "Non-seamless switch not allowed, using seamless-only")
|
||||
surface.setFrameRate(
|
||||
fps,
|
||||
Surface.FRAME_RATE_COMPATIBILITY_FIXED_SOURCE,
|
||||
Surface.CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
private fun setFrameRateM(fps: Float) {
|
||||
Log.d(TAG, "setFrameRateM: fps=$fps")
|
||||
val wm = activity.getSystemService(Context.WINDOW_SERVICE) as WindowManager
|
||||
@Suppress("DEPRECATION")
|
||||
val display = wm.defaultDisplay ?: return
|
||||
|
||||
display.supportedModes?.let { supportedModes ->
|
||||
val currentMode = display.mode
|
||||
var modeToUse = currentMode
|
||||
|
||||
for (mode in supportedModes) {
|
||||
if (mode.physicalHeight != currentMode.physicalHeight ||
|
||||
mode.physicalWidth != currentMode.physicalWidth) {
|
||||
continue
|
||||
}
|
||||
|
||||
if (BigDecimal(fps.toString()).setScale(1, RoundingMode.FLOOR) ==
|
||||
BigDecimal(mode.refreshRate.toString()).setScale(1, RoundingMode.FLOOR)) {
|
||||
modeToUse = mode
|
||||
break
|
||||
} else if (mode.refreshRate % fps == 0f) {
|
||||
modeToUse = mode
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (modeToUse != currentMode) {
|
||||
Log.d(TAG, "Switching to mode ${modeToUse.modeId} (${modeToUse.refreshRate}Hz)")
|
||||
activity.window?.attributes?.let { attrs ->
|
||||
attrs.preferredDisplayModeId = modeToUse.modeId
|
||||
activity.window?.attributes = attrs
|
||||
}
|
||||
registerDisplayListener()
|
||||
}
|
||||
}
|
||||
frameRateManager?.clearVideoFrameRate()
|
||||
}
|
||||
|
||||
// Stats
|
||||
@@ -1387,13 +1234,12 @@ class ExoPlayerCore(private val activity: Activity) : Player.Listener {
|
||||
fun dispose() {
|
||||
Log.d(TAG, "Disposing")
|
||||
|
||||
stopFrameWatchdog()
|
||||
stopPositionUpdates()
|
||||
clearVideoFrameRate()
|
||||
abandonAudioFocus()
|
||||
audioManager = null
|
||||
|
||||
memoryCallback?.let { activity.unregisterComponentCallbacks(it) }
|
||||
memoryCallback = null
|
||||
frameRateManager?.clearVideoFrameRate()
|
||||
frameRateManager = null
|
||||
audioFocusManager?.release()
|
||||
audioFocusManager = null
|
||||
|
||||
tunnelingDisabledForCodec = false
|
||||
pendingStartPositionMs = 0L
|
||||
@@ -1404,23 +1250,21 @@ class ExoPlayerCore(private val activity: Activity) : Player.Listener {
|
||||
trackSelector = null
|
||||
assHandler = null
|
||||
|
||||
surfaceView?.holder?.removeCallback(surfaceCallback)
|
||||
val cb = surfaceCallback
|
||||
val sv = surfaceView
|
||||
overlayLayoutListener?.let { listener ->
|
||||
val contentView = activity.findViewById<ViewGroup>(android.R.id.content)
|
||||
contentView.viewTreeObserver.removeOnGlobalLayoutListener(listener)
|
||||
}
|
||||
overlayLayoutListener = null
|
||||
|
||||
// Remove SurfaceView from container synchronously — triggers
|
||||
// onDetachedFromWindow which properly unregisters PositionUpdateListener
|
||||
// and releases SurfaceControl before the render thread can access it.
|
||||
// Defer all view removal to avoid AOSP bug where
|
||||
// dispatchWindowVisibilityChanged iterates stale children array
|
||||
// when removeView() runs during an active performTraversals pass.
|
||||
val container = surfaceContainer
|
||||
surfaceView?.let { container?.removeView(it) }
|
||||
subtitleView?.let { container?.removeView(it) }
|
||||
|
||||
// Defer empty container removal (plain FrameLayout, no SurfaceControl)
|
||||
val contentView = activity.findViewById<ViewGroup>(android.R.id.content)
|
||||
contentView.post {
|
||||
sv?.holder?.removeCallback(cb)
|
||||
container?.let { contentView.removeView(it) }
|
||||
}
|
||||
surfaceContainer = null
|
||||
|
||||
@@ -29,10 +29,13 @@ class ExoPlayerPlugin : FlutterPlugin, MethodChannel.MethodCallHandler,
|
||||
private var playerCore: ExoPlayerCore? = null
|
||||
private var mpvCore: MpvPlayerCore? = null // MPV fallback player
|
||||
private var usingMpvFallback: Boolean = false
|
||||
private var fallbackInProgress: Boolean = false
|
||||
private var activity: Activity? = null
|
||||
private var activityBinding: ActivityPluginBinding? = null
|
||||
private val nameToId = mutableMapOf<String, Int>()
|
||||
private var configuredBufferSizeBytes: Int? = null
|
||||
private var configuredTunnelingEnabled: Boolean = true
|
||||
private var debugLoggingEnabled: Boolean = false
|
||||
|
||||
// FlutterPlugin
|
||||
|
||||
@@ -66,6 +69,7 @@ class ExoPlayerPlugin : FlutterPlugin, MethodChannel.MethodCallHandler,
|
||||
mpvCore?.dispose()
|
||||
mpvCore = null
|
||||
usingMpvFallback = false
|
||||
fallbackInProgress = false
|
||||
activity = null
|
||||
activityBinding = null
|
||||
Log.d(TAG, "Detached from activity")
|
||||
@@ -128,6 +132,12 @@ class ExoPlayerPlugin : FlutterPlugin, MethodChannel.MethodCallHandler,
|
||||
}
|
||||
"setSubtitleStyle" -> handleSetSubtitleStyle(call, result)
|
||||
"observeProperty" -> handleObserveProperty(call, result)
|
||||
"setLogLevel" -> {
|
||||
val level = call.argument<String>("level") ?: "warn"
|
||||
debugLoggingEnabled = (level == "v" || level == "debug" || level == "trace")
|
||||
playerCore?.debugLoggingEnabled = debugLoggingEnabled
|
||||
result.success(null)
|
||||
}
|
||||
else -> result.notImplemented()
|
||||
}
|
||||
}
|
||||
@@ -146,14 +156,20 @@ class ExoPlayerPlugin : FlutterPlugin, MethodChannel.MethodCallHandler,
|
||||
}
|
||||
|
||||
val bufferSizeBytes = call.argument<Int>("bufferSizeBytes")
|
||||
val tunnelingEnabled = call.argument<Boolean>("tunnelingEnabled") ?: true
|
||||
configuredBufferSizeBytes = bufferSizeBytes
|
||||
configuredTunnelingEnabled = tunnelingEnabled
|
||||
|
||||
currentActivity.runOnUiThread {
|
||||
try {
|
||||
playerCore = ExoPlayerCore(currentActivity).apply {
|
||||
delegate = this@ExoPlayerPlugin
|
||||
this.debugLoggingEnabled = this@ExoPlayerPlugin.debugLoggingEnabled
|
||||
}
|
||||
val success = playerCore?.initialize(bufferSizeBytes = bufferSizeBytes) ?: false
|
||||
val success = playerCore?.initialize(
|
||||
bufferSizeBytes = bufferSizeBytes,
|
||||
tunnelingEnabled = tunnelingEnabled,
|
||||
) ?: false
|
||||
|
||||
// Start hidden
|
||||
playerCore?.setVisible(false)
|
||||
@@ -169,14 +185,12 @@ class ExoPlayerPlugin : FlutterPlugin, MethodChannel.MethodCallHandler,
|
||||
|
||||
private fun handleDispose(result: MethodChannel.Result) {
|
||||
activity?.runOnUiThread {
|
||||
if (usingMpvFallback) {
|
||||
mpvCore?.dispose()
|
||||
mpvCore = null
|
||||
} else {
|
||||
playerCore?.dispose()
|
||||
playerCore = null
|
||||
}
|
||||
playerCore?.dispose()
|
||||
playerCore = null
|
||||
mpvCore?.dispose()
|
||||
mpvCore = null
|
||||
usingMpvFallback = false
|
||||
fallbackInProgress = false
|
||||
Log.d(TAG, "Disposed")
|
||||
result.success(null)
|
||||
} ?: result.success(null)
|
||||
@@ -478,7 +492,9 @@ class ExoPlayerPlugin : FlutterPlugin, MethodChannel.MethodCallHandler,
|
||||
private fun getMpvStats(): Map<String, Any?> {
|
||||
val mpv = mpvCore ?: return mapOf("playerType" to "mpv")
|
||||
|
||||
return mapOf(
|
||||
val hasVideo = mpv.getProperty("video-params/w") != null
|
||||
|
||||
val stats = mutableMapOf<String, Any?>(
|
||||
"playerType" to "mpv",
|
||||
// Video metrics
|
||||
"video-codec" to mpv.getProperty("video-codec"),
|
||||
@@ -495,27 +511,32 @@ class ExoPlayerPlugin : FlutterPlugin, MethodChannel.MethodCallHandler,
|
||||
"audio-bitrate" to mpv.getProperty("audio-bitrate"),
|
||||
// Performance metrics
|
||||
"total-avsync-change" to mpv.getProperty("total-avsync-change"),
|
||||
"cache-used" to mpv.getProperty("cache-used"),
|
||||
"cache-speed" to mpv.getProperty("cache-speed"),
|
||||
"display-fps" to mpv.getProperty("display-fps"),
|
||||
"frame-drop-count" to mpv.getProperty("frame-drop-count"),
|
||||
"decoder-frame-drop-count" to mpv.getProperty("decoder-frame-drop-count"),
|
||||
"demuxer-cache-duration" to mpv.getProperty("demuxer-cache-duration"),
|
||||
// Color/Format properties
|
||||
"video-params/pixelformat" to mpv.getProperty("video-params/pixelformat"),
|
||||
"video-params/hw-pixelformat" to mpv.getProperty("video-params/hw-pixelformat"),
|
||||
"video-params/colormatrix" to mpv.getProperty("video-params/colormatrix"),
|
||||
"video-params/primaries" to mpv.getProperty("video-params/primaries"),
|
||||
"video-params/gamma" to mpv.getProperty("video-params/gamma"),
|
||||
// HDR metadata
|
||||
"video-params/max-luma" to mpv.getProperty("video-params/max-luma"),
|
||||
"video-params/min-luma" to mpv.getProperty("video-params/min-luma"),
|
||||
"video-params/max-cll" to mpv.getProperty("video-params/max-cll"),
|
||||
"video-params/max-fall" to mpv.getProperty("video-params/max-fall"),
|
||||
// Other
|
||||
"video-params/aspect-name" to mpv.getProperty("video-params/aspect-name"),
|
||||
"video-params/rotate" to mpv.getProperty("video-params/rotate")
|
||||
)
|
||||
|
||||
// Only query properties that require an active video track
|
||||
if (hasVideo) {
|
||||
stats["display-fps"] = mpv.getProperty("display-fps")
|
||||
// Color/Format properties
|
||||
stats["video-params/pixelformat"] = mpv.getProperty("video-params/pixelformat")
|
||||
stats["video-params/hw-pixelformat"] = mpv.getProperty("video-params/hw-pixelformat")
|
||||
stats["video-params/colormatrix"] = mpv.getProperty("video-params/colormatrix")
|
||||
stats["video-params/primaries"] = mpv.getProperty("video-params/primaries")
|
||||
stats["video-params/gamma"] = mpv.getProperty("video-params/gamma")
|
||||
// HDR metadata
|
||||
stats["video-params/max-luma"] = mpv.getProperty("video-params/max-luma")
|
||||
stats["video-params/min-luma"] = mpv.getProperty("video-params/min-luma")
|
||||
stats["video-params/max-cll"] = mpv.getProperty("video-params/max-cll")
|
||||
stats["video-params/max-fall"] = mpv.getProperty("video-params/max-fall")
|
||||
// Other
|
||||
stats["video-params/aspect-name"] = mpv.getProperty("video-params/aspect-name")
|
||||
stats["video-params/rotate"] = mpv.getProperty("video-params/rotate")
|
||||
}
|
||||
|
||||
return stats
|
||||
}
|
||||
|
||||
// PiP Mode handling
|
||||
@@ -571,78 +592,95 @@ class ExoPlayerPlugin : FlutterPlugin, MethodChannel.MethodCallHandler,
|
||||
positionMs: Long,
|
||||
errorMessage: String
|
||||
): Boolean {
|
||||
if (usingMpvFallback || fallbackInProgress) {
|
||||
Log.w(TAG, "Fallback already active/in-progress, ignoring duplicate request")
|
||||
return true
|
||||
}
|
||||
|
||||
val currentActivity = activity ?: return false
|
||||
fallbackInProgress = true
|
||||
|
||||
Log.i(TAG, "ExoPlayer error, switching to MPV fallback at ${positionMs}ms: $errorMessage")
|
||||
if (debugLoggingEnabled) {
|
||||
onEvent("log-message", mapOf(
|
||||
"prefix" to "fallback", "level" to "warn",
|
||||
"text" to "Switching to MPV at ${positionMs}ms: $errorMessage"
|
||||
))
|
||||
}
|
||||
|
||||
currentActivity.runOnUiThread {
|
||||
try {
|
||||
// Dispose ExoPlayer
|
||||
playerCore?.dispose()
|
||||
playerCore = null
|
||||
mpvCore?.dispose()
|
||||
mpvCore = null
|
||||
|
||||
// Create and initialize MPV
|
||||
mpvCore = MpvPlayerCore(currentActivity).apply {
|
||||
delegate = this@ExoPlayerPlugin
|
||||
}
|
||||
val success = mpvCore?.initialize() ?: false
|
||||
|
||||
if (!success) {
|
||||
Log.e(TAG, "Failed to initialize MPV fallback")
|
||||
onEvent("end-file", mapOf("reason" to "error", "message" to "Fallback failed: $errorMessage"))
|
||||
return@runOnUiThread
|
||||
}
|
||||
|
||||
usingMpvFallback = true
|
||||
|
||||
// Configure basic MPV properties for Plex playback
|
||||
mpvCore?.setProperty("hwdec", "auto")
|
||||
mpvCore?.setProperty("vo", "gpu")
|
||||
mpvCore?.setProperty("ao", "audiotrack")
|
||||
|
||||
// Forward user's buffer config to MPV fallback
|
||||
configuredBufferSizeBytes?.let { bytes ->
|
||||
if (bytes > 0) {
|
||||
mpvCore?.setProperty("demuxer-max-bytes", bytes.toString())
|
||||
mpvCore?.initialize { success ->
|
||||
if (!success) {
|
||||
fallbackInProgress = false
|
||||
Log.e(TAG, "Failed to initialize MPV fallback")
|
||||
onEvent("end-file", mapOf("reason" to "error", "message" to "Fallback failed: $errorMessage"))
|
||||
return@initialize
|
||||
}
|
||||
|
||||
usingMpvFallback = true
|
||||
fallbackInProgress = false
|
||||
|
||||
// Configure basic MPV properties for Plex playback
|
||||
mpvCore?.setProperty("hwdec", "mediacodec,mediacodec-copy")
|
||||
mpvCore?.setProperty("vo", "gpu")
|
||||
mpvCore?.setProperty("ao", "audiotrack")
|
||||
|
||||
// Forward user's buffer config to MPV fallback
|
||||
configuredBufferSizeBytes?.let { bytes ->
|
||||
if (bytes > 0) {
|
||||
mpvCore?.setProperty("demuxer-max-bytes", bytes.toString())
|
||||
}
|
||||
}
|
||||
|
||||
// Setup property observers
|
||||
mpvCore?.observeProperty("time-pos", "double")
|
||||
mpvCore?.observeProperty("duration", "double")
|
||||
mpvCore?.observeProperty("pause", "flag")
|
||||
mpvCore?.observeProperty("paused-for-cache", "flag")
|
||||
mpvCore?.observeProperty("demuxer-cache-time", "double")
|
||||
mpvCore?.observeProperty("eof-reached", "flag")
|
||||
mpvCore?.observeProperty("track-list", "string")
|
||||
mpvCore?.observeProperty("aid", "string")
|
||||
mpvCore?.observeProperty("sid", "string")
|
||||
mpvCore?.observeProperty("volume", "double")
|
||||
mpvCore?.observeProperty("speed", "double")
|
||||
|
||||
// Show the MPV surface
|
||||
mpvCore?.setVisible(true)
|
||||
|
||||
// Load media at the same position
|
||||
val startSeconds = positionMs / 1000.0
|
||||
val options = mutableListOf<String>()
|
||||
options.add("start=$startSeconds")
|
||||
headers?.forEach { (key, value) ->
|
||||
options.add("http-header-fields-append=$key: $value")
|
||||
}
|
||||
val optionsStr = options.joinToString(",")
|
||||
// Convert content:// URIs to fdclose:// for MPV (SAF SD card downloads)
|
||||
val mpvUri = openContentFd(uri)?.let { "fdclose://$it" } ?: uri
|
||||
mpvCore?.command(arrayOf("loadfile", mpvUri, "replace", "-1", optionsStr))
|
||||
|
||||
// Request audio focus
|
||||
mpvCore?.requestAudioFocus()
|
||||
|
||||
// Emit backend-switched event so Flutter can show notification
|
||||
onEvent("backend-switched", null)
|
||||
|
||||
Log.i(TAG, "Successfully switched to MPV fallback")
|
||||
}
|
||||
|
||||
// Setup property observers
|
||||
mpvCore?.observeProperty("time-pos", "double")
|
||||
mpvCore?.observeProperty("duration", "double")
|
||||
mpvCore?.observeProperty("pause", "flag")
|
||||
mpvCore?.observeProperty("paused-for-cache", "flag")
|
||||
mpvCore?.observeProperty("demuxer-cache-time", "double")
|
||||
mpvCore?.observeProperty("eof-reached", "flag")
|
||||
mpvCore?.observeProperty("track-list", "string")
|
||||
mpvCore?.observeProperty("aid", "string")
|
||||
mpvCore?.observeProperty("sid", "string")
|
||||
mpvCore?.observeProperty("volume", "double")
|
||||
mpvCore?.observeProperty("speed", "double")
|
||||
|
||||
// Show the MPV surface
|
||||
mpvCore?.setVisible(true)
|
||||
|
||||
// Load media at the same position
|
||||
val startSeconds = positionMs / 1000.0
|
||||
val options = mutableListOf<String>()
|
||||
options.add("start=$startSeconds")
|
||||
headers?.forEach { (key, value) ->
|
||||
options.add("http-header-fields-append=$key: $value")
|
||||
}
|
||||
val optionsStr = options.joinToString(",")
|
||||
// Convert content:// URIs to fdclose:// for MPV (SAF SD card downloads)
|
||||
val mpvUri = openContentFd(uri)?.let { "fdclose://$it" } ?: uri
|
||||
mpvCore?.command(arrayOf("loadfile", mpvUri, "replace", "-1", optionsStr))
|
||||
|
||||
// Request audio focus
|
||||
mpvCore?.requestAudioFocus()
|
||||
|
||||
// Emit backend-switched event so Flutter can show notification
|
||||
onEvent("backend-switched", null)
|
||||
|
||||
Log.i(TAG, "Successfully switched to MPV fallback")
|
||||
} catch (e: Exception) {
|
||||
fallbackInProgress = false
|
||||
Log.e(TAG, "Failed to switch to MPV fallback", e)
|
||||
onEvent("end-file", mapOf("reason" to "error", "message" to "Fallback failed: ${e.message}"))
|
||||
}
|
||||
|
||||
@@ -3,11 +3,6 @@ package com.edde746.plezy.mpv
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.graphics.PixelFormat
|
||||
import android.hardware.display.DisplayManager
|
||||
import android.media.AudioAttributes
|
||||
import android.media.AudioFocusRequest
|
||||
import android.media.AudioManager
|
||||
import android.os.Build
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
@@ -18,13 +13,11 @@ import android.view.SurfaceView
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.ViewTreeObserver
|
||||
import android.view.TextureView
|
||||
import android.view.WindowManager
|
||||
import androidx.annotation.RequiresApi
|
||||
import com.edde746.plezy.shared.AudioFocusManager
|
||||
import com.edde746.plezy.shared.FlutterOverlayHelper
|
||||
import com.edde746.plezy.shared.FrameRateManager
|
||||
import dev.jdtech.mpv.MPVLib
|
||||
import io.flutter.plugin.common.MethodChannel
|
||||
import java.math.BigDecimal
|
||||
import java.math.RoundingMode
|
||||
import java.util.concurrent.Executors
|
||||
|
||||
interface MpvPlayerDelegate {
|
||||
@@ -39,14 +32,19 @@ class MpvPlayerCore(private val activity: Activity) :
|
||||
|
||||
companion object {
|
||||
private const val TAG = "MpvPlayerCore"
|
||||
private const val SHORT_VIDEO_LENGTH_MS = 300000L // 5 minutes
|
||||
|
||||
// Guards MPVLib.create/destroy which share global native state
|
||||
private val mpvLock = Object()
|
||||
}
|
||||
|
||||
private var surfaceView: SurfaceView? = null
|
||||
private var surfaceContainer: android.widget.FrameLayout? = null
|
||||
private var overlayLayoutListener: ViewTreeObserver.OnGlobalLayoutListener? =
|
||||
null
|
||||
private var voInUse: String = "gpu"
|
||||
@Volatile private var nativeReady: Boolean = false
|
||||
@Volatile private var disposing: Boolean = false
|
||||
private var pendingSurface: Surface? = null
|
||||
private var lastSurfaceSize: String? = null
|
||||
var delegate: MpvPlayerDelegate? = null
|
||||
var isInitialized: Boolean = false
|
||||
private set
|
||||
@@ -55,138 +53,76 @@ class MpvPlayerCore(private val activity: Activity) :
|
||||
private val commandExecutor = Executors.newSingleThreadExecutor()
|
||||
|
||||
// Frame rate matching
|
||||
private var currentVideoFps: Float = 0f
|
||||
private var displayListener: DisplayManager.DisplayListener? = null
|
||||
private var frameRateManager: FrameRateManager? = null
|
||||
private val handler = Handler(Looper.getMainLooper())
|
||||
|
||||
// Audio focus
|
||||
private var audioManager: AudioManager? = null
|
||||
private var audioFocusRequest: AudioFocusRequest? = null
|
||||
private var hasAudioFocus: Boolean = false
|
||||
private var wasPlayingBeforeFocusLoss: Boolean = false
|
||||
private var audioFocusManager: AudioFocusManager? = null
|
||||
|
||||
private val audioFocusChangeListener = AudioManager.OnAudioFocusChangeListener { focusChange ->
|
||||
when (focusChange) {
|
||||
AudioManager.AUDIOFOCUS_GAIN -> {
|
||||
Log.d(TAG, "Audio focus gained")
|
||||
hasAudioFocus = true
|
||||
// Resume playback if we were playing before focus loss
|
||||
if (wasPlayingBeforeFocusLoss && isInitialized) {
|
||||
try {
|
||||
MPVLib.setPropertyBoolean("pause", false)
|
||||
wasPlayingBeforeFocusLoss = false
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "Failed to resume playback after focus gain", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
AudioManager.AUDIOFOCUS_LOSS -> {
|
||||
Log.d(TAG, "Audio focus lost permanently")
|
||||
hasAudioFocus = false
|
||||
// Pause playback on permanent focus loss
|
||||
if (isInitialized) {
|
||||
try {
|
||||
val isPaused = MPVLib.getPropertyBoolean("pause")
|
||||
wasPlayingBeforeFocusLoss = !isPaused
|
||||
if (!isPaused) {
|
||||
MPVLib.setPropertyBoolean("pause", true)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "Failed to pause on focus loss", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
AudioManager.AUDIOFOCUS_LOSS_TRANSIENT -> {
|
||||
Log.d(TAG, "Audio focus lost transiently")
|
||||
hasAudioFocus = false
|
||||
// Pause playback, remember to resume
|
||||
if (isInitialized) {
|
||||
try {
|
||||
val isPaused = MPVLib.getPropertyBoolean("pause")
|
||||
wasPlayingBeforeFocusLoss = !isPaused
|
||||
if (!isPaused) {
|
||||
MPVLib.setPropertyBoolean("pause", true)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "Failed to pause on transient focus loss", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK -> {
|
||||
Log.d(TAG, "Audio focus lost transiently (can duck)")
|
||||
// For video content, we pause instead of ducking
|
||||
// since dialogue is typically important
|
||||
hasAudioFocus = false
|
||||
if (isInitialized) {
|
||||
try {
|
||||
val isPaused = MPVLib.getPropertyBoolean("pause")
|
||||
wasPlayingBeforeFocusLoss = !isPaused
|
||||
if (!isPaused) {
|
||||
MPVLib.setPropertyBoolean("pause", true)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "Failed to pause on duck focus loss", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private var flutterOverlayApplied = false
|
||||
|
||||
private fun ensureFlutterOverlayOnTop() {
|
||||
if (flutterOverlayApplied) return
|
||||
val contentView = activity.findViewById<ViewGroup>(android.R.id.content)
|
||||
contentView.post {
|
||||
if (!isInitialized) return@post
|
||||
var flutterContainer: ViewGroup? = null
|
||||
|
||||
// First pass: look for FlutterView by name (debug builds)
|
||||
for (i in 0 until contentView.childCount) {
|
||||
val child = contentView.getChildAt(i)
|
||||
if (child is ViewGroup && child.javaClass.name.contains("FlutterView")) {
|
||||
flutterContainer = child
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback for release (FlutterView may be obfuscated): pick the last ViewGroup
|
||||
// that is not our mpv container and has children.
|
||||
if (flutterContainer == null) {
|
||||
for (i in contentView.childCount - 1 downTo 0) {
|
||||
val child = contentView.getChildAt(i)
|
||||
if (child is ViewGroup && child != surfaceContainer && child.childCount > 0) {
|
||||
flutterContainer = child
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flutterContainer?.let { container ->
|
||||
contentView.bringChildToFront(container)
|
||||
for (j in 0 until container.childCount) {
|
||||
val flutterChild = container.getChildAt(j)
|
||||
if (flutterChild is SurfaceView) {
|
||||
flutterChild.setZOrderOnTop(true)
|
||||
flutterChild.setZOrderMediaOverlay(true)
|
||||
flutterChild.holder.setFormat(PixelFormat.TRANSLUCENT)
|
||||
break
|
||||
} else if (flutterChild is TextureView) {
|
||||
// TextureView uses alpha composition; ensure it stays above.
|
||||
flutterChild.isOpaque = false
|
||||
break
|
||||
}
|
||||
}
|
||||
val container = FlutterOverlayHelper.findFlutterContainer(contentView, surfaceContainer)
|
||||
?: return@post
|
||||
if (contentView.getChildAt(contentView.childCount - 1) == container) {
|
||||
flutterOverlayApplied = true
|
||||
return@post
|
||||
}
|
||||
FlutterOverlayHelper.configureFlutterZOrder(contentView, container, zOrderOnTop = true)
|
||||
flutterOverlayApplied = true
|
||||
}
|
||||
}
|
||||
|
||||
fun initialize(): Boolean {
|
||||
fun initialize(onResult: (Boolean) -> Unit) {
|
||||
if (isInitialized) {
|
||||
Log.d(TAG, "Already initialized")
|
||||
return true
|
||||
onResult(true)
|
||||
return
|
||||
}
|
||||
|
||||
try {
|
||||
// Initialize AudioManager for audio focus handling
|
||||
audioManager = activity.getSystemService(Context.AUDIO_SERVICE) as AudioManager
|
||||
disposing = false
|
||||
pendingSurface = null
|
||||
|
||||
// Initialize audio focus handling
|
||||
audioFocusManager = AudioFocusManager(
|
||||
context = activity,
|
||||
handler = handler,
|
||||
onPause = {
|
||||
if (isInitialized) {
|
||||
try { MPVLib.setPropertyBoolean("pause", true) }
|
||||
catch (e: Exception) { Log.w(TAG, "Failed to pause on focus loss", e) }
|
||||
}
|
||||
},
|
||||
onResume = {
|
||||
if (isInitialized) {
|
||||
try { MPVLib.setPropertyBoolean("pause", false) }
|
||||
catch (e: Exception) { Log.w(TAG, "Failed to resume after focus gain", e) }
|
||||
}
|
||||
},
|
||||
isPaused = {
|
||||
try { MPVLib.getPropertyBoolean("pause") }
|
||||
catch (e: Exception) { true }
|
||||
}
|
||||
)
|
||||
frameRateManager = FrameRateManager(
|
||||
activity = activity,
|
||||
handler = handler,
|
||||
onDisplayChanged = {
|
||||
try {
|
||||
if (MPVLib.getPropertyBoolean("pause")) {
|
||||
Log.d(TAG, "Display changed, resuming playback")
|
||||
MPVLib.setPropertyBoolean("pause", false)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "Failed to resume after display change", e)
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
// Create FrameLayout container for video (matches ExoPlayer pattern)
|
||||
// Setting visibility on container instead of SurfaceView directly allows
|
||||
@@ -205,9 +141,6 @@ class MpvPlayerCore(private val activity: Activity) :
|
||||
android.widget.FrameLayout.LayoutParams.MATCH_PARENT,
|
||||
android.widget.FrameLayout.LayoutParams.MATCH_PARENT
|
||||
)
|
||||
// Keep video composited in the normal view hierarchy (avoid hardware overlay promotion)
|
||||
// so Flutter controls reliably draw above it in release builds.
|
||||
alpha = 0.999f
|
||||
holder.addCallback(this@MpvPlayerCore)
|
||||
|
||||
// Critical: Ensure SurfaceView renders BEHIND Flutter's view
|
||||
@@ -222,53 +155,79 @@ class MpvPlayerCore(private val activity: Activity) :
|
||||
val contentView = activity.findViewById<ViewGroup>(android.R.id.content)
|
||||
contentView.addView(surfaceContainer, 0)
|
||||
|
||||
// Find FlutterView and its internal FlutterSurfaceView, set it on top
|
||||
for (i in 0 until contentView.childCount) {
|
||||
val child = contentView.getChildAt(i)
|
||||
if (child is ViewGroup && child.javaClass.name.contains("FlutterView")) {
|
||||
contentView.bringChildToFront(child)
|
||||
// Look inside FlutterView for FlutterSurfaceView
|
||||
for (j in 0 until child.childCount) {
|
||||
val flutterChild = child.getChildAt(j)
|
||||
if (flutterChild is SurfaceView) {
|
||||
// Put Flutter in media overlay layer (above our video which is in normal layer)
|
||||
flutterChild.setZOrderOnTop(true)
|
||||
flutterChild.setZOrderMediaOverlay(true)
|
||||
flutterChild.holder.setFormat(PixelFormat.TRANSLUCENT)
|
||||
break
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
// Find FlutterView and set it on top of our video surface
|
||||
FlutterOverlayHelper.findFlutterContainer(contentView, surfaceContainer)?.let { container ->
|
||||
FlutterOverlayHelper.configureFlutterZOrder(contentView, container, zOrderOnTop = true)
|
||||
flutterOverlayApplied = true
|
||||
}
|
||||
// Repeat after layout settles to catch late-added Flutter surfaces (release builds)
|
||||
ensureFlutterOverlayOnTop()
|
||||
overlayLayoutListener = ViewTreeObserver.OnGlobalLayoutListener {
|
||||
ensureFlutterOverlayOnTop()
|
||||
// Re-apply surface size on layout change (orientation transitions)
|
||||
val sv = surfaceView
|
||||
if (sv != null) applySurfaceSize(sv.width, sv.height)
|
||||
}
|
||||
contentView.viewTreeObserver.addOnGlobalLayoutListener(overlayLayoutListener)
|
||||
|
||||
Log.d(TAG, "SurfaceView added to content view")
|
||||
|
||||
// Initialize MPVLib
|
||||
MPVLib.create(activity.applicationContext)
|
||||
// Native MPVLib init on background thread — waits for any
|
||||
// in-flight destroy to finish without blocking the UI thread.
|
||||
val ctx = activity.applicationContext
|
||||
Thread {
|
||||
try {
|
||||
synchronized(mpvLock) {
|
||||
if (disposing) {
|
||||
handler.post { onResult(false) }
|
||||
return@Thread
|
||||
}
|
||||
MPVLib.create(ctx)
|
||||
setupMpvDefaults()
|
||||
MPVLib.init()
|
||||
nativeReady = true
|
||||
}
|
||||
handler.post {
|
||||
if (disposing) {
|
||||
if (nativeReady) {
|
||||
Thread {
|
||||
synchronized(mpvLock) {
|
||||
try {
|
||||
MPVLib.destroy()
|
||||
} catch (_: Exception) {
|
||||
} finally {
|
||||
nativeReady = false
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
onResult(false)
|
||||
return@post
|
||||
}
|
||||
|
||||
// Configure MPV defaults
|
||||
setupMpvDefaults()
|
||||
MPVLib.addObserver(this)
|
||||
MPVLib.addLogObserver(this)
|
||||
isInitialized = true
|
||||
|
||||
// Initialize MPV
|
||||
MPVLib.init()
|
||||
// surfaceCreated can fire before MPV init finishes.
|
||||
// Defer attaching the surface until native init is ready.
|
||||
pendingSurface?.takeIf { it.isValid }?.let {
|
||||
attachSurfaceInternal(it)
|
||||
}
|
||||
pendingSurface = null
|
||||
|
||||
// Register event and log observers
|
||||
MPVLib.addObserver(this)
|
||||
MPVLib.addLogObserver(this)
|
||||
|
||||
isInitialized = true
|
||||
Log.d(TAG, "Initialized successfully")
|
||||
return true
|
||||
Log.d(TAG, "Initialized successfully")
|
||||
onResult(true)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "Failed to initialize native: ${e.message}", e)
|
||||
nativeReady = false
|
||||
handler.post { onResult(false) }
|
||||
}
|
||||
}.start()
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "Failed to initialize: ${e.message}", e)
|
||||
return false
|
||||
onResult(false)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -279,96 +238,85 @@ class MpvPlayerCore(private val activity: Activity) :
|
||||
MPVLib.setOptionString("opengl-es", "yes")
|
||||
// hwdec is set from Flutter via setProperty based on user preference
|
||||
|
||||
// Prevent crashes/artifacts from hardware film grain synthesis (mpv #14651)
|
||||
MPVLib.setOptionString("vd-lavc-film-grain", "cpu")
|
||||
|
||||
// Audio configuration
|
||||
MPVLib.setOptionString("ao", "audiotrack")
|
||||
}
|
||||
|
||||
// Audio Focus
|
||||
|
||||
/**
|
||||
* Request audio focus before starting playback.
|
||||
* This will cause other media apps to pause.
|
||||
* @return true if audio focus was granted
|
||||
*/
|
||||
fun requestAudioFocus(): Boolean {
|
||||
val am = audioManager ?: return false
|
||||
fun requestAudioFocus(): Boolean = audioFocusManager?.requestAudioFocus() ?: false
|
||||
|
||||
Log.d(TAG, "Requesting audio focus")
|
||||
|
||||
val result = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
// Android 8.0+ uses AudioFocusRequest
|
||||
val focusRequest = AudioFocusRequest.Builder(AudioManager.AUDIOFOCUS_GAIN)
|
||||
.setAudioAttributes(
|
||||
AudioAttributes.Builder()
|
||||
.setUsage(AudioAttributes.USAGE_MEDIA)
|
||||
.setContentType(AudioAttributes.CONTENT_TYPE_MOVIE)
|
||||
.build()
|
||||
)
|
||||
.setOnAudioFocusChangeListener(audioFocusChangeListener, handler)
|
||||
.setWillPauseWhenDucked(true)
|
||||
.build()
|
||||
|
||||
audioFocusRequest = focusRequest
|
||||
am.requestAudioFocus(focusRequest)
|
||||
} else {
|
||||
// Legacy API for older Android versions
|
||||
@Suppress("DEPRECATION")
|
||||
am.requestAudioFocus(
|
||||
audioFocusChangeListener,
|
||||
AudioManager.STREAM_MUSIC,
|
||||
AudioManager.AUDIOFOCUS_GAIN
|
||||
)
|
||||
}
|
||||
|
||||
hasAudioFocus = (result == AudioManager.AUDIOFOCUS_REQUEST_GRANTED)
|
||||
Log.d(TAG, "Audio focus request result: $result, granted: $hasAudioFocus")
|
||||
return hasAudioFocus
|
||||
}
|
||||
|
||||
/**
|
||||
* Abandon audio focus when playback stops.
|
||||
* This allows other apps to resume their audio.
|
||||
*/
|
||||
fun abandonAudioFocus() {
|
||||
val am = audioManager ?: return
|
||||
|
||||
Log.d(TAG, "Abandoning audio focus")
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
audioFocusRequest?.let { am.abandonAudioFocusRequest(it) }
|
||||
audioFocusRequest = null
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
am.abandonAudioFocus(audioFocusChangeListener)
|
||||
}
|
||||
|
||||
hasAudioFocus = false
|
||||
wasPlayingBeforeFocusLoss = false
|
||||
}
|
||||
fun abandonAudioFocus() { audioFocusManager?.abandonAudioFocus() }
|
||||
|
||||
// SurfaceHolder.Callback
|
||||
|
||||
override fun surfaceCreated(holder: SurfaceHolder) {
|
||||
Log.d(TAG, "Surface created")
|
||||
MPVLib.attachSurface(holder.surface)
|
||||
MPVLib.setOptionString("force-window", "yes")
|
||||
// Restore video output after surface is available
|
||||
MPVLib.setPropertyString("vo", voInUse)
|
||||
if (disposing) return
|
||||
|
||||
val surface = holder.surface
|
||||
if (!nativeReady) {
|
||||
pendingSurface = surface
|
||||
Log.d(TAG, "Deferring surface attach until MPV native init completes")
|
||||
return
|
||||
}
|
||||
|
||||
attachSurfaceInternal(surface)
|
||||
// Reassert overlay order whenever the surface is recreated
|
||||
flutterOverlayApplied = false
|
||||
ensureFlutterOverlayOnTop()
|
||||
}
|
||||
|
||||
override fun surfaceChanged(holder: SurfaceHolder, format: Int, width: Int, height: Int) {
|
||||
Log.d(TAG, "Surface changed: ${width}x${height}")
|
||||
MPVLib.setPropertyString("android-surface-size", "${width}x${height}")
|
||||
applySurfaceSize(width, height)
|
||||
}
|
||||
|
||||
override fun surfaceDestroyed(holder: SurfaceHolder) {
|
||||
Log.d(TAG, "Surface destroyed")
|
||||
pendingSurface = null
|
||||
if (!nativeReady || disposing) return
|
||||
detachSurfaceInternal()
|
||||
}
|
||||
|
||||
private fun attachSurfaceInternal(surface: Surface) {
|
||||
if (!nativeReady || disposing || !surface.isValid) return
|
||||
try {
|
||||
MPVLib.attachSurface(surface)
|
||||
MPVLib.setOptionString("force-window", "yes")
|
||||
// Restore video output after surface is available
|
||||
MPVLib.setPropertyString("vo", "gpu")
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "Failed to attach MPV surface", e)
|
||||
}
|
||||
}
|
||||
|
||||
private fun applySurfaceSize(width: Int, height: Int) {
|
||||
if (!nativeReady || disposing || width <= 0 || height <= 0) return
|
||||
val size = "${width}x${height}"
|
||||
if (size == lastSurfaceSize) return
|
||||
lastSurfaceSize = size
|
||||
try {
|
||||
MPVLib.setPropertyString("android-surface-size", size)
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "Failed to apply surface size to MPV", e)
|
||||
}
|
||||
}
|
||||
|
||||
private fun detachSurfaceInternal() {
|
||||
lastSurfaceSize = null
|
||||
if (!nativeReady) return
|
||||
// Disable video output before detaching (like mpv-android)
|
||||
MPVLib.setPropertyString("vo", "null")
|
||||
MPVLib.setOptionString("force-window", "no")
|
||||
MPVLib.detachSurface()
|
||||
try {
|
||||
MPVLib.setPropertyString("vo", "null")
|
||||
MPVLib.setOptionString("force-window", "no")
|
||||
MPVLib.detachSurface()
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "Failed to detach MPV surface", e)
|
||||
}
|
||||
}
|
||||
|
||||
// MPVLib.EventObserver
|
||||
@@ -513,210 +461,39 @@ class MpvPlayerCore(private val activity: Activity) :
|
||||
|
||||
// Frame Rate Matching
|
||||
|
||||
private fun getDisplayManager(): DisplayManager {
|
||||
return activity.getSystemService(Context.DISPLAY_SERVICE) as DisplayManager
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the video frame rate for display refresh rate matching.
|
||||
* Based on VLC Android's FrameRateManager implementation.
|
||||
*/
|
||||
fun setVideoFrameRate(fps: Float, videoDurationMs: Long) {
|
||||
currentVideoFps = fps
|
||||
if (fps <= 0f) {
|
||||
Log.d(TAG, "setVideoFrameRate: Invalid fps ($fps), skipping")
|
||||
return
|
||||
}
|
||||
|
||||
val surface = surfaceView?.holder?.surface
|
||||
if (surface == null) {
|
||||
Log.d(TAG, "setVideoFrameRate: Surface not available")
|
||||
return
|
||||
}
|
||||
|
||||
Log.d(TAG, "setVideoFrameRate: fps=$fps, duration=${videoDurationMs}ms, API=${Build.VERSION.SDK_INT}")
|
||||
|
||||
when {
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> setFrameRateS(fps, surface, videoDurationMs)
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.R -> setFrameRateR(fps, surface)
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M -> setFrameRateM(fps)
|
||||
}
|
||||
frameRateManager?.setVideoFrameRate(fps, videoDurationMs, surfaceView?.holder?.surface)
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear frame rate setting and cleanup display listener.
|
||||
*/
|
||||
fun clearVideoFrameRate() {
|
||||
Log.d(TAG, "clearVideoFrameRate")
|
||||
currentVideoFps = 0f
|
||||
displayListener?.let {
|
||||
getDisplayManager().unregisterDisplayListener(it)
|
||||
displayListener = null
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and register display listener for mode switch completion.
|
||||
* Resumes playback after display mode change (needed for HDMI/projectors).
|
||||
*/
|
||||
private fun registerDisplayListener() {
|
||||
displayListener?.let {
|
||||
getDisplayManager().unregisterDisplayListener(it)
|
||||
}
|
||||
|
||||
displayListener = object : DisplayManager.DisplayListener {
|
||||
override fun onDisplayAdded(displayId: Int) = Unit
|
||||
override fun onDisplayRemoved(displayId: Int) = Unit
|
||||
override fun onDisplayChanged(displayId: Int) {
|
||||
// Mode switch may pause playback (HDMI), wait and resume
|
||||
handler.postDelayed({
|
||||
try {
|
||||
val isPaused = MPVLib.getPropertyBoolean("pause")
|
||||
if (isPaused) {
|
||||
Log.d(TAG, "Display changed, resuming playback")
|
||||
MPVLib.setPropertyBoolean("pause", false)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "Failed to resume playback after display change", e)
|
||||
}
|
||||
}, 2000L) // Wait 2 seconds for mode switch to complete
|
||||
getDisplayManager().unregisterDisplayListener(this)
|
||||
displayListener = null
|
||||
}
|
||||
}
|
||||
getDisplayManager().registerDisplayListener(displayListener, handler)
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.R)
|
||||
private fun setFrameRateR(fps: Float, surface: Surface) {
|
||||
Log.d(TAG, "setFrameRateR: Setting frame rate to $fps")
|
||||
surface.setFrameRate(fps, Surface.FRAME_RATE_COMPATIBILITY_FIXED_SOURCE)
|
||||
registerDisplayListener()
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.S)
|
||||
private fun setFrameRateS(fps: Float, surface: Surface, videoDurationMs: Long) {
|
||||
Log.d(TAG, "setFrameRateS: fps=$fps, duration=${videoDurationMs}ms")
|
||||
|
||||
// For short videos (<5min), only switch if seamless
|
||||
if (videoDurationMs < SHORT_VIDEO_LENGTH_MS) {
|
||||
Log.d(TAG, "Short video, using seamless-only switching")
|
||||
surface.setFrameRate(
|
||||
fps,
|
||||
Surface.FRAME_RATE_COMPATIBILITY_FIXED_SOURCE,
|
||||
Surface.CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
// For longer videos, check if switch will be seamless
|
||||
var seamless = false
|
||||
activity.display?.mode?.alternativeRefreshRates?.let { refreshRates ->
|
||||
for (rate in refreshRates) {
|
||||
// Check if rates match or are integer multiples
|
||||
if (fps.toString().startsWith(rate.toString()) ||
|
||||
rate.toString().startsWith(fps.toString()) ||
|
||||
rate % fps == 0f) {
|
||||
seamless = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (seamless) {
|
||||
Log.d(TAG, "Seamless switch available, using CHANGE_FRAME_RATE_ALWAYS")
|
||||
surface.setFrameRate(
|
||||
fps,
|
||||
Surface.FRAME_RATE_COMPATIBILITY_FIXED_SOURCE,
|
||||
Surface.CHANGE_FRAME_RATE_ALWAYS
|
||||
)
|
||||
registerDisplayListener()
|
||||
} else {
|
||||
// Non-seamless: only switch if user enabled it at OS level
|
||||
val userPreference = getDisplayManager().matchContentFrameRateUserPreference
|
||||
if (userPreference == DisplayManager.MATCH_CONTENT_FRAMERATE_ALWAYS) {
|
||||
Log.d(TAG, "User preference allows non-seamless switch")
|
||||
surface.setFrameRate(
|
||||
fps,
|
||||
Surface.FRAME_RATE_COMPATIBILITY_FIXED_SOURCE,
|
||||
Surface.CHANGE_FRAME_RATE_ALWAYS
|
||||
)
|
||||
registerDisplayListener()
|
||||
} else {
|
||||
Log.d(TAG, "Non-seamless switch not allowed by user preference, using seamless-only")
|
||||
surface.setFrameRate(
|
||||
fps,
|
||||
Surface.FRAME_RATE_COMPATIBILITY_FIXED_SOURCE,
|
||||
Surface.CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
private fun setFrameRateM(fps: Float) {
|
||||
Log.d(TAG, "setFrameRateM: fps=$fps")
|
||||
val wm = activity.getSystemService(Context.WINDOW_SERVICE) as WindowManager
|
||||
val display = wm.defaultDisplay ?: return
|
||||
|
||||
display.supportedModes?.let { supportedModes ->
|
||||
val currentMode = display.mode
|
||||
var modeToUse = currentMode
|
||||
|
||||
for (mode in supportedModes) {
|
||||
// Skip modes with different resolution
|
||||
if (mode.physicalHeight != currentMode.physicalHeight ||
|
||||
mode.physicalWidth != currentMode.physicalWidth) {
|
||||
continue
|
||||
}
|
||||
|
||||
Log.d(TAG, "Supported mode: ${mode.modeId} - ${mode.refreshRate}Hz")
|
||||
|
||||
// Check for exact match
|
||||
if (BigDecimal(fps.toString()).setScale(1, RoundingMode.FLOOR) ==
|
||||
BigDecimal(mode.refreshRate.toString()).setScale(1, RoundingMode.FLOOR)) {
|
||||
modeToUse = mode
|
||||
Log.d(TAG, "Found exact match: ${mode.refreshRate}Hz")
|
||||
break
|
||||
}
|
||||
// Check for integer multiple (e.g., 48Hz for 24fps)
|
||||
else if (mode.refreshRate % fps == 0f) {
|
||||
modeToUse = mode
|
||||
Log.d(TAG, "Found integer multiple: ${mode.refreshRate}Hz")
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (modeToUse != currentMode) {
|
||||
Log.d(TAG, "Switching to mode ${modeToUse.modeId} (${modeToUse.refreshRate}Hz)")
|
||||
activity.window?.attributes?.let { attrs ->
|
||||
attrs.preferredDisplayModeId = modeToUse.modeId
|
||||
activity.window?.attributes = attrs
|
||||
}
|
||||
registerDisplayListener()
|
||||
} else {
|
||||
Log.d(TAG, "No better mode found, staying at ${currentMode.refreshRate}Hz")
|
||||
}
|
||||
}
|
||||
frameRateManager?.clearVideoFrameRate()
|
||||
}
|
||||
|
||||
// Cleanup
|
||||
|
||||
fun dispose() {
|
||||
if (disposing) return
|
||||
disposing = true
|
||||
Log.d(TAG, "Disposing")
|
||||
|
||||
// Shutdown command executor
|
||||
commandExecutor.shutdown()
|
||||
|
||||
// Clean up frame rate listener
|
||||
clearVideoFrameRate()
|
||||
// Clean up frame rate and audio focus
|
||||
frameRateManager?.clearVideoFrameRate()
|
||||
frameRateManager = null
|
||||
audioFocusManager?.release()
|
||||
audioFocusManager = null
|
||||
|
||||
// Release audio focus
|
||||
abandonAudioFocus()
|
||||
audioManager = null
|
||||
|
||||
MPVLib.removeObserver(this)
|
||||
MPVLib.removeLogObserver(this)
|
||||
if (nativeReady) {
|
||||
try {
|
||||
MPVLib.removeObserver(this)
|
||||
MPVLib.removeLogObserver(this)
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "Failed to remove MPV observers during dispose", e)
|
||||
}
|
||||
detachSurfaceInternal()
|
||||
}
|
||||
|
||||
overlayLayoutListener?.let { listener ->
|
||||
val contentView = activity.findViewById<ViewGroup>(android.R.id.content)
|
||||
@@ -724,23 +501,37 @@ class MpvPlayerCore(private val activity: Activity) :
|
||||
}
|
||||
overlayLayoutListener = null
|
||||
|
||||
// Remove SurfaceView synchronously (keep callback so surfaceDestroyed
|
||||
// fires → MPVLib.detachSurface()), then remove callback after.
|
||||
// Defer all view removal to avoid AOSP bug where
|
||||
// dispatchWindowVisibilityChanged iterates stale children array
|
||||
// when removeView() runs during an active performTraversals pass.
|
||||
val sv = surfaceView
|
||||
val container = surfaceContainer
|
||||
surfaceView?.let { container?.removeView(it) }
|
||||
surfaceView?.holder?.removeCallback(this)
|
||||
|
||||
// Defer empty container removal (plain FrameLayout, no SurfaceControl)
|
||||
val contentView = activity.findViewById<ViewGroup>(android.R.id.content)
|
||||
contentView.post {
|
||||
sv?.holder?.removeCallback(this)
|
||||
container?.let { contentView.removeView(it) }
|
||||
}
|
||||
surfaceContainer = null
|
||||
surfaceView = null
|
||||
|
||||
MPVLib.destroy()
|
||||
pendingSurface = null
|
||||
isInitialized = false
|
||||
|
||||
Log.d(TAG, "Disposed")
|
||||
// Run native destroy on background thread to avoid ANR —
|
||||
// MPVLib.destroy() blocks on pthread_cond_wait while mpv's
|
||||
// internal threads (lua, demux, vo) shut down.
|
||||
if (nativeReady) {
|
||||
Thread {
|
||||
synchronized(mpvLock) {
|
||||
try {
|
||||
MPVLib.destroy()
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "MPV destroy failed", e)
|
||||
} finally {
|
||||
nativeReady = false
|
||||
}
|
||||
}
|
||||
Log.d(TAG, "Disposed (native)")
|
||||
}.start()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,14 +125,14 @@ class MpvPlayerPlugin : FlutterPlugin, MethodChannel.MethodCallHandler,
|
||||
playerCore = MpvPlayerCore(currentActivity).apply {
|
||||
delegate = this@MpvPlayerPlugin
|
||||
}
|
||||
val success = playerCore?.initialize() ?: false
|
||||
|
||||
// Start hidden - now safe because setVisible operates on the container,
|
||||
// not the SurfaceView directly (matching ExoPlayer's approach)
|
||||
playerCore?.setVisible(false)
|
||||
|
||||
Log.d(TAG, "Initialized: $success")
|
||||
result.success(success)
|
||||
playerCore?.initialize { success ->
|
||||
// Start hidden - now safe because setVisible operates on the container,
|
||||
// not the SurfaceView directly (matching ExoPlayer's approach)
|
||||
playerCore?.setVisible(false)
|
||||
Log.d(TAG, "Initialized: $success")
|
||||
result.success(success)
|
||||
} ?: result.success(false)
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "Failed to initialize: ${e.message}", e)
|
||||
result.error("INIT_FAILED", e.message, null)
|
||||
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.edde746.plezy.shared
|
||||
|
||||
import android.content.Context
|
||||
import android.media.AudioAttributes
|
||||
import android.media.AudioFocusRequest
|
||||
import android.media.AudioManager
|
||||
import android.os.Build
|
||||
import android.os.Handler
|
||||
import android.util.Log
|
||||
|
||||
class AudioFocusManager(
|
||||
context: Context,
|
||||
private val handler: Handler,
|
||||
private val onPause: () -> Unit,
|
||||
private val onResume: () -> Unit,
|
||||
private val isPaused: () -> Boolean,
|
||||
private val log: (String) -> Unit = { Log.d(TAG, it) }
|
||||
) {
|
||||
companion object {
|
||||
private const val TAG = "AudioFocusManager"
|
||||
}
|
||||
|
||||
private val audioManager = context.getSystemService(Context.AUDIO_SERVICE) as AudioManager
|
||||
private var audioFocusRequest: AudioFocusRequest? = null
|
||||
private var hasAudioFocus: Boolean = false
|
||||
var wasPlayingBeforeFocusLoss: Boolean = false
|
||||
private set
|
||||
|
||||
private val audioFocusChangeListener = AudioManager.OnAudioFocusChangeListener { focusChange ->
|
||||
when (focusChange) {
|
||||
AudioManager.AUDIOFOCUS_GAIN -> {
|
||||
log("Focus gained")
|
||||
hasAudioFocus = true
|
||||
if (wasPlayingBeforeFocusLoss) {
|
||||
onResume()
|
||||
wasPlayingBeforeFocusLoss = false
|
||||
}
|
||||
}
|
||||
AudioManager.AUDIOFOCUS_LOSS -> {
|
||||
log("Focus lost permanently")
|
||||
hasAudioFocus = false
|
||||
wasPlayingBeforeFocusLoss = !isPaused()
|
||||
onPause()
|
||||
}
|
||||
AudioManager.AUDIOFOCUS_LOSS_TRANSIENT -> {
|
||||
log("Focus lost transiently")
|
||||
hasAudioFocus = false
|
||||
wasPlayingBeforeFocusLoss = !isPaused()
|
||||
onPause()
|
||||
}
|
||||
AudioManager.AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK -> {
|
||||
log("Focus lost transiently (can duck)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun requestAudioFocus(): Boolean {
|
||||
Log.d(TAG, "Requesting audio focus")
|
||||
|
||||
val result = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
val focusRequest = AudioFocusRequest.Builder(AudioManager.AUDIOFOCUS_GAIN)
|
||||
.setAudioAttributes(
|
||||
AudioAttributes.Builder()
|
||||
.setUsage(AudioAttributes.USAGE_MEDIA)
|
||||
.setContentType(AudioAttributes.CONTENT_TYPE_MOVIE)
|
||||
.build()
|
||||
)
|
||||
.setOnAudioFocusChangeListener(audioFocusChangeListener, handler)
|
||||
.build()
|
||||
|
||||
audioFocusRequest = focusRequest
|
||||
audioManager.requestAudioFocus(focusRequest)
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
audioManager.requestAudioFocus(
|
||||
audioFocusChangeListener,
|
||||
AudioManager.STREAM_MUSIC,
|
||||
AudioManager.AUDIOFOCUS_GAIN
|
||||
)
|
||||
}
|
||||
|
||||
hasAudioFocus = (result == AudioManager.AUDIOFOCUS_REQUEST_GRANTED)
|
||||
Log.d(TAG, "Audio focus request result: $result, granted: $hasAudioFocus")
|
||||
return hasAudioFocus
|
||||
}
|
||||
|
||||
fun abandonAudioFocus() {
|
||||
Log.d(TAG, "Abandoning audio focus")
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
audioFocusRequest?.let { audioManager.abandonAudioFocusRequest(it) }
|
||||
audioFocusRequest = null
|
||||
} else {
|
||||
@Suppress("DEPRECATION")
|
||||
audioManager.abandonAudioFocus(audioFocusChangeListener)
|
||||
}
|
||||
|
||||
hasAudioFocus = false
|
||||
wasPlayingBeforeFocusLoss = false
|
||||
}
|
||||
|
||||
fun release() {
|
||||
abandonAudioFocus()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.edde746.plezy.shared
|
||||
|
||||
import android.graphics.PixelFormat
|
||||
import android.view.SurfaceView
|
||||
import android.view.TextureView
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
|
||||
object FlutterOverlayHelper {
|
||||
|
||||
/**
|
||||
* Find the FlutterView container in the content view hierarchy.
|
||||
* First tries to match by class name (works in debug builds),
|
||||
* then falls back to picking the last ViewGroup with children
|
||||
* (needed for release builds where FlutterView may be obfuscated).
|
||||
*/
|
||||
fun findFlutterContainer(contentView: ViewGroup, excludeView: View? = null): ViewGroup? {
|
||||
// First pass: look for FlutterView by name (debug builds)
|
||||
for (i in 0 until contentView.childCount) {
|
||||
val child = contentView.getChildAt(i)
|
||||
if (child is ViewGroup && child.javaClass.name.contains("FlutterView")) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
|
||||
// Fallback for release (FlutterView may be obfuscated): pick the last ViewGroup
|
||||
// that is not our video container and has children.
|
||||
for (i in contentView.childCount - 1 downTo 0) {
|
||||
val child = contentView.getChildAt(i)
|
||||
if (child is ViewGroup && child != excludeView && child.childCount > 0) {
|
||||
return child
|
||||
}
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure z-ordering so the Flutter UI renders above the video surface.
|
||||
*
|
||||
* @param zOrderOnTop true for MPV (Flutter needs to be fully on top),
|
||||
* false for ExoPlayer (subtitle layer sits between video and Flutter)
|
||||
*/
|
||||
fun configureFlutterZOrder(contentView: ViewGroup, container: ViewGroup, zOrderOnTop: Boolean) {
|
||||
contentView.bringChildToFront(container)
|
||||
for (j in 0 until container.childCount) {
|
||||
val flutterChild = container.getChildAt(j)
|
||||
if (flutterChild is SurfaceView) {
|
||||
flutterChild.setZOrderOnTop(zOrderOnTop)
|
||||
flutterChild.setZOrderMediaOverlay(true)
|
||||
flutterChild.holder.setFormat(PixelFormat.TRANSLUCENT)
|
||||
break
|
||||
} else if (flutterChild is TextureView) {
|
||||
flutterChild.isOpaque = false
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,181 @@
|
||||
package com.edde746.plezy.shared
|
||||
|
||||
import android.app.Activity
|
||||
import android.content.Context
|
||||
import android.hardware.display.DisplayManager
|
||||
import android.os.Build
|
||||
import android.os.Handler
|
||||
import android.util.Log
|
||||
import android.view.Surface
|
||||
import android.view.WindowManager
|
||||
import androidx.annotation.RequiresApi
|
||||
import java.math.BigDecimal
|
||||
import java.math.RoundingMode
|
||||
|
||||
class FrameRateManager(
|
||||
private val activity: Activity,
|
||||
private val handler: Handler,
|
||||
private val onDisplayChanged: () -> Unit,
|
||||
private val log: (String) -> Unit = { Log.d(TAG, it) }
|
||||
) {
|
||||
companion object {
|
||||
private const val TAG = "FrameRateManager"
|
||||
private const val SHORT_VIDEO_LENGTH_MS = 300000L // 5 minutes
|
||||
}
|
||||
|
||||
private var currentVideoFps: Float = 0f
|
||||
private var displayListener: DisplayManager.DisplayListener? = null
|
||||
|
||||
private fun getDisplayManager(): DisplayManager {
|
||||
return activity.getSystemService(Context.DISPLAY_SERVICE) as DisplayManager
|
||||
}
|
||||
|
||||
fun setVideoFrameRate(fps: Float, videoDurationMs: Long, surface: Surface?) {
|
||||
currentVideoFps = fps
|
||||
if (fps <= 0f) {
|
||||
Log.d(TAG, "setVideoFrameRate: Invalid fps ($fps), skipping")
|
||||
return
|
||||
}
|
||||
|
||||
if (surface == null) {
|
||||
Log.d(TAG, "setVideoFrameRate: Surface not available")
|
||||
return
|
||||
}
|
||||
|
||||
log("fps=$fps, duration=${videoDurationMs}ms, API=${Build.VERSION.SDK_INT}")
|
||||
|
||||
when {
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> setFrameRateS(fps, surface, videoDurationMs)
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.R -> setFrameRateR(fps, surface)
|
||||
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M -> setFrameRateM(fps)
|
||||
}
|
||||
}
|
||||
|
||||
fun clearVideoFrameRate() {
|
||||
Log.d(TAG, "clearVideoFrameRate")
|
||||
currentVideoFps = 0f
|
||||
displayListener?.let {
|
||||
getDisplayManager().unregisterDisplayListener(it)
|
||||
displayListener = null
|
||||
}
|
||||
}
|
||||
|
||||
private fun registerDisplayListener() {
|
||||
displayListener?.let {
|
||||
getDisplayManager().unregisterDisplayListener(it)
|
||||
}
|
||||
|
||||
displayListener = object : DisplayManager.DisplayListener {
|
||||
override fun onDisplayAdded(displayId: Int) = Unit
|
||||
override fun onDisplayRemoved(displayId: Int) = Unit
|
||||
override fun onDisplayChanged(displayId: Int) {
|
||||
handler.postDelayed({
|
||||
onDisplayChanged()
|
||||
}, 2000L)
|
||||
getDisplayManager().unregisterDisplayListener(this)
|
||||
displayListener = null
|
||||
}
|
||||
}
|
||||
getDisplayManager().registerDisplayListener(displayListener, handler)
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.R)
|
||||
private fun setFrameRateR(fps: Float, surface: Surface) {
|
||||
Log.d(TAG, "setFrameRateR: Setting frame rate to $fps")
|
||||
surface.setFrameRate(fps, Surface.FRAME_RATE_COMPATIBILITY_FIXED_SOURCE)
|
||||
registerDisplayListener()
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.S)
|
||||
private fun setFrameRateS(fps: Float, surface: Surface, videoDurationMs: Long) {
|
||||
Log.d(TAG, "setFrameRateS: fps=$fps, duration=${videoDurationMs}ms")
|
||||
|
||||
if (videoDurationMs < SHORT_VIDEO_LENGTH_MS) {
|
||||
Log.d(TAG, "Short video, using seamless-only switching")
|
||||
surface.setFrameRate(
|
||||
fps,
|
||||
Surface.FRAME_RATE_COMPATIBILITY_FIXED_SOURCE,
|
||||
Surface.CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS
|
||||
)
|
||||
return
|
||||
}
|
||||
|
||||
var seamless = false
|
||||
activity.display?.mode?.alternativeRefreshRates?.let { refreshRates ->
|
||||
for (rate in refreshRates) {
|
||||
if (fps.toString().startsWith(rate.toString()) ||
|
||||
rate.toString().startsWith(fps.toString()) ||
|
||||
rate % fps == 0f) {
|
||||
seamless = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (seamless) {
|
||||
log("Seamless switch available for ${fps}fps")
|
||||
surface.setFrameRate(
|
||||
fps,
|
||||
Surface.FRAME_RATE_COMPATIBILITY_FIXED_SOURCE,
|
||||
Surface.CHANGE_FRAME_RATE_ALWAYS
|
||||
)
|
||||
registerDisplayListener()
|
||||
} else {
|
||||
val userPreference = getDisplayManager().matchContentFrameRateUserPreference
|
||||
if (userPreference == DisplayManager.MATCH_CONTENT_FRAMERATE_ALWAYS) {
|
||||
Log.d(TAG, "User preference allows non-seamless switch")
|
||||
surface.setFrameRate(
|
||||
fps,
|
||||
Surface.FRAME_RATE_COMPATIBILITY_FIXED_SOURCE,
|
||||
Surface.CHANGE_FRAME_RATE_ALWAYS
|
||||
)
|
||||
registerDisplayListener()
|
||||
} else {
|
||||
Log.d(TAG, "Non-seamless switch not allowed, using seamless-only")
|
||||
surface.setFrameRate(
|
||||
fps,
|
||||
Surface.FRAME_RATE_COMPATIBILITY_FIXED_SOURCE,
|
||||
Surface.CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
private fun setFrameRateM(fps: Float) {
|
||||
Log.d(TAG, "setFrameRateM: fps=$fps")
|
||||
val wm = activity.getSystemService(Context.WINDOW_SERVICE) as WindowManager
|
||||
@Suppress("DEPRECATION")
|
||||
val display = wm.defaultDisplay ?: return
|
||||
|
||||
display.supportedModes?.let { supportedModes ->
|
||||
val currentMode = display.mode
|
||||
var modeToUse = currentMode
|
||||
|
||||
for (mode in supportedModes) {
|
||||
if (mode.physicalHeight != currentMode.physicalHeight ||
|
||||
mode.physicalWidth != currentMode.physicalWidth) {
|
||||
continue
|
||||
}
|
||||
|
||||
if (BigDecimal(fps.toString()).setScale(1, RoundingMode.FLOOR) ==
|
||||
BigDecimal(mode.refreshRate.toString()).setScale(1, RoundingMode.FLOOR)) {
|
||||
modeToUse = mode
|
||||
break
|
||||
} else if (mode.refreshRate % fps == 0f) {
|
||||
modeToUse = mode
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if (modeToUse != currentMode) {
|
||||
Log.d(TAG, "Switching to mode ${modeToUse.modeId} (${modeToUse.refreshRate}Hz)")
|
||||
activity.window?.attributes?.let { attrs ->
|
||||
attrs.preferredDisplayModeId = modeToUse.modeId
|
||||
activity.window?.attributes = attrs
|
||||
}
|
||||
registerDisplayListener()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.edde746.plezy.shared
|
||||
|
||||
import android.graphics.Color
|
||||
|
||||
object ThemeHelper {
|
||||
fun themeColor(mode: String?): Int? = when (mode) {
|
||||
"oled" -> Color.BLACK
|
||||
"dark" -> Color.parseColor("#0E0F12")
|
||||
"light" -> Color.parseColor("#F7F7F8")
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 5.1 KiB |
|
Before Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 7.1 KiB |
|
Before Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 17 KiB |
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<vector xmlns:aapt="http://schemas.android.com/aapt"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="108dp"
|
||||
android:width="108dp"
|
||||
android:viewportHeight="911.63"
|
||||
android:viewportWidth="911.63">
|
||||
<group android:translateX="276.65" android:translateY="223.88">
|
||||
<path android:pathData="M335.65,192.66L68.01,38.14C37.78,20.69,0,42.5,0,77.41v309.04c0,34.91,37.78,56.72,68.01,39.27l267.64-154.52c30.23-17.45,30.23-61.08,0-78.54ZM255.53,276.8c-19.1,17.66-38.75,26.49-58.4,26.49s-39.29-8.83-58.39-26.49c-14.39-13.3-28.55-20.05-42.11-20.05s-27.72,6.75-42.1,20.05c-4.87,4.5-12.46,4.2-16.96-0.67-4.5-4.86-4.2-12.45 0.67-16.95,38.2-35.33,78.59-35.33,116.79,0,14.38,13.3,28.55,20.04,42.1,20.04s27.72-6.74,42.11-20.04c4.86-4.5,12.46-4.21,16.95,0.66,4.5,4.87,4.21,12.46-0.66,16.96ZM255.53,204.04c-19.1,17.67-38.75,26.5-58.4,26.5s-39.29-8.83-58.39-26.5c-14.39-13.3-28.55-20.04-42.11-20.04s-27.72,6.74-42.1,20.04c-4.87,4.5-12.46,4.21-16.96-0.66s-4.2-12.46,0.67-16.96c38.2-35.32,78.59-35.32,116.79,0,14.38,13.3,28.55,20.05,42.1,20.05s27.72-6.75,42.11-20.05c4.86-4.5,12.46-4.2,16.95,0.67,4.5,4.86,4.21,12.45-0.66,16.95Z">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:type="linear"
|
||||
android:startX="22.67"
|
||||
android:startY="425.72"
|
||||
android:endX="201.83"
|
||||
android:endY="115.4">
|
||||
<item android:color="#FFAB543A" android:offset="0.0" />
|
||||
<item android:color="#FFFF7E57" android:offset="1.0" />
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
</group>
|
||||
</vector>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="108dp"
|
||||
android:width="108dp"
|
||||
android:viewportHeight="911.63"
|
||||
android:viewportWidth="911.63">
|
||||
<group android:translateX="276.65" android:translateY="223.88">
|
||||
<path
|
||||
android:fillColor="#FFFFFFFF"
|
||||
android:pathData="M335.65,192.66L68.01,38.14C37.78,20.69,0,42.5,0,77.41v309.04c0,34.91,37.78,56.72,68.01,39.27l267.64-154.52c30.23-17.45,30.23-61.08,0-78.54ZM255.53,276.8c-19.1,17.66-38.75,26.49-58.4,26.49s-39.29-8.83-58.39-26.49c-14.39-13.3-28.55-20.05-42.11-20.05s-27.72,6.75-42.1,20.05c-4.87,4.5-12.46,4.2-16.96-0.67-4.5-4.86-4.2-12.45 0.67-16.95,38.2-35.33,78.59-35.33,116.79,0,14.38,13.3,28.55,20.04,42.1,20.04s27.72-6.74,42.11-20.04c4.86-4.5,12.46-4.21,16.95,0.66,4.5,4.87,4.21,12.46-0.66,16.96ZM255.53,204.04c-19.1,17.67-38.75,26.5-58.4,26.5s-39.29-8.83-58.39-26.5c-14.39-13.3-28.55-20.04-42.11-20.04s-27.72,6.74-42.1,20.04c-4.87,4.5-12.46,4.21-16.96-0.66s-4.2-12.46,0.67-16.96c38.2-35.32,78.59-35.32,116.79,0,14.38,13.3,28.55,20.05,42.1,20.05s27.72-6.75,42.11-20.05c4.86-4.5,12.46-4.2,16.95,0.67,4.5,4.86,4.21,12.45-0.66,16.95Z" />
|
||||
</group>
|
||||
</vector>
|
||||
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<inset xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:drawable="@drawable/ic_launcher_foreground" />
|
||||
@@ -1,14 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background"/>
|
||||
<foreground>
|
||||
<inset
|
||||
android:drawable="@drawable/ic_launcher_foreground"
|
||||
android:inset="16%" />
|
||||
</foreground>
|
||||
<monochrome>
|
||||
<inset
|
||||
android:drawable="@mipmap/ic_launcher_monochrome"
|
||||
android:inset="16%" />
|
||||
</monochrome>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground" />
|
||||
<monochrome android:drawable="@drawable/ic_launcher_monochrome" />
|
||||
</adaptive-icon>
|
||||
|
||||
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 4.2 KiB |
|
Before Width: | Height: | Size: 6.1 KiB |
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<item name="android:windowBackground">@color/splash_background</item>
|
||||
<item name="android:windowSplashScreenAnimatedIcon">@drawable/splash_icon</item>
|
||||
<item name="android:defaultFocusHighlightEnabled">false</item>
|
||||
<item name="android:colorControlHighlight">@android:color/transparent</item>
|
||||
</style>
|
||||
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<item name="android:windowBackground">@color/splash_background</item>
|
||||
<item name="android:defaultFocusHighlightEnabled">false</item>
|
||||
<item name="android:colorControlHighlight">@android:color/transparent</item>
|
||||
</style>
|
||||
|
||||
<style name="SplashTheme.Dark" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<item name="android:windowBackground">@color/splash_dark</item>
|
||||
<item name="android:windowSplashScreenAnimatedIcon">@drawable/splash_icon</item>
|
||||
<item name="android:defaultFocusHighlightEnabled">false</item>
|
||||
<item name="android:colorControlHighlight">@android:color/transparent</item>
|
||||
</style>
|
||||
<style name="SplashTheme.Oled" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<item name="android:windowBackground">@color/splash_oled</item>
|
||||
<item name="android:windowSplashScreenAnimatedIcon">@drawable/splash_icon</item>
|
||||
<item name="android:defaultFocusHighlightEnabled">false</item>
|
||||
<item name="android:colorControlHighlight">@android:color/transparent</item>
|
||||
</style>
|
||||
<style name="SplashTheme.Light" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<item name="android:windowBackground">@color/splash_light</item>
|
||||
<item name="android:windowSplashScreenAnimatedIcon">@drawable/splash_icon</item>
|
||||
<item name="android:defaultFocusHighlightEnabled">false</item>
|
||||
<item name="android:colorControlHighlight">@android:color/transparent</item>
|
||||
</style>
|
||||
<style name="SplashTheme.System" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<item name="android:windowBackground">@color/splash_background</item>
|
||||
<item name="android:windowSplashScreenAnimatedIcon">@drawable/splash_icon</item>
|
||||
<item name="android:defaultFocusHighlightEnabled">false</item>
|
||||
<item name="android:colorControlHighlight">@android:color/transparent</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -1,4 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_background">#1a1a1a</color>
|
||||
<color name="splash_background">#0E0F12</color>
|
||||
<color name="splash_dark">#0E0F12</color>
|
||||
<color name="splash_oled">#000000</color>
|
||||
<color name="splash_light">#F7F7F8</color>
|
||||
</resources>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<resources>
|
||||
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
|
||||
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<item name="android:windowBackground">@color/splash_background</item>
|
||||
<!-- Disable Android's default green focus highlight that appears during d-pad/keyboard navigation -->
|
||||
<item name="android:defaultFocusHighlightEnabled">false</item>
|
||||
<item name="android:colorControlHighlight">@android:color/transparent</item>
|
||||
@@ -13,9 +14,31 @@
|
||||
|
||||
This Theme is only used starting with V2 of Flutter's Android embedding. -->
|
||||
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<item name="android:windowBackground">@android:color/black</item>
|
||||
<item name="android:windowBackground">@color/splash_background</item>
|
||||
<!-- Disable Android's default green focus highlight that appears during d-pad/keyboard navigation -->
|
||||
<item name="android:defaultFocusHighlightEnabled">false</item>
|
||||
<item name="android:colorControlHighlight">@android:color/transparent</item>
|
||||
</style>
|
||||
|
||||
<!-- Splash theme variants for setSplashScreenTheme -->
|
||||
<style name="SplashTheme.Dark" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<item name="android:windowBackground">@color/splash_dark</item>
|
||||
<item name="android:defaultFocusHighlightEnabled">false</item>
|
||||
<item name="android:colorControlHighlight">@android:color/transparent</item>
|
||||
</style>
|
||||
<style name="SplashTheme.Oled" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<item name="android:windowBackground">@color/splash_oled</item>
|
||||
<item name="android:defaultFocusHighlightEnabled">false</item>
|
||||
<item name="android:colorControlHighlight">@android:color/transparent</item>
|
||||
</style>
|
||||
<style name="SplashTheme.Light" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<item name="android:windowBackground">@color/splash_light</item>
|
||||
<item name="android:defaultFocusHighlightEnabled">false</item>
|
||||
<item name="android:colorControlHighlight">@android:color/transparent</item>
|
||||
</style>
|
||||
<style name="SplashTheme.System" parent="@android:style/Theme.Black.NoTitleBar">
|
||||
<item name="android:windowBackground">@color/splash_background</item>
|
||||
<item name="android:defaultFocusHighlightEnabled">false</item>
|
||||
<item name="android:colorControlHighlight">@android:color/transparent</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
||||
<item name="android:windowBackground">@color/splash_background</item>
|
||||
<item name="android:windowSplashScreenAnimatedIcon">@drawable/splash_icon</item>
|
||||
<item name="android:defaultFocusHighlightEnabled">false</item>
|
||||
<item name="android:colorControlHighlight">@android:color/transparent</item>
|
||||
</style>
|
||||
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
||||
<item name="android:windowBackground">@color/splash_background</item>
|
||||
<item name="android:defaultFocusHighlightEnabled">false</item>
|
||||
<item name="android:colorControlHighlight">@android:color/transparent</item>
|
||||
</style>
|
||||
|
||||
<style name="SplashTheme.Dark" parent="@android:style/Theme.Light.NoTitleBar">
|
||||
<item name="android:windowBackground">@color/splash_dark</item>
|
||||
<item name="android:windowSplashScreenAnimatedIcon">@drawable/splash_icon</item>
|
||||
<item name="android:defaultFocusHighlightEnabled">false</item>
|
||||
<item name="android:colorControlHighlight">@android:color/transparent</item>
|
||||
</style>
|
||||
<style name="SplashTheme.Oled" parent="@android:style/Theme.Light.NoTitleBar">
|
||||
<item name="android:windowBackground">@color/splash_oled</item>
|
||||
<item name="android:windowSplashScreenAnimatedIcon">@drawable/splash_icon</item>
|
||||
<item name="android:defaultFocusHighlightEnabled">false</item>
|
||||
<item name="android:colorControlHighlight">@android:color/transparent</item>
|
||||
</style>
|
||||
<style name="SplashTheme.Light" parent="@android:style/Theme.Light.NoTitleBar">
|
||||
<item name="android:windowBackground">@color/splash_light</item>
|
||||
<item name="android:windowSplashScreenAnimatedIcon">@drawable/splash_icon</item>
|
||||
<item name="android:defaultFocusHighlightEnabled">false</item>
|
||||
<item name="android:colorControlHighlight">@android:color/transparent</item>
|
||||
</style>
|
||||
<style name="SplashTheme.System" parent="@android:style/Theme.Light.NoTitleBar">
|
||||
<item name="android:windowBackground">@color/splash_background</item>
|
||||
<item name="android:windowSplashScreenAnimatedIcon">@drawable/splash_icon</item>
|
||||
<item name="android:defaultFocusHighlightEnabled">false</item>
|
||||
<item name="android:colorControlHighlight">@android:color/transparent</item>
|
||||
</style>
|
||||
</resources>
|
||||
@@ -1,4 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_background">#ffffff</color>
|
||||
<color name="splash_background">#F7F7F8</color>
|
||||
<color name="splash_dark">#0E0F12</color>
|
||||
<color name="splash_oled">#000000</color>
|
||||
<color name="splash_light">#F7F7F8</color>
|
||||
</resources>
|
||||
@@ -2,6 +2,7 @@
|
||||
<resources>
|
||||
<!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
|
||||
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
||||
<item name="android:windowBackground">@color/splash_background</item>
|
||||
<!-- Disable Android's default green focus highlight that appears during d-pad/keyboard navigation -->
|
||||
<item name="android:defaultFocusHighlightEnabled">false</item>
|
||||
<item name="android:colorControlHighlight">@android:color/transparent</item>
|
||||
@@ -13,9 +14,31 @@
|
||||
|
||||
This Theme is only used starting with V2 of Flutter's Android embedding. -->
|
||||
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
|
||||
<item name="android:windowBackground">@android:color/black</item>
|
||||
<item name="android:windowBackground">@color/splash_background</item>
|
||||
<!-- Disable Android's default green focus highlight that appears during d-pad/keyboard navigation -->
|
||||
<item name="android:defaultFocusHighlightEnabled">false</item>
|
||||
<item name="android:colorControlHighlight">@android:color/transparent</item>
|
||||
</style>
|
||||
|
||||
<!-- Splash theme variants for setSplashScreenTheme -->
|
||||
<style name="SplashTheme.Dark" parent="@android:style/Theme.Light.NoTitleBar">
|
||||
<item name="android:windowBackground">@color/splash_dark</item>
|
||||
<item name="android:defaultFocusHighlightEnabled">false</item>
|
||||
<item name="android:colorControlHighlight">@android:color/transparent</item>
|
||||
</style>
|
||||
<style name="SplashTheme.Oled" parent="@android:style/Theme.Light.NoTitleBar">
|
||||
<item name="android:windowBackground">@color/splash_oled</item>
|
||||
<item name="android:defaultFocusHighlightEnabled">false</item>
|
||||
<item name="android:colorControlHighlight">@android:color/transparent</item>
|
||||
</style>
|
||||
<style name="SplashTheme.Light" parent="@android:style/Theme.Light.NoTitleBar">
|
||||
<item name="android:windowBackground">@color/splash_light</item>
|
||||
<item name="android:defaultFocusHighlightEnabled">false</item>
|
||||
<item name="android:colorControlHighlight">@android:color/transparent</item>
|
||||
</style>
|
||||
<style name="SplashTheme.System" parent="@android:style/Theme.Light.NoTitleBar">
|
||||
<item name="android:windowBackground">@color/splash_background</item>
|
||||
<item name="android:defaultFocusHighlightEnabled">false</item>
|
||||
<item name="android:colorControlHighlight">@android:color/transparent</item>
|
||||
</style>
|
||||
</resources>
|
||||
|
||||
@@ -19,7 +19,7 @@ platform :android do
|
||||
UI.user_error!("Could not extract version from pubspec.yaml")
|
||||
end
|
||||
|
||||
debug_info_dir = "./build/debug-info/#{version_name}+#{version_code}"
|
||||
debug_info_dir = "./debug-info/#{version_name}+#{version_code}"
|
||||
|
||||
# Build the Flutter app
|
||||
sh("cd #{ENV['PWD']}/.. && flutter build appbundle --dart-define=ENABLE_IN_APP_REVIEW=true --obfuscate --split-debug-info=#{debug_info_dir}/aab")
|
||||
@@ -31,16 +31,16 @@ platform :android do
|
||||
aab: "../build/app/outputs/bundle/release/app-release.aab"
|
||||
)
|
||||
|
||||
# Build split-per-ABI APKs for Amazon Appstore (doesn't accept AABs)
|
||||
sh("cd #{ENV['PWD']}/.. && flutter build apk --release --split-per-abi --obfuscate --split-debug-info=#{debug_info_dir}/apk")
|
||||
# Build universal APK for Amazon Appstore (doesn't accept AABs, doesn't auto-target by ABI)
|
||||
sh("cd #{ENV['PWD']}/.. && flutter build apk --release --target-platform android-arm,android-arm64 --obfuscate --split-debug-info=#{debug_info_dir}/apk")
|
||||
|
||||
upload_to_amazon_appstore(
|
||||
apk_paths: [
|
||||
"../build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk",
|
||||
"../build/app/outputs/flutter-apk/app-arm64-v8a-release.apk"
|
||||
"../build/app/outputs/flutter-apk/app-release.apk"
|
||||
],
|
||||
overwrite_upload: true,
|
||||
overwrite_upload_mode: 'reuse'
|
||||
overwrite_upload_mode: 'reuse',
|
||||
changes_not_sent_for_review: true
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="-276.65 -223.88 911.63 911.63"><defs><linearGradient id="linear-gradient" x1="22.67" y1="425.72" x2="201.83" y2="115.4" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#ab543a"/><stop offset="1" stop-color="#ff7e57"/></linearGradient></defs><path fill="url(#linear-gradient)" d="M335.65,192.66L68.01,38.14C37.78,20.69,0,42.5,0,77.41v309.04c0,34.91,37.78,56.72,68.01,39.27l267.64-154.52c30.23-17.45,30.23-61.08,0-78.54ZM255.53,276.8c-19.1,17.66-38.75,26.49-58.4,26.49s-39.29-8.83-58.39-26.49c-14.39-13.3-28.55-20.05-42.11-20.05s-27.72,6.75-42.1,20.05c-4.87,4.5-12.46,4.2-16.96-.67-4.5-4.86-4.2-12.45.67-16.95,38.2-35.33,78.59-35.33,116.79,0,14.38,13.3,28.55,20.04,42.1,20.04s27.72-6.74,42.11-20.04c4.86-4.5,12.46-4.21,16.95.66,4.5,4.87,4.21,12.46-.66,16.96ZM255.53,204.04c-19.1,17.67-38.75,26.5-58.4,26.5s-39.29-8.83-58.39-26.5c-14.39-13.3-28.55-20.04-42.11-20.04s-27.72,6.74-42.1,20.04c-4.87,4.5-12.46,4.21-16.96-.66s-4.2-12.46.67-16.96c38.2-35.32,78.59-35.32,116.79,0,14.38,13.3,28.55,20.05,42.1,20.05s27.72-6.75,42.11-20.05c4.86-4.5,12.46-4.2,16.95.67,4.5,4.86,4.21,12.45-.66,16.95Z"/></svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 59 KiB |
|
Before Width: | Height: | Size: 21 KiB |
@@ -783,7 +783,7 @@
|
||||
repositoryURL = "https://github.com/edde746/MPVKit";
|
||||
requirement = {
|
||||
kind = revision;
|
||||
revision = 0d0931fbbb25a3483a7edb46babd3f2f55abeefc;
|
||||
revision = 2e887368b44ce1dc9e1649e7757ec62c2564e792;
|
||||
};
|
||||
};
|
||||
/* End XCRemoteSwiftPackageReference section */
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/edde746/MPVKit",
|
||||
"state" : {
|
||||
"revision" : "0d0931fbbb25a3483a7edb46babd3f2f55abeefc"
|
||||
"revision" : "2e887368b44ce1dc9e1649e7757ec62c2564e792"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/edde746/MPVKit",
|
||||
"state" : {
|
||||
"revision" : "0d0931fbbb25a3483a7edb46babd3f2f55abeefc"
|
||||
"revision" : "2e887368b44ce1dc9e1649e7757ec62c2564e792"
|
||||
}
|
||||
}
|
||||
],
|
||||
|
||||
@@ -0,0 +1,184 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../widgets/app_icon.dart';
|
||||
import 'focus_theme.dart';
|
||||
import 'input_mode_tracker.dart';
|
||||
import 'key_event_utils.dart';
|
||||
|
||||
/// Describes a single action button for use in [FocusableActionBar].
|
||||
class FocusableAction {
|
||||
/// Icon to display. Ignored when [child] is provided.
|
||||
final IconData icon;
|
||||
|
||||
/// Icon color. Ignored when [child] is provided.
|
||||
final Color? iconColor;
|
||||
|
||||
final String? tooltip;
|
||||
final VoidCallback? onPressed;
|
||||
|
||||
/// Optional custom child widget placed inside the focus container.
|
||||
/// Overrides the default [IconButton] built from [icon]/[tooltip]/[onPressed].
|
||||
final Widget? child;
|
||||
|
||||
const FocusableAction({
|
||||
this.icon = Icons.circle,
|
||||
this.iconColor,
|
||||
this.tooltip,
|
||||
this.onPressed,
|
||||
this.child,
|
||||
});
|
||||
}
|
||||
|
||||
/// A row of focusable action buttons for app bar [actions:].
|
||||
///
|
||||
/// Manages focus nodes, left/right D-pad navigation between buttons,
|
||||
/// and the standard white-alpha background focus indicator internally.
|
||||
///
|
||||
/// Returns a single [Row] widget — place it inside the `actions:` list:
|
||||
/// ```dart
|
||||
/// CustomAppBar(
|
||||
/// title: Text('Title'),
|
||||
/// actions: [
|
||||
/// FocusableActionBar(
|
||||
/// actions: [
|
||||
/// FocusableAction(icon: Symbols.refresh_rounded, onPressed: _refresh),
|
||||
/// FocusableAction(icon: Symbols.upload_rounded, onPressed: _upload),
|
||||
/// ],
|
||||
/// ),
|
||||
/// ],
|
||||
/// )
|
||||
/// ```
|
||||
class FocusableActionBar extends StatefulWidget {
|
||||
final List<FocusableAction> actions;
|
||||
|
||||
/// Called when the user presses down from any action button.
|
||||
final VoidCallback? onNavigateDown;
|
||||
|
||||
/// Called when the user presses up from any action button.
|
||||
final VoidCallback? onNavigateUp;
|
||||
|
||||
/// Called when the user presses left from the leftmost button.
|
||||
final VoidCallback? onNavigateLeft;
|
||||
|
||||
/// Called when the user presses right from the rightmost button.
|
||||
final VoidCallback? onNavigateRight;
|
||||
|
||||
/// Called when the user presses the back key while an action is focused.
|
||||
final VoidCallback? onBack;
|
||||
|
||||
const FocusableActionBar({
|
||||
super.key,
|
||||
required this.actions,
|
||||
this.onNavigateDown,
|
||||
this.onNavigateUp,
|
||||
this.onNavigateLeft,
|
||||
this.onNavigateRight,
|
||||
this.onBack,
|
||||
});
|
||||
|
||||
@override
|
||||
State<FocusableActionBar> createState() => FocusableActionBarState();
|
||||
}
|
||||
|
||||
class FocusableActionBarState extends State<FocusableActionBar> {
|
||||
late List<FocusNode> _focusNodes;
|
||||
late List<bool> _focusStates;
|
||||
|
||||
/// Access a focus node by index (e.g. for external `requestFocus()` calls).
|
||||
FocusNode getFocusNode(int index) => _focusNodes[index];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_initNodes();
|
||||
}
|
||||
|
||||
@override
|
||||
void didUpdateWidget(FocusableActionBar oldWidget) {
|
||||
super.didUpdateWidget(oldWidget);
|
||||
if (oldWidget.actions.length != widget.actions.length) {
|
||||
_disposeNodes();
|
||||
_initNodes();
|
||||
}
|
||||
}
|
||||
|
||||
void _initNodes() {
|
||||
_focusNodes = List.generate(widget.actions.length, (i) => FocusNode(debugLabel: 'ActionBar[$i]'));
|
||||
_focusStates = List.filled(widget.actions.length, false);
|
||||
for (var i = 0; i < _focusNodes.length; i++) {
|
||||
final idx = i;
|
||||
_focusNodes[i].addListener(() {
|
||||
final hasFocus = _focusNodes[idx].hasFocus;
|
||||
if (_focusStates[idx] != hasFocus) {
|
||||
setState(() => _focusStates[idx] = hasFocus);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void _disposeNodes() {
|
||||
for (final node in _focusNodes) {
|
||||
node.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_disposeNodes();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final isKeyboard = InputModeTracker.isKeyboardMode(context);
|
||||
final duration = FocusTheme.getAnimationDuration(context);
|
||||
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
for (var i = 0; i < widget.actions.length; i++) _buildButton(i, isKeyboard, duration),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildButton(int index, bool isKeyboard, Duration duration) {
|
||||
final action = widget.actions[index];
|
||||
final isFocused = _focusStates[index];
|
||||
final showFocus = isFocused && isKeyboard;
|
||||
final opacity = isKeyboard && !isFocused ? 0.6 : 1.0;
|
||||
|
||||
return Focus(
|
||||
focusNode: _focusNodes[index],
|
||||
onKeyEvent: (node, event) {
|
||||
if (widget.onBack != null) {
|
||||
final backResult = handleBackKeyAction(event, widget.onBack!);
|
||||
if (backResult != KeyEventResult.ignored) return backResult;
|
||||
}
|
||||
return dpadKeyHandler(
|
||||
onSelect: action.onPressed,
|
||||
onLeft: index > 0
|
||||
? () => _focusNodes[index - 1].requestFocus()
|
||||
: widget.onNavigateLeft,
|
||||
onRight: index < _focusNodes.length - 1
|
||||
? () => _focusNodes[index + 1].requestFocus()
|
||||
: widget.onNavigateRight,
|
||||
onDown: widget.onNavigateDown,
|
||||
onUp: widget.onNavigateUp,
|
||||
)(node, event);
|
||||
},
|
||||
child: AnimatedOpacity(
|
||||
opacity: showFocus ? 1.0 : opacity,
|
||||
duration: duration,
|
||||
child: Container(
|
||||
decoration: FocusTheme.focusBackgroundDecoration(isFocused: showFocus, borderRadius: 20),
|
||||
child: action.child ??
|
||||
IconButton(
|
||||
icon: AppIcon(action.icon, fill: 1, color: action.iconColor),
|
||||
tooltip: action.tooltip,
|
||||
onPressed: action.onPressed,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -52,7 +52,12 @@
|
||||
"exitConfirmMessage": "Möchtest du die App wirklich beenden?",
|
||||
"dontAskAgain": "Nicht erneut fragen",
|
||||
"exit": "Beenden",
|
||||
"viewAll": "Alle anzeigen"
|
||||
"viewAll": "Alle anzeigen",
|
||||
"checkingNetwork": "Netzwerk wird geprüft...",
|
||||
"refreshingServers": "Server werden aktualisiert...",
|
||||
"loadingServers": "Server werden geladen...",
|
||||
"connectingToServers": "Verbindung zu Servern...",
|
||||
"startingOfflineMode": "Offlinemodus wird gestartet..."
|
||||
},
|
||||
"screens": {
|
||||
"licenses": "Lizenzen",
|
||||
@@ -117,6 +122,8 @@
|
||||
"alwaysKeepSidebarOpenDescription": "Seitenleiste bleibt erweitert und Inhaltsbereich passt sich an",
|
||||
"showUnwatchedCount": "Anzahl nicht gesehener Folgen anzeigen",
|
||||
"showUnwatchedCountDescription": "Zeigt die Anzahl nicht gesehener Episoden bei Serien und Staffeln an",
|
||||
"hideSpoilers": "Spoiler für nicht gesehene Episoden verbergen",
|
||||
"hideSpoilersDescription": "Vorschaubilder unscharf machen und Beschreibungen für noch nicht gesehene Episoden ausblenden",
|
||||
"playerBackend": "Player-Backend",
|
||||
"exoPlayer": "ExoPlayer (Empfohlen)",
|
||||
"exoPlayerDescription": "Android-nativer Player mit besserer Hardware-Unterstützung",
|
||||
@@ -190,8 +197,12 @@
|
||||
"maxVolumePercent": "${percent}%",
|
||||
"discordRichPresence": "Discord Rich Presence",
|
||||
"discordRichPresenceDescription": "Zeige auf Discord, was du gerade schaust",
|
||||
"autoPip": "Automatisches Bild-in-Bild",
|
||||
"autoPipDescription": "Automatisch Bild-in-Bild aktivieren, wenn die App während der Wiedergabe verlassen wird",
|
||||
"matchContentFrameRate": "Inhalts-Bildrate anpassen",
|
||||
"matchContentFrameRateDescription": "Bildwiederholfrequenz des Displays an den Videoinhalt anpassen, reduziert Ruckeln und spart Akku",
|
||||
"tunneledPlayback": "Tunneled Playback",
|
||||
"tunneledPlaybackDescription": "Use hardware-accelerated video tunneling. Disable if you see a black screen with audio on HDR content",
|
||||
"requireProfileSelectionOnOpen": "Profil beim Öffnen abfragen",
|
||||
"requireProfileSelectionOnOpenDescription": "Profilauswahl bei jedem Öffnen der App anzeigen",
|
||||
"confirmExitOnBack": "Vor dem Beenden bestätigen",
|
||||
@@ -266,8 +277,9 @@
|
||||
"goToSeason": "Zur Staffel",
|
||||
"shufflePlay": "Zufallswiedergabe",
|
||||
"fileInfo": "Dateiinfo",
|
||||
"confirmDelete": "Sind Sie sicher, dass Sie dieses Element aus Ihrem Dateisystem löschen möchten?",
|
||||
"deleteMultipleWarning": "Mehrere Elemente können gelöscht werden.",
|
||||
"deleteFromServer": "Vom Server löschen",
|
||||
"confirmDelete": "Dieses Medium und seine Dateien werden dauerhaft von Ihrem Server gelöscht. Dies kann nicht rückgängig gemacht werden.",
|
||||
"deleteMultipleWarning": "Dies umfasst alle Episoden und deren Dateien.",
|
||||
"mediaDeletedSuccessfully": "Medienelement erfolgreich gelöscht",
|
||||
"mediaFailedToDelete": "Löschen des Medienelements fehlgeschlagen",
|
||||
"rate": "Bewerten"
|
||||
@@ -799,7 +811,8 @@
|
||||
"hdr": "HDR",
|
||||
"audioOutput": "Audioausgabe",
|
||||
"performanceOverlay": "Leistungsanzeige",
|
||||
"audioPassthrough": "Audio-Durchleitung"
|
||||
"audioPassthrough": "Audio-Durchleitung",
|
||||
"audioNormalization": "Audio-Normalisierung"
|
||||
},
|
||||
"externalPlayer": {
|
||||
"title": "Externer Player",
|
||||
|
||||
@@ -52,7 +52,12 @@
|
||||
"exitConfirmMessage": "Are you sure you want to exit?",
|
||||
"dontAskAgain": "Don't ask again",
|
||||
"exit": "Exit",
|
||||
"viewAll": "View All"
|
||||
"viewAll": "View All",
|
||||
"checkingNetwork": "Checking network...",
|
||||
"refreshingServers": "Refreshing servers...",
|
||||
"loadingServers": "Loading servers...",
|
||||
"connectingToServers": "Connecting to servers...",
|
||||
"startingOfflineMode": "Starting offline mode..."
|
||||
},
|
||||
"screens": {
|
||||
"licenses": "Licenses",
|
||||
@@ -117,6 +122,8 @@
|
||||
"alwaysKeepSidebarOpenDescription": "Sidebar stays expanded and content area adjusts to fit",
|
||||
"showUnwatchedCount": "Show Unwatched Count",
|
||||
"showUnwatchedCountDescription": "Display unwatched episode count on shows and seasons",
|
||||
"hideSpoilers": "Hide Spoilers for Unwatched Episodes",
|
||||
"hideSpoilersDescription": "Blur thumbnails and hide descriptions for episodes you haven't watched yet",
|
||||
"playerBackend": "Player Backend",
|
||||
"exoPlayer": "ExoPlayer (Recommended)",
|
||||
"exoPlayerDescription": "Android native player with better hardware support",
|
||||
@@ -190,8 +197,12 @@
|
||||
"maxVolumePercent": "${percent}%",
|
||||
"discordRichPresence": "Discord Rich Presence",
|
||||
"discordRichPresenceDescription": "Show what you're watching on Discord",
|
||||
"autoPip": "Auto Picture-in-Picture",
|
||||
"autoPipDescription": "Automatically enter picture-in-picture when leaving the app during playback",
|
||||
"matchContentFrameRate": "Match Content Frame Rate",
|
||||
"matchContentFrameRateDescription": "Adjust display refresh rate to match video content, reducing judder and saving battery",
|
||||
"tunneledPlayback": "Tunneled Playback",
|
||||
"tunneledPlaybackDescription": "Use hardware-accelerated video tunneling. Disable if you see a black screen with audio on HDR content",
|
||||
"requireProfileSelectionOnOpen": "Ask for profile on app open",
|
||||
"requireProfileSelectionOnOpenDescription": "Show profile selection every time the app is opened",
|
||||
"confirmExitOnBack": "Confirm before exiting",
|
||||
@@ -266,8 +277,9 @@
|
||||
"goToSeason": "Go to season",
|
||||
"shufflePlay": "Shuffle Play",
|
||||
"fileInfo": "File Info",
|
||||
"confirmDelete": "Are you sure you want to delete this item from your filesystem?",
|
||||
"deleteMultipleWarning": "Multiple items may be deleted.",
|
||||
"deleteFromServer": "Delete from server",
|
||||
"confirmDelete": "This will permanently delete this media and its files from your server. This cannot be undone.",
|
||||
"deleteMultipleWarning": "This includes all episodes and their files.",
|
||||
"mediaDeletedSuccessfully": "Media item deleted successfully",
|
||||
"mediaFailedToDelete": "Failed to delete media item",
|
||||
"rate": "Rate"
|
||||
@@ -799,7 +811,8 @@
|
||||
"hdr": "HDR",
|
||||
"audioOutput": "Audio Output",
|
||||
"performanceOverlay": "Performance Overlay",
|
||||
"audioPassthrough": "Audio Passthrough"
|
||||
"audioPassthrough": "Audio Passthrough",
|
||||
"audioNormalization": "Audio Normalization"
|
||||
},
|
||||
"externalPlayer": {
|
||||
"title": "External Player",
|
||||
|
||||
@@ -52,7 +52,12 @@
|
||||
"exitConfirmMessage": "¿Estás seguro de que quieres salir?",
|
||||
"dontAskAgain": "No volver a preguntar",
|
||||
"exit": "Salir",
|
||||
"viewAll": "Ver todo"
|
||||
"viewAll": "Ver todo",
|
||||
"checkingNetwork": "Comprobando red...",
|
||||
"refreshingServers": "Actualizando servidores...",
|
||||
"loadingServers": "Cargando servidores...",
|
||||
"connectingToServers": "Conectando a servidores...",
|
||||
"startingOfflineMode": "Iniciando modo sin conexión..."
|
||||
},
|
||||
"screens": {
|
||||
"licenses": "Licencias",
|
||||
@@ -117,6 +122,8 @@
|
||||
"alwaysKeepSidebarOpenDescription": "La barra lateral permanece expandida y el área de contenido se ajusta para adaptarse",
|
||||
"showUnwatchedCount": "Mostrar conteo de no vistos",
|
||||
"showUnwatchedCountDescription": "Mostrar el conteo de episodios no vistos en series y temporadas",
|
||||
"hideSpoilers": "Ocultar spoilers de episodios no vistos",
|
||||
"hideSpoilersDescription": "Difuminar miniaturas y ocultar descripciones de episodios que aún no has visto",
|
||||
"playerBackend": "Reproductor",
|
||||
"exoPlayer": "ExoPlayer (Recomendado)",
|
||||
"exoPlayerDescription": "Reproductor nativo de Android con mejor soporte de hardware",
|
||||
@@ -190,8 +197,12 @@
|
||||
"maxVolumePercent": "${percent}%",
|
||||
"discordRichPresence": "Presencia de Discord",
|
||||
"discordRichPresenceDescription": "Mostrar lo que estás viendo en Discord",
|
||||
"autoPip": "Imagen en imagen automática",
|
||||
"autoPipDescription": "Activar automáticamente imagen en imagen al salir de la app durante la reproducción",
|
||||
"matchContentFrameRate": "Ajustar frecuencia de actualización",
|
||||
"matchContentFrameRateDescription": "Ajustar la frecuencia de actualización de la pantalla para que coincida con el video, reduciendo tirones y ahorrando batería",
|
||||
"tunneledPlayback": "Tunneled Playback",
|
||||
"tunneledPlaybackDescription": "Use hardware-accelerated video tunneling. Disable if you see a black screen with audio on HDR content",
|
||||
"requireProfileSelectionOnOpen": "Pedir perfil al abrir la app",
|
||||
"requireProfileSelectionOnOpenDescription": "Mostrar selección de perfil cada vez que se abre la aplicación",
|
||||
"confirmExitOnBack": "Confirmar antes de salir",
|
||||
@@ -266,8 +277,9 @@
|
||||
"goToSeason": "Ir a la temporada",
|
||||
"shufflePlay": "Reproducción Aleatoria",
|
||||
"fileInfo": "Información del Archivo",
|
||||
"confirmDelete": "¿Estás seguro de que quieres eliminar este elemento de tu sistema de archivos?",
|
||||
"deleteMultipleWarning": "Es posible que se eliminen varios elementos.",
|
||||
"deleteFromServer": "Eliminar del servidor",
|
||||
"confirmDelete": "Esto eliminará permanentemente este contenido y sus archivos de tu servidor. Esta acción no se puede deshacer.",
|
||||
"deleteMultipleWarning": "Esto incluye todos los episodios y sus archivos.",
|
||||
"mediaDeletedSuccessfully": "Elemento multimedia eliminado con éxito",
|
||||
"mediaFailedToDelete": "Error al eliminar el elemento multimedia",
|
||||
"rate": "Calificar"
|
||||
@@ -799,7 +811,8 @@
|
||||
"hdr": "HDR",
|
||||
"audioOutput": "Salida de audio",
|
||||
"performanceOverlay": "Indicador de rendimiento",
|
||||
"audioPassthrough": "Audio Passthrough"
|
||||
"audioPassthrough": "Audio Passthrough",
|
||||
"audioNormalization": "Normalización de audio"
|
||||
},
|
||||
"externalPlayer": {
|
||||
"title": "Reproductor externo",
|
||||
|
||||
@@ -52,7 +52,12 @@
|
||||
"exitConfirmMessage": "Êtes-vous sûr de vouloir quitter ?",
|
||||
"dontAskAgain": "Ne plus demander",
|
||||
"exit": "Quitter",
|
||||
"viewAll": "Tout afficher"
|
||||
"viewAll": "Tout afficher",
|
||||
"checkingNetwork": "Vérification du réseau...",
|
||||
"refreshingServers": "Actualisation des serveurs...",
|
||||
"loadingServers": "Chargement des serveurs...",
|
||||
"connectingToServers": "Connexion aux serveurs...",
|
||||
"startingOfflineMode": "Démarrage en mode hors-ligne..."
|
||||
},
|
||||
"screens": {
|
||||
"licenses": "Licenses",
|
||||
@@ -117,6 +122,8 @@
|
||||
"alwaysKeepSidebarOpenDescription": "La barre latérale reste étendue et la zone de contenu s'adapte",
|
||||
"showUnwatchedCount": "Afficher le nombre non visionné",
|
||||
"showUnwatchedCountDescription": "Afficher le nombre d'épisodes non visionnés pour les séries et saisons",
|
||||
"hideSpoilers": "Masquer les spoilers des épisodes non vus",
|
||||
"hideSpoilersDescription": "Flouter les miniatures et masquer les descriptions des épisodes que vous n'avez pas encore regardés",
|
||||
"playerBackend": "Moteur de lecture",
|
||||
"exoPlayer": "ExoPlayer (Recommandé)",
|
||||
"exoPlayerDescription": "Lecteur natif Android avec meilleur support matériel",
|
||||
@@ -190,8 +197,12 @@
|
||||
"maxVolumePercent": "${percent}%",
|
||||
"discordRichPresence": "Discord Rich Presence",
|
||||
"discordRichPresenceDescription": "Montrez ce que vous regardez sur Discord",
|
||||
"autoPip": "Image dans l'image automatique",
|
||||
"autoPipDescription": "Activer automatiquement l'image dans l'image en quittant l'application pendant la lecture",
|
||||
"matchContentFrameRate": "Fréquence d'images du contenu correspondant",
|
||||
"matchContentFrameRateDescription": "Ajustez la fréquence de rafraîchissement de l'écran en fonction du contenu vidéo, ce qui réduit les saccades et économise la batterie",
|
||||
"tunneledPlayback": "Tunneled Playback",
|
||||
"tunneledPlaybackDescription": "Use hardware-accelerated video tunneling. Disable if you see a black screen with audio on HDR content",
|
||||
"requireProfileSelectionOnOpen": "Demander le profil à l'ouverture",
|
||||
"requireProfileSelectionOnOpenDescription": "Afficher la sélection de profil à chaque ouverture de l'application",
|
||||
"confirmExitOnBack": "Confirmer avant de quitter",
|
||||
@@ -266,8 +277,9 @@
|
||||
"goToSeason": "Aller à la saison",
|
||||
"shufflePlay": "Lecture aléatoire",
|
||||
"fileInfo": "Informations sur le fichier",
|
||||
"confirmDelete": "Êtes-vous sûr de vouloir supprimer cet élément de votre système de fichiers?",
|
||||
"deleteMultipleWarning": "Plusieurs éléments peuvent être supprimés.",
|
||||
"deleteFromServer": "Supprimer du serveur",
|
||||
"confirmDelete": "Cela supprimera définitivement ce média et ses fichiers de votre serveur. Cette action est irréversible.",
|
||||
"deleteMultipleWarning": "Cela inclut tous les épisodes et leurs fichiers.",
|
||||
"mediaDeletedSuccessfully": "Élément média supprimé avec succès",
|
||||
"mediaFailedToDelete": "Échec de la suppression de l'élément média",
|
||||
"rate": "Noter"
|
||||
@@ -799,7 +811,8 @@
|
||||
"hdr": "HDR",
|
||||
"audioOutput": "Sortie audio",
|
||||
"performanceOverlay": "Superposition de performance",
|
||||
"audioPassthrough": "Audio Pass-Through"
|
||||
"audioPassthrough": "Audio Pass-Through",
|
||||
"audioNormalization": "Normalisation audio"
|
||||
},
|
||||
"externalPlayer": {
|
||||
"title": "Lecteur externe",
|
||||
|
||||
@@ -52,7 +52,12 @@
|
||||
"exitConfirmMessage": "Sei sicuro di voler uscire?",
|
||||
"dontAskAgain": "Non chiedere più",
|
||||
"exit": "Esci",
|
||||
"viewAll": "Mostra tutto"
|
||||
"viewAll": "Mostra tutto",
|
||||
"checkingNetwork": "Verifica rete...",
|
||||
"refreshingServers": "Aggiornamento server...",
|
||||
"loadingServers": "Caricamento server...",
|
||||
"connectingToServers": "Connessione ai server...",
|
||||
"startingOfflineMode": "Avvio modalità offline..."
|
||||
},
|
||||
"screens": {
|
||||
"licenses": "Licenze",
|
||||
@@ -117,6 +122,8 @@
|
||||
"alwaysKeepSidebarOpenDescription": "La barra laterale rimane espansa e l'area del contenuto si adatta",
|
||||
"showUnwatchedCount": "Mostra conteggio non visti",
|
||||
"showUnwatchedCountDescription": "Mostra il numero di episodi non visti per serie e stagioni",
|
||||
"hideSpoilers": "Nascondi spoiler per episodi non visti",
|
||||
"hideSpoilersDescription": "Sfoca le miniature e nascondi le descrizioni degli episodi che non hai ancora guardato",
|
||||
"playerBackend": "Motore di riproduzione",
|
||||
"exoPlayer": "ExoPlayer (Consigliato)",
|
||||
"exoPlayerDescription": "Lettore nativo Android con migliore supporto hardware",
|
||||
@@ -190,8 +197,12 @@
|
||||
"maxVolumePercent": "${percent}%",
|
||||
"discordRichPresence": "Discord Rich Presence",
|
||||
"discordRichPresenceDescription": "Mostra su Discord cosa stai guardando",
|
||||
"autoPip": "Picture-in-Picture automatico",
|
||||
"autoPipDescription": "Attiva automaticamente il picture-in-picture quando si esce dall'app durante la riproduzione",
|
||||
"matchContentFrameRate": "Adatta frequenza fotogrammi",
|
||||
"matchContentFrameRateDescription": "Regola la frequenza di aggiornamento del display in base al contenuto video, riducendo i tremolii e risparmiando batteria",
|
||||
"tunneledPlayback": "Tunneled Playback",
|
||||
"tunneledPlaybackDescription": "Use hardware-accelerated video tunneling. Disable if you see a black screen with audio on HDR content",
|
||||
"requireProfileSelectionOnOpen": "Chiedi profilo all'apertura",
|
||||
"requireProfileSelectionOnOpenDescription": "Mostra la selezione del profilo ogni volta che l'app viene aperta",
|
||||
"confirmExitOnBack": "Conferma prima di uscire",
|
||||
@@ -266,8 +277,9 @@
|
||||
"goToSeason": "Vai alla stagione",
|
||||
"shufflePlay": "Riproduzione casuale",
|
||||
"fileInfo": "Info sul file",
|
||||
"confirmDelete": "Sei sicuro di voler eliminare questo elemento dal tuo filesystem?",
|
||||
"deleteMultipleWarning": "Potrebbero essere eliminati più elementi.",
|
||||
"deleteFromServer": "Elimina dal server",
|
||||
"confirmDelete": "Questo eliminerà permanentemente questo contenuto e i suoi file dal tuo server. Questa azione non può essere annullata.",
|
||||
"deleteMultipleWarning": "Questo include tutti gli episodi e i loro file.",
|
||||
"mediaDeletedSuccessfully": "Elemento multimediale eliminato con successo",
|
||||
"mediaFailedToDelete": "Impossibile eliminare l'elemento multimediale",
|
||||
"rate": "Valuta"
|
||||
@@ -799,7 +811,8 @@
|
||||
"hdr": "HDR",
|
||||
"audioOutput": "Uscita audio",
|
||||
"performanceOverlay": "Overlay prestazioni",
|
||||
"audioPassthrough": "Audio Passthrough"
|
||||
"audioPassthrough": "Audio Passthrough",
|
||||
"audioNormalization": "Normalizzazione audio"
|
||||
},
|
||||
"externalPlayer": {
|
||||
"title": "Lettore esterno",
|
||||
|
||||
@@ -52,7 +52,12 @@
|
||||
"exitConfirmMessage": "정말 종료하시겠습니까?",
|
||||
"dontAskAgain": "다시 묻지 않기",
|
||||
"exit": "종료",
|
||||
"viewAll": "모두 보기"
|
||||
"viewAll": "모두 보기",
|
||||
"checkingNetwork": "네트워크 확인 중...",
|
||||
"refreshingServers": "서버 새로고침 중...",
|
||||
"loadingServers": "서버 로딩 중...",
|
||||
"connectingToServers": "서버 연결 중...",
|
||||
"startingOfflineMode": "오프라인 모드 시작 중..."
|
||||
},
|
||||
"screens": {
|
||||
"licenses": "라이선스",
|
||||
@@ -117,6 +122,8 @@
|
||||
"alwaysKeepSidebarOpenDescription": "사이드바가 확장된 상태로 유지되고 콘텐츠 영역이 맞춰집니다",
|
||||
"showUnwatchedCount": "미시청 수 표시",
|
||||
"showUnwatchedCountDescription": "시리즈 및 시즌에 미시청 에피소드 수 표시",
|
||||
"hideSpoilers": "미시청 에피소드 스포일러 숨기기",
|
||||
"hideSpoilersDescription": "아직 시청하지 않은 에피소드의 썸네일을 흐리게 하고 설명을 숨깁니다",
|
||||
"playerBackend": "플레이어 백엔드",
|
||||
"exoPlayer": "ExoPlayer (권장)",
|
||||
"exoPlayerDescription": "더 나은 하드웨어 지원을 제공하는 Android 네이티브 플레이어",
|
||||
@@ -190,8 +197,12 @@
|
||||
"maxVolumePercent": "${percent}%",
|
||||
"discordRichPresence": "Discord Rich Presence",
|
||||
"discordRichPresenceDescription": "Discord에서 시청 중인 콘텐츠 표시",
|
||||
"autoPip": "자동 PIP 모드",
|
||||
"autoPipDescription": "재생 중 앱을 나갈 때 자동으로 PIP 모드로 전환",
|
||||
"matchContentFrameRate": "콘텐츠 프레임 레이트 맞춤",
|
||||
"matchContentFrameRateDescription": "비디오 콘텐츠에 맞게 디스플레이 주사율을 조정하여 떨림을 줄이고 배터리를 절약합니다",
|
||||
"tunneledPlayback": "Tunneled Playback",
|
||||
"tunneledPlaybackDescription": "Use hardware-accelerated video tunneling. Disable if you see a black screen with audio on HDR content",
|
||||
"requireProfileSelectionOnOpen": "앱 실행 시 프로필 선택",
|
||||
"requireProfileSelectionOnOpenDescription": "앱을 열 때마다 프로필 선택 화면을 표시합니다",
|
||||
"confirmExitOnBack": "종료 전 확인",
|
||||
@@ -266,8 +277,9 @@
|
||||
"goToSeason": "시즌으로 이동",
|
||||
"shufflePlay": "무작위 재생",
|
||||
"fileInfo": "파일 정보",
|
||||
"confirmDelete": "파일 시스템에서 이 항목을 삭제하시겠습니까?",
|
||||
"deleteMultipleWarning": "여러 항목이 삭제될 수 있습니다.",
|
||||
"deleteFromServer": "서버에서 삭제",
|
||||
"confirmDelete": "이 미디어와 파일이 서버에서 영구적으로 삭제됩니다. 이 작업은 취소할 수 없습니다.",
|
||||
"deleteMultipleWarning": "모든 에피소드와 파일이 포함됩니다.",
|
||||
"mediaDeletedSuccessfully": "미디어 항목이 성공적으로 삭제되었습니다",
|
||||
"mediaFailedToDelete": "미디어 항목 삭제 실패",
|
||||
"rate": "평가"
|
||||
@@ -799,7 +811,8 @@
|
||||
"hdr": "HDR",
|
||||
"audioOutput": "오디오 출력",
|
||||
"performanceOverlay": "성능 오버레이",
|
||||
"audioPassthrough": "오디오 패스스루"
|
||||
"audioPassthrough": "오디오 패스스루",
|
||||
"audioNormalization": "오디오 정규화"
|
||||
},
|
||||
"externalPlayer": {
|
||||
"title": "외부 플레이어",
|
||||
|
||||
@@ -52,7 +52,12 @@
|
||||
"exitConfirmMessage": "Weet je zeker dat je wilt afsluiten?",
|
||||
"dontAskAgain": "Niet meer vragen",
|
||||
"exit": "Afsluiten",
|
||||
"viewAll": "Alles weergeven"
|
||||
"viewAll": "Alles weergeven",
|
||||
"checkingNetwork": "Netwerk controleren...",
|
||||
"refreshingServers": "Servers vernieuwen...",
|
||||
"loadingServers": "Servers laden...",
|
||||
"connectingToServers": "Verbinden met servers...",
|
||||
"startingOfflineMode": "Offlinemodus starten..."
|
||||
},
|
||||
"screens": {
|
||||
"licenses": "Licenties",
|
||||
@@ -117,6 +122,8 @@
|
||||
"alwaysKeepSidebarOpenDescription": "Zijbalk blijft uitgevouwen en inhoudsgebied past zich aan",
|
||||
"showUnwatchedCount": "Aantal ongekeken tonen",
|
||||
"showUnwatchedCountDescription": "Toon aantal ongekeken afleveringen bij series en seizoenen",
|
||||
"hideSpoilers": "Spoilers voor ongekeken afleveringen verbergen",
|
||||
"hideSpoilersDescription": "Miniaturen vervagen en beschrijvingen verbergen voor afleveringen die je nog niet hebt gezien",
|
||||
"playerBackend": "Speler backend",
|
||||
"exoPlayer": "ExoPlayer (Aanbevolen)",
|
||||
"exoPlayerDescription": "Android-native speler met betere hardware-ondersteuning",
|
||||
@@ -190,8 +197,12 @@
|
||||
"maxVolumePercent": "${percent}%",
|
||||
"discordRichPresence": "Discord Rich Presence",
|
||||
"discordRichPresenceDescription": "Toon op Discord wat je aan het kijken bent",
|
||||
"autoPip": "Automatische beeld-in-beeld",
|
||||
"autoPipDescription": "Automatisch beeld-in-beeld activeren bij het verlaten van de app tijdens afspelen",
|
||||
"matchContentFrameRate": "Inhoudsframesnelheid afstemmen",
|
||||
"matchContentFrameRateDescription": "Pas de schermverversingssnelheid aan op de video-inhoud, vermindert haperingen en bespaart batterij",
|
||||
"tunneledPlayback": "Tunneled Playback",
|
||||
"tunneledPlaybackDescription": "Use hardware-accelerated video tunneling. Disable if you see a black screen with audio on HDR content",
|
||||
"requireProfileSelectionOnOpen": "Vraag om profiel bij openen",
|
||||
"requireProfileSelectionOnOpenDescription": "Toon profielselectie telkens wanneer de app wordt geopend",
|
||||
"confirmExitOnBack": "Bevestigen voor afsluiten",
|
||||
@@ -266,8 +277,9 @@
|
||||
"goToSeason": "Ga naar seizoen",
|
||||
"shufflePlay": "Willekeurig afspelen",
|
||||
"fileInfo": "Bestand info",
|
||||
"confirmDelete": "Weet je zeker dat je dit item van je bestandssysteem wilt verwijderen?",
|
||||
"deleteMultipleWarning": "Meerdere items kunnen worden verwijderd.",
|
||||
"deleteFromServer": "Verwijderen van server",
|
||||
"confirmDelete": "Dit zal deze media en de bijbehorende bestanden permanent van je server verwijderen. Dit kan niet ongedaan worden gemaakt.",
|
||||
"deleteMultipleWarning": "Dit omvat alle afleveringen en hun bestanden.",
|
||||
"mediaDeletedSuccessfully": "Media-item succesvol verwijderd",
|
||||
"mediaFailedToDelete": "Verwijderen van media-item mislukt",
|
||||
"rate": "Beoordelen"
|
||||
@@ -799,7 +811,8 @@
|
||||
"hdr": "HDR",
|
||||
"audioOutput": "Audio-uitvoer",
|
||||
"performanceOverlay": "Prestatie-overlay",
|
||||
"audioPassthrough": "Audio-doorvoer"
|
||||
"audioPassthrough": "Audio-doorvoer",
|
||||
"audioNormalization": "Audionormalisatie"
|
||||
},
|
||||
"externalPlayer": {
|
||||
"title": "Externe speler",
|
||||
|
||||
@@ -151,6 +151,11 @@ class _TranslationsCommonDe implements TranslationsCommonEn {
|
||||
@override String get dontAskAgain => 'Nicht erneut fragen';
|
||||
@override String get exit => 'Beenden';
|
||||
@override String get viewAll => 'Alle anzeigen';
|
||||
@override String get checkingNetwork => 'Netzwerk wird geprüft...';
|
||||
@override String get refreshingServers => 'Server werden aktualisiert...';
|
||||
@override String get loadingServers => 'Server werden geladen...';
|
||||
@override String get connectingToServers => 'Verbindung zu Servern...';
|
||||
@override String get startingOfflineMode => 'Offlinemodus wird gestartet...';
|
||||
}
|
||||
|
||||
// Path: screens
|
||||
@@ -236,6 +241,8 @@ class _TranslationsSettingsDe implements TranslationsSettingsEn {
|
||||
@override String get alwaysKeepSidebarOpenDescription => 'Seitenleiste bleibt erweitert und Inhaltsbereich passt sich an';
|
||||
@override String get showUnwatchedCount => 'Anzahl nicht gesehener Folgen anzeigen';
|
||||
@override String get showUnwatchedCountDescription => 'Zeigt die Anzahl nicht gesehener Episoden bei Serien und Staffeln an';
|
||||
@override String get hideSpoilers => 'Spoiler für nicht gesehene Episoden verbergen';
|
||||
@override String get hideSpoilersDescription => 'Vorschaubilder unscharf machen und Beschreibungen für noch nicht gesehene Episoden ausblenden';
|
||||
@override String get playerBackend => 'Player-Backend';
|
||||
@override String get exoPlayer => 'ExoPlayer (Empfohlen)';
|
||||
@override String get exoPlayerDescription => 'Android-nativer Player mit besserer Hardware-Unterstützung';
|
||||
@@ -309,8 +316,12 @@ class _TranslationsSettingsDe implements TranslationsSettingsEn {
|
||||
@override String maxVolumePercent({required Object percent}) => '${percent}%';
|
||||
@override String get discordRichPresence => 'Discord Rich Presence';
|
||||
@override String get discordRichPresenceDescription => 'Zeige auf Discord, was du gerade schaust';
|
||||
@override String get autoPip => 'Automatisches Bild-in-Bild';
|
||||
@override String get autoPipDescription => 'Automatisch Bild-in-Bild aktivieren, wenn die App während der Wiedergabe verlassen wird';
|
||||
@override String get matchContentFrameRate => 'Inhalts-Bildrate anpassen';
|
||||
@override String get matchContentFrameRateDescription => 'Bildwiederholfrequenz des Displays an den Videoinhalt anpassen, reduziert Ruckeln und spart Akku';
|
||||
@override String get tunneledPlayback => 'Tunneled Playback';
|
||||
@override String get tunneledPlaybackDescription => 'Use hardware-accelerated video tunneling. Disable if you see a black screen with audio on HDR content';
|
||||
@override String get requireProfileSelectionOnOpen => 'Profil beim Öffnen abfragen';
|
||||
@override String get requireProfileSelectionOnOpenDescription => 'Profilauswahl bei jedem Öffnen der App anzeigen';
|
||||
@override String get confirmExitOnBack => 'Vor dem Beenden bestätigen';
|
||||
@@ -400,8 +411,9 @@ class _TranslationsMediaMenuDe implements TranslationsMediaMenuEn {
|
||||
@override String get goToSeason => 'Zur Staffel';
|
||||
@override String get shufflePlay => 'Zufallswiedergabe';
|
||||
@override String get fileInfo => 'Dateiinfo';
|
||||
@override String get confirmDelete => 'Sind Sie sicher, dass Sie dieses Element aus Ihrem Dateisystem löschen möchten?';
|
||||
@override String get deleteMultipleWarning => 'Mehrere Elemente können gelöscht werden.';
|
||||
@override String get deleteFromServer => 'Vom Server löschen';
|
||||
@override String get confirmDelete => 'Dieses Medium und seine Dateien werden dauerhaft von Ihrem Server gelöscht. Dies kann nicht rückgängig gemacht werden.';
|
||||
@override String get deleteMultipleWarning => 'Dies umfasst alle Episoden und deren Dateien.';
|
||||
@override String get mediaDeletedSuccessfully => 'Medienelement erfolgreich gelöscht';
|
||||
@override String get mediaFailedToDelete => 'Löschen des Medienelements fehlgeschlagen';
|
||||
@override String get rate => 'Bewerten';
|
||||
@@ -1019,6 +1031,7 @@ class _TranslationsVideoSettingsDe implements TranslationsVideoSettingsEn {
|
||||
@override String get audioOutput => 'Audioausgabe';
|
||||
@override String get performanceOverlay => 'Leistungsanzeige';
|
||||
@override String get audioPassthrough => 'Audio-Durchleitung';
|
||||
@override String get audioNormalization => 'Audio-Normalisierung';
|
||||
}
|
||||
|
||||
// Path: externalPlayer
|
||||
@@ -1336,6 +1349,11 @@ extension on TranslationsDe {
|
||||
'common.dontAskAgain' => 'Nicht erneut fragen',
|
||||
'common.exit' => 'Beenden',
|
||||
'common.viewAll' => 'Alle anzeigen',
|
||||
'common.checkingNetwork' => 'Netzwerk wird geprüft...',
|
||||
'common.refreshingServers' => 'Server werden aktualisiert...',
|
||||
'common.loadingServers' => 'Server werden geladen...',
|
||||
'common.connectingToServers' => 'Verbindung zu Servern...',
|
||||
'common.startingOfflineMode' => 'Offlinemodus wird gestartet...',
|
||||
'screens.licenses' => 'Lizenzen',
|
||||
'screens.switchProfile' => 'Profil wechseln',
|
||||
'screens.subtitleStyling' => 'Untertitel-Stil',
|
||||
@@ -1394,6 +1412,8 @@ extension on TranslationsDe {
|
||||
'settings.alwaysKeepSidebarOpenDescription' => 'Seitenleiste bleibt erweitert und Inhaltsbereich passt sich an',
|
||||
'settings.showUnwatchedCount' => 'Anzahl nicht gesehener Folgen anzeigen',
|
||||
'settings.showUnwatchedCountDescription' => 'Zeigt die Anzahl nicht gesehener Episoden bei Serien und Staffeln an',
|
||||
'settings.hideSpoilers' => 'Spoiler für nicht gesehene Episoden verbergen',
|
||||
'settings.hideSpoilersDescription' => 'Vorschaubilder unscharf machen und Beschreibungen für noch nicht gesehene Episoden ausblenden',
|
||||
'settings.playerBackend' => 'Player-Backend',
|
||||
'settings.exoPlayer' => 'ExoPlayer (Empfohlen)',
|
||||
'settings.exoPlayerDescription' => 'Android-nativer Player mit besserer Hardware-Unterstützung',
|
||||
@@ -1469,6 +1489,8 @@ extension on TranslationsDe {
|
||||
'settings.discordRichPresenceDescription' => 'Zeige auf Discord, was du gerade schaust',
|
||||
'settings.matchContentFrameRate' => 'Inhalts-Bildrate anpassen',
|
||||
'settings.matchContentFrameRateDescription' => 'Bildwiederholfrequenz des Displays an den Videoinhalt anpassen, reduziert Ruckeln und spart Akku',
|
||||
'settings.tunneledPlayback' => 'Tunneled Playback',
|
||||
'settings.tunneledPlaybackDescription' => 'Use hardware-accelerated video tunneling. Disable if you see a black screen with audio on HDR content',
|
||||
'settings.requireProfileSelectionOnOpen' => 'Profil beim Öffnen abfragen',
|
||||
'settings.requireProfileSelectionOnOpenDescription' => 'Profilauswahl bei jedem Öffnen der App anzeigen',
|
||||
'settings.confirmExitOnBack' => 'Vor dem Beenden bestätigen',
|
||||
@@ -1531,8 +1553,9 @@ extension on TranslationsDe {
|
||||
'mediaMenu.goToSeason' => 'Zur Staffel',
|
||||
'mediaMenu.shufflePlay' => 'Zufallswiedergabe',
|
||||
'mediaMenu.fileInfo' => 'Dateiinfo',
|
||||
'mediaMenu.confirmDelete' => 'Sind Sie sicher, dass Sie dieses Element aus Ihrem Dateisystem löschen möchten?',
|
||||
'mediaMenu.deleteMultipleWarning' => 'Mehrere Elemente können gelöscht werden.',
|
||||
'mediaMenu.deleteFromServer' => 'Vom Server löschen',
|
||||
'mediaMenu.confirmDelete' => 'Dieses Medium und seine Dateien werden dauerhaft von Ihrem Server gelöscht. Dies kann nicht rückgängig gemacht werden.',
|
||||
'mediaMenu.deleteMultipleWarning' => 'Dies umfasst alle Episoden und deren Dateien.',
|
||||
'mediaMenu.mediaDeletedSuccessfully' => 'Medienelement erfolgreich gelöscht',
|
||||
'mediaMenu.mediaFailedToDelete' => 'Löschen des Medienelements fehlgeschlagen',
|
||||
'mediaMenu.rate' => 'Bewerten',
|
||||
@@ -2005,6 +2028,7 @@ extension on TranslationsDe {
|
||||
'videoSettings.audioOutput' => 'Audioausgabe',
|
||||
'videoSettings.performanceOverlay' => 'Leistungsanzeige',
|
||||
'videoSettings.audioPassthrough' => 'Audio-Durchleitung',
|
||||
'videoSettings.audioNormalization' => 'Audio-Normalisierung',
|
||||
'externalPlayer.title' => 'Externer Player',
|
||||
'externalPlayer.useExternalPlayer' => 'Externen Player verwenden',
|
||||
'externalPlayer.useExternalPlayerDescription' => 'Videos in einer externen App statt im integrierten Player öffnen',
|
||||
|
||||
@@ -252,6 +252,21 @@ class TranslationsCommonEn {
|
||||
|
||||
/// en: 'View All'
|
||||
String get viewAll => 'View All';
|
||||
|
||||
/// en: 'Checking network...'
|
||||
String get checkingNetwork => 'Checking network...';
|
||||
|
||||
/// en: 'Refreshing servers...'
|
||||
String get refreshingServers => 'Refreshing servers...';
|
||||
|
||||
/// en: 'Loading servers...'
|
||||
String get loadingServers => 'Loading servers...';
|
||||
|
||||
/// en: 'Connecting to servers...'
|
||||
String get connectingToServers => 'Connecting to servers...';
|
||||
|
||||
/// en: 'Starting offline mode...'
|
||||
String get startingOfflineMode => 'Starting offline mode...';
|
||||
}
|
||||
|
||||
// Path: screens
|
||||
@@ -454,6 +469,12 @@ class TranslationsSettingsEn {
|
||||
/// en: 'Display unwatched episode count on shows and seasons'
|
||||
String get showUnwatchedCountDescription => 'Display unwatched episode count on shows and seasons';
|
||||
|
||||
/// en: 'Hide Spoilers for Unwatched Episodes'
|
||||
String get hideSpoilers => 'Hide Spoilers for Unwatched Episodes';
|
||||
|
||||
/// en: 'Blur thumbnails and hide descriptions for episodes you haven\'t watched yet'
|
||||
String get hideSpoilersDescription => 'Blur thumbnails and hide descriptions for episodes you haven\'t watched yet';
|
||||
|
||||
/// en: 'Player Backend'
|
||||
String get playerBackend => 'Player Backend';
|
||||
|
||||
@@ -673,12 +694,24 @@ class TranslationsSettingsEn {
|
||||
/// en: 'Show what you're watching on Discord'
|
||||
String get discordRichPresenceDescription => 'Show what you\'re watching on Discord';
|
||||
|
||||
/// en: 'Auto Picture-in-Picture'
|
||||
String get autoPip => 'Auto Picture-in-Picture';
|
||||
|
||||
/// en: 'Automatically enter picture-in-picture when leaving the app during playback'
|
||||
String get autoPipDescription => 'Automatically enter picture-in-picture when leaving the app during playback';
|
||||
|
||||
/// en: 'Match Content Frame Rate'
|
||||
String get matchContentFrameRate => 'Match Content Frame Rate';
|
||||
|
||||
/// en: 'Adjust display refresh rate to match video content, reducing judder and saving battery'
|
||||
String get matchContentFrameRateDescription => 'Adjust display refresh rate to match video content, reducing judder and saving battery';
|
||||
|
||||
/// en: 'Tunneled Playback'
|
||||
String get tunneledPlayback => 'Tunneled Playback';
|
||||
|
||||
/// en: 'Use hardware-accelerated video tunneling. Disable if you see a black screen with audio on HDR content'
|
||||
String get tunneledPlaybackDescription => 'Use hardware-accelerated video tunneling. Disable if you see a black screen with audio on HDR content';
|
||||
|
||||
/// en: 'Ask for profile on app open'
|
||||
String get requireProfileSelectionOnOpen => 'Ask for profile on app open';
|
||||
|
||||
@@ -855,11 +888,14 @@ class TranslationsMediaMenuEn {
|
||||
/// en: 'File Info'
|
||||
String get fileInfo => 'File Info';
|
||||
|
||||
/// en: 'Are you sure you want to delete this item from your filesystem?'
|
||||
String get confirmDelete => 'Are you sure you want to delete this item from your filesystem?';
|
||||
/// en: 'Delete from server'
|
||||
String get deleteFromServer => 'Delete from server';
|
||||
|
||||
/// en: 'Multiple items may be deleted.'
|
||||
String get deleteMultipleWarning => 'Multiple items may be deleted.';
|
||||
/// en: 'This will permanently delete this media and its files from your server. This cannot be undone.'
|
||||
String get confirmDelete => 'This will permanently delete this media and its files from your server. This cannot be undone.';
|
||||
|
||||
/// en: 'This includes all episodes and their files.'
|
||||
String get deleteMultipleWarning => 'This includes all episodes and their files.';
|
||||
|
||||
/// en: 'Media item deleted successfully'
|
||||
String get mediaDeletedSuccessfully => 'Media item deleted successfully';
|
||||
@@ -2252,6 +2288,9 @@ class TranslationsVideoSettingsEn {
|
||||
|
||||
/// en: 'Audio Passthrough'
|
||||
String get audioPassthrough => 'Audio Passthrough';
|
||||
|
||||
/// en: 'Audio Normalization'
|
||||
String get audioNormalization => 'Audio Normalization';
|
||||
}
|
||||
|
||||
// Path: externalPlayer
|
||||
@@ -2924,6 +2963,11 @@ extension on Translations {
|
||||
'common.dontAskAgain' => 'Don\'t ask again',
|
||||
'common.exit' => 'Exit',
|
||||
'common.viewAll' => 'View All',
|
||||
'common.checkingNetwork' => 'Checking network...',
|
||||
'common.refreshingServers' => 'Refreshing servers...',
|
||||
'common.loadingServers' => 'Loading servers...',
|
||||
'common.connectingToServers' => 'Connecting to servers...',
|
||||
'common.startingOfflineMode' => 'Starting offline mode...',
|
||||
'screens.licenses' => 'Licenses',
|
||||
'screens.switchProfile' => 'Switch Profile',
|
||||
'screens.subtitleStyling' => 'Subtitle Styling',
|
||||
@@ -2982,6 +3026,8 @@ extension on Translations {
|
||||
'settings.alwaysKeepSidebarOpenDescription' => 'Sidebar stays expanded and content area adjusts to fit',
|
||||
'settings.showUnwatchedCount' => 'Show Unwatched Count',
|
||||
'settings.showUnwatchedCountDescription' => 'Display unwatched episode count on shows and seasons',
|
||||
'settings.hideSpoilers' => 'Hide Spoilers for Unwatched Episodes',
|
||||
'settings.hideSpoilersDescription' => 'Blur thumbnails and hide descriptions for episodes you haven\'t watched yet',
|
||||
'settings.playerBackend' => 'Player Backend',
|
||||
'settings.exoPlayer' => 'ExoPlayer (Recommended)',
|
||||
'settings.exoPlayerDescription' => 'Android native player with better hardware support',
|
||||
@@ -3055,8 +3101,12 @@ extension on Translations {
|
||||
'settings.maxVolumePercent' => ({required Object percent}) => '${percent}%',
|
||||
'settings.discordRichPresence' => 'Discord Rich Presence',
|
||||
'settings.discordRichPresenceDescription' => 'Show what you\'re watching on Discord',
|
||||
'settings.autoPip' => 'Auto Picture-in-Picture',
|
||||
'settings.autoPipDescription' => 'Automatically enter picture-in-picture when leaving the app during playback',
|
||||
'settings.matchContentFrameRate' => 'Match Content Frame Rate',
|
||||
'settings.matchContentFrameRateDescription' => 'Adjust display refresh rate to match video content, reducing judder and saving battery',
|
||||
'settings.tunneledPlayback' => 'Tunneled Playback',
|
||||
'settings.tunneledPlaybackDescription' => 'Use hardware-accelerated video tunneling. Disable if you see a black screen with audio on HDR content',
|
||||
'settings.requireProfileSelectionOnOpen' => 'Ask for profile on app open',
|
||||
'settings.requireProfileSelectionOnOpenDescription' => 'Show profile selection every time the app is opened',
|
||||
'settings.confirmExitOnBack' => 'Confirm before exiting',
|
||||
@@ -3119,8 +3169,9 @@ extension on Translations {
|
||||
'mediaMenu.goToSeason' => 'Go to season',
|
||||
'mediaMenu.shufflePlay' => 'Shuffle Play',
|
||||
'mediaMenu.fileInfo' => 'File Info',
|
||||
'mediaMenu.confirmDelete' => 'Are you sure you want to delete this item from your filesystem?',
|
||||
'mediaMenu.deleteMultipleWarning' => 'Multiple items may be deleted.',
|
||||
'mediaMenu.deleteFromServer' => 'Delete from server',
|
||||
'mediaMenu.confirmDelete' => 'This will permanently delete this media and its files from your server. This cannot be undone.',
|
||||
'mediaMenu.deleteMultipleWarning' => 'This includes all episodes and their files.',
|
||||
'mediaMenu.mediaDeletedSuccessfully' => 'Media item deleted successfully',
|
||||
'mediaMenu.mediaFailedToDelete' => 'Failed to delete media item',
|
||||
'mediaMenu.rate' => 'Rate',
|
||||
@@ -3593,6 +3644,7 @@ extension on Translations {
|
||||
'videoSettings.audioOutput' => 'Audio Output',
|
||||
'videoSettings.performanceOverlay' => 'Performance Overlay',
|
||||
'videoSettings.audioPassthrough' => 'Audio Passthrough',
|
||||
'videoSettings.audioNormalization' => 'Audio Normalization',
|
||||
'externalPlayer.title' => 'External Player',
|
||||
'externalPlayer.useExternalPlayer' => 'Use External Player',
|
||||
'externalPlayer.useExternalPlayerDescription' => 'Open videos in an external app instead of the built-in player',
|
||||
|
||||
@@ -151,6 +151,11 @@ class _TranslationsCommonEs implements TranslationsCommonEn {
|
||||
@override String get dontAskAgain => 'No volver a preguntar';
|
||||
@override String get exit => 'Salir';
|
||||
@override String get viewAll => 'Ver todo';
|
||||
@override String get checkingNetwork => 'Comprobando red...';
|
||||
@override String get refreshingServers => 'Actualizando servidores...';
|
||||
@override String get loadingServers => 'Cargando servidores...';
|
||||
@override String get connectingToServers => 'Conectando a servidores...';
|
||||
@override String get startingOfflineMode => 'Iniciando modo sin conexión...';
|
||||
}
|
||||
|
||||
// Path: screens
|
||||
@@ -236,6 +241,8 @@ class _TranslationsSettingsEs implements TranslationsSettingsEn {
|
||||
@override String get alwaysKeepSidebarOpenDescription => 'La barra lateral permanece expandida y el área de contenido se ajusta para adaptarse';
|
||||
@override String get showUnwatchedCount => 'Mostrar conteo de no vistos';
|
||||
@override String get showUnwatchedCountDescription => 'Mostrar el conteo de episodios no vistos en series y temporadas';
|
||||
@override String get hideSpoilers => 'Ocultar spoilers de episodios no vistos';
|
||||
@override String get hideSpoilersDescription => 'Difuminar miniaturas y ocultar descripciones de episodios que aún no has visto';
|
||||
@override String get playerBackend => 'Reproductor';
|
||||
@override String get exoPlayer => 'ExoPlayer (Recomendado)';
|
||||
@override String get exoPlayerDescription => 'Reproductor nativo de Android con mejor soporte de hardware';
|
||||
@@ -309,8 +316,12 @@ class _TranslationsSettingsEs implements TranslationsSettingsEn {
|
||||
@override String maxVolumePercent({required Object percent}) => '${percent}%';
|
||||
@override String get discordRichPresence => 'Presencia de Discord';
|
||||
@override String get discordRichPresenceDescription => 'Mostrar lo que estás viendo en Discord';
|
||||
@override String get autoPip => 'Imagen en imagen automática';
|
||||
@override String get autoPipDescription => 'Activar automáticamente imagen en imagen al salir de la app durante la reproducción';
|
||||
@override String get matchContentFrameRate => 'Ajustar frecuencia de actualización';
|
||||
@override String get matchContentFrameRateDescription => 'Ajustar la frecuencia de actualización de la pantalla para que coincida con el video, reduciendo tirones y ahorrando batería';
|
||||
@override String get tunneledPlayback => 'Tunneled Playback';
|
||||
@override String get tunneledPlaybackDescription => 'Use hardware-accelerated video tunneling. Disable if you see a black screen with audio on HDR content';
|
||||
@override String get requireProfileSelectionOnOpen => 'Pedir perfil al abrir la app';
|
||||
@override String get requireProfileSelectionOnOpenDescription => 'Mostrar selección de perfil cada vez que se abre la aplicación';
|
||||
@override String get confirmExitOnBack => 'Confirmar antes de salir';
|
||||
@@ -400,8 +411,9 @@ class _TranslationsMediaMenuEs implements TranslationsMediaMenuEn {
|
||||
@override String get goToSeason => 'Ir a la temporada';
|
||||
@override String get shufflePlay => 'Reproducción Aleatoria';
|
||||
@override String get fileInfo => 'Información del Archivo';
|
||||
@override String get confirmDelete => '¿Estás seguro de que quieres eliminar este elemento de tu sistema de archivos?';
|
||||
@override String get deleteMultipleWarning => 'Es posible que se eliminen varios elementos.';
|
||||
@override String get deleteFromServer => 'Eliminar del servidor';
|
||||
@override String get confirmDelete => 'Esto eliminará permanentemente este contenido y sus archivos de tu servidor. Esta acción no se puede deshacer.';
|
||||
@override String get deleteMultipleWarning => 'Esto incluye todos los episodios y sus archivos.';
|
||||
@override String get mediaDeletedSuccessfully => 'Elemento multimedia eliminado con éxito';
|
||||
@override String get mediaFailedToDelete => 'Error al eliminar el elemento multimedia';
|
||||
@override String get rate => 'Calificar';
|
||||
@@ -1019,6 +1031,7 @@ class _TranslationsVideoSettingsEs implements TranslationsVideoSettingsEn {
|
||||
@override String get audioOutput => 'Salida de audio';
|
||||
@override String get performanceOverlay => 'Indicador de rendimiento';
|
||||
@override String get audioPassthrough => 'Audio Passthrough';
|
||||
@override String get audioNormalization => 'Normalización de audio';
|
||||
}
|
||||
|
||||
// Path: externalPlayer
|
||||
@@ -1336,6 +1349,11 @@ extension on TranslationsEs {
|
||||
'common.dontAskAgain' => 'No volver a preguntar',
|
||||
'common.exit' => 'Salir',
|
||||
'common.viewAll' => 'Ver todo',
|
||||
'common.checkingNetwork' => 'Comprobando red...',
|
||||
'common.refreshingServers' => 'Actualizando servidores...',
|
||||
'common.loadingServers' => 'Cargando servidores...',
|
||||
'common.connectingToServers' => 'Conectando a servidores...',
|
||||
'common.startingOfflineMode' => 'Iniciando modo sin conexión...',
|
||||
'screens.licenses' => 'Licencias',
|
||||
'screens.switchProfile' => 'Cambiar Perfil',
|
||||
'screens.subtitleStyling' => 'Estilo de Subtítulos',
|
||||
@@ -1394,6 +1412,8 @@ extension on TranslationsEs {
|
||||
'settings.alwaysKeepSidebarOpenDescription' => 'La barra lateral permanece expandida y el área de contenido se ajusta para adaptarse',
|
||||
'settings.showUnwatchedCount' => 'Mostrar conteo de no vistos',
|
||||
'settings.showUnwatchedCountDescription' => 'Mostrar el conteo de episodios no vistos en series y temporadas',
|
||||
'settings.hideSpoilers' => 'Ocultar spoilers de episodios no vistos',
|
||||
'settings.hideSpoilersDescription' => 'Difuminar miniaturas y ocultar descripciones de episodios que aún no has visto',
|
||||
'settings.playerBackend' => 'Reproductor',
|
||||
'settings.exoPlayer' => 'ExoPlayer (Recomendado)',
|
||||
'settings.exoPlayerDescription' => 'Reproductor nativo de Android con mejor soporte de hardware',
|
||||
@@ -1469,6 +1489,8 @@ extension on TranslationsEs {
|
||||
'settings.discordRichPresenceDescription' => 'Mostrar lo que estás viendo en Discord',
|
||||
'settings.matchContentFrameRate' => 'Ajustar frecuencia de actualización',
|
||||
'settings.matchContentFrameRateDescription' => 'Ajustar la frecuencia de actualización de la pantalla para que coincida con el video, reduciendo tirones y ahorrando batería',
|
||||
'settings.tunneledPlayback' => 'Tunneled Playback',
|
||||
'settings.tunneledPlaybackDescription' => 'Use hardware-accelerated video tunneling. Disable if you see a black screen with audio on HDR content',
|
||||
'settings.requireProfileSelectionOnOpen' => 'Pedir perfil al abrir la app',
|
||||
'settings.requireProfileSelectionOnOpenDescription' => 'Mostrar selección de perfil cada vez que se abre la aplicación',
|
||||
'settings.confirmExitOnBack' => 'Confirmar antes de salir',
|
||||
@@ -1531,8 +1553,9 @@ extension on TranslationsEs {
|
||||
'mediaMenu.goToSeason' => 'Ir a la temporada',
|
||||
'mediaMenu.shufflePlay' => 'Reproducción Aleatoria',
|
||||
'mediaMenu.fileInfo' => 'Información del Archivo',
|
||||
'mediaMenu.confirmDelete' => '¿Estás seguro de que quieres eliminar este elemento de tu sistema de archivos?',
|
||||
'mediaMenu.deleteMultipleWarning' => 'Es posible que se eliminen varios elementos.',
|
||||
'mediaMenu.deleteFromServer' => 'Eliminar del servidor',
|
||||
'mediaMenu.confirmDelete' => 'Esto eliminará permanentemente este contenido y sus archivos de tu servidor. Esta acción no se puede deshacer.',
|
||||
'mediaMenu.deleteMultipleWarning' => 'Esto incluye todos los episodios y sus archivos.',
|
||||
'mediaMenu.mediaDeletedSuccessfully' => 'Elemento multimedia eliminado con éxito',
|
||||
'mediaMenu.mediaFailedToDelete' => 'Error al eliminar el elemento multimedia',
|
||||
'mediaMenu.rate' => 'Calificar',
|
||||
@@ -2005,6 +2028,7 @@ extension on TranslationsEs {
|
||||
'videoSettings.audioOutput' => 'Salida de audio',
|
||||
'videoSettings.performanceOverlay' => 'Indicador de rendimiento',
|
||||
'videoSettings.audioPassthrough' => 'Audio Passthrough',
|
||||
'videoSettings.audioNormalization' => 'Normalización de audio',
|
||||
'externalPlayer.title' => 'Reproductor externo',
|
||||
'externalPlayer.useExternalPlayer' => 'Usar reproductor externo',
|
||||
'externalPlayer.useExternalPlayerDescription' => 'Abrir vídeos en una app externa en lugar del reproductor integrado',
|
||||
|
||||
@@ -151,6 +151,11 @@ class _TranslationsCommonFr implements TranslationsCommonEn {
|
||||
@override String get dontAskAgain => 'Ne plus demander';
|
||||
@override String get exit => 'Quitter';
|
||||
@override String get viewAll => 'Tout afficher';
|
||||
@override String get checkingNetwork => 'Vérification du réseau...';
|
||||
@override String get refreshingServers => 'Actualisation des serveurs...';
|
||||
@override String get loadingServers => 'Chargement des serveurs...';
|
||||
@override String get connectingToServers => 'Connexion aux serveurs...';
|
||||
@override String get startingOfflineMode => 'Démarrage en mode hors-ligne...';
|
||||
}
|
||||
|
||||
// Path: screens
|
||||
@@ -236,6 +241,8 @@ class _TranslationsSettingsFr implements TranslationsSettingsEn {
|
||||
@override String get alwaysKeepSidebarOpenDescription => 'La barre latérale reste étendue et la zone de contenu s\'adapte';
|
||||
@override String get showUnwatchedCount => 'Afficher le nombre non visionné';
|
||||
@override String get showUnwatchedCountDescription => 'Afficher le nombre d\'épisodes non visionnés pour les séries et saisons';
|
||||
@override String get hideSpoilers => 'Masquer les spoilers des épisodes non vus';
|
||||
@override String get hideSpoilersDescription => 'Flouter les miniatures et masquer les descriptions des épisodes que vous n\'avez pas encore regardés';
|
||||
@override String get playerBackend => 'Moteur de lecture';
|
||||
@override String get exoPlayer => 'ExoPlayer (Recommandé)';
|
||||
@override String get exoPlayerDescription => 'Lecteur natif Android avec meilleur support matériel';
|
||||
@@ -309,8 +316,12 @@ class _TranslationsSettingsFr implements TranslationsSettingsEn {
|
||||
@override String maxVolumePercent({required Object percent}) => '${percent}%';
|
||||
@override String get discordRichPresence => 'Discord Rich Presence';
|
||||
@override String get discordRichPresenceDescription => 'Montrez ce que vous regardez sur Discord';
|
||||
@override String get autoPip => 'Image dans l\'image automatique';
|
||||
@override String get autoPipDescription => 'Activer automatiquement l\'image dans l\'image en quittant l\'application pendant la lecture';
|
||||
@override String get matchContentFrameRate => 'Fréquence d\'images du contenu correspondant';
|
||||
@override String get matchContentFrameRateDescription => 'Ajustez la fréquence de rafraîchissement de l\'écran en fonction du contenu vidéo, ce qui réduit les saccades et économise la batterie';
|
||||
@override String get tunneledPlayback => 'Tunneled Playback';
|
||||
@override String get tunneledPlaybackDescription => 'Use hardware-accelerated video tunneling. Disable if you see a black screen with audio on HDR content';
|
||||
@override String get requireProfileSelectionOnOpen => 'Demander le profil à l\'ouverture';
|
||||
@override String get requireProfileSelectionOnOpenDescription => 'Afficher la sélection de profil à chaque ouverture de l\'application';
|
||||
@override String get confirmExitOnBack => 'Confirmer avant de quitter';
|
||||
@@ -400,8 +411,9 @@ class _TranslationsMediaMenuFr implements TranslationsMediaMenuEn {
|
||||
@override String get goToSeason => 'Aller à la saison';
|
||||
@override String get shufflePlay => 'Lecture aléatoire';
|
||||
@override String get fileInfo => 'Informations sur le fichier';
|
||||
@override String get confirmDelete => 'Êtes-vous sûr de vouloir supprimer cet élément de votre système de fichiers?';
|
||||
@override String get deleteMultipleWarning => 'Plusieurs éléments peuvent être supprimés.';
|
||||
@override String get deleteFromServer => 'Supprimer du serveur';
|
||||
@override String get confirmDelete => 'Cela supprimera définitivement ce média et ses fichiers de votre serveur. Cette action est irréversible.';
|
||||
@override String get deleteMultipleWarning => 'Cela inclut tous les épisodes et leurs fichiers.';
|
||||
@override String get mediaDeletedSuccessfully => 'Élément média supprimé avec succès';
|
||||
@override String get mediaFailedToDelete => 'Échec de la suppression de l\'élément média';
|
||||
@override String get rate => 'Noter';
|
||||
@@ -1019,6 +1031,7 @@ class _TranslationsVideoSettingsFr implements TranslationsVideoSettingsEn {
|
||||
@override String get audioOutput => 'Sortie audio';
|
||||
@override String get performanceOverlay => 'Superposition de performance';
|
||||
@override String get audioPassthrough => 'Audio Pass-Through';
|
||||
@override String get audioNormalization => 'Normalisation audio';
|
||||
}
|
||||
|
||||
// Path: externalPlayer
|
||||
@@ -1336,6 +1349,11 @@ extension on TranslationsFr {
|
||||
'common.dontAskAgain' => 'Ne plus demander',
|
||||
'common.exit' => 'Quitter',
|
||||
'common.viewAll' => 'Tout afficher',
|
||||
'common.checkingNetwork' => 'Vérification du réseau...',
|
||||
'common.refreshingServers' => 'Actualisation des serveurs...',
|
||||
'common.loadingServers' => 'Chargement des serveurs...',
|
||||
'common.connectingToServers' => 'Connexion aux serveurs...',
|
||||
'common.startingOfflineMode' => 'Démarrage en mode hors-ligne...',
|
||||
'screens.licenses' => 'Licenses',
|
||||
'screens.switchProfile' => 'Changer de profil',
|
||||
'screens.subtitleStyling' => 'Configuration des sous-titres',
|
||||
@@ -1394,6 +1412,8 @@ extension on TranslationsFr {
|
||||
'settings.alwaysKeepSidebarOpenDescription' => 'La barre latérale reste étendue et la zone de contenu s\'adapte',
|
||||
'settings.showUnwatchedCount' => 'Afficher le nombre non visionné',
|
||||
'settings.showUnwatchedCountDescription' => 'Afficher le nombre d\'épisodes non visionnés pour les séries et saisons',
|
||||
'settings.hideSpoilers' => 'Masquer les spoilers des épisodes non vus',
|
||||
'settings.hideSpoilersDescription' => 'Flouter les miniatures et masquer les descriptions des épisodes que vous n\'avez pas encore regardés',
|
||||
'settings.playerBackend' => 'Moteur de lecture',
|
||||
'settings.exoPlayer' => 'ExoPlayer (Recommandé)',
|
||||
'settings.exoPlayerDescription' => 'Lecteur natif Android avec meilleur support matériel',
|
||||
@@ -1469,6 +1489,8 @@ extension on TranslationsFr {
|
||||
'settings.discordRichPresenceDescription' => 'Montrez ce que vous regardez sur Discord',
|
||||
'settings.matchContentFrameRate' => 'Fréquence d\'images du contenu correspondant',
|
||||
'settings.matchContentFrameRateDescription' => 'Ajustez la fréquence de rafraîchissement de l\'écran en fonction du contenu vidéo, ce qui réduit les saccades et économise la batterie',
|
||||
'settings.tunneledPlayback' => 'Tunneled Playback',
|
||||
'settings.tunneledPlaybackDescription' => 'Use hardware-accelerated video tunneling. Disable if you see a black screen with audio on HDR content',
|
||||
'settings.requireProfileSelectionOnOpen' => 'Demander le profil à l\'ouverture',
|
||||
'settings.requireProfileSelectionOnOpenDescription' => 'Afficher la sélection de profil à chaque ouverture de l\'application',
|
||||
'settings.confirmExitOnBack' => 'Confirmer avant de quitter',
|
||||
@@ -1531,8 +1553,9 @@ extension on TranslationsFr {
|
||||
'mediaMenu.goToSeason' => 'Aller à la saison',
|
||||
'mediaMenu.shufflePlay' => 'Lecture aléatoire',
|
||||
'mediaMenu.fileInfo' => 'Informations sur le fichier',
|
||||
'mediaMenu.confirmDelete' => 'Êtes-vous sûr de vouloir supprimer cet élément de votre système de fichiers?',
|
||||
'mediaMenu.deleteMultipleWarning' => 'Plusieurs éléments peuvent être supprimés.',
|
||||
'mediaMenu.deleteFromServer' => 'Supprimer du serveur',
|
||||
'mediaMenu.confirmDelete' => 'Cela supprimera définitivement ce média et ses fichiers de votre serveur. Cette action est irréversible.',
|
||||
'mediaMenu.deleteMultipleWarning' => 'Cela inclut tous les épisodes et leurs fichiers.',
|
||||
'mediaMenu.mediaDeletedSuccessfully' => 'Élément média supprimé avec succès',
|
||||
'mediaMenu.mediaFailedToDelete' => 'Échec de la suppression de l\'élément média',
|
||||
'mediaMenu.rate' => 'Noter',
|
||||
@@ -2005,6 +2028,7 @@ extension on TranslationsFr {
|
||||
'videoSettings.audioOutput' => 'Sortie audio',
|
||||
'videoSettings.performanceOverlay' => 'Superposition de performance',
|
||||
'videoSettings.audioPassthrough' => 'Audio Pass-Through',
|
||||
'videoSettings.audioNormalization' => 'Normalisation audio',
|
||||
'externalPlayer.title' => 'Lecteur externe',
|
||||
'externalPlayer.useExternalPlayer' => 'Utiliser un lecteur externe',
|
||||
'externalPlayer.useExternalPlayerDescription' => 'Ouvrir les vidéos dans une application externe au lieu du lecteur intégré',
|
||||
|
||||
@@ -151,6 +151,11 @@ class _TranslationsCommonIt implements TranslationsCommonEn {
|
||||
@override String get dontAskAgain => 'Non chiedere più';
|
||||
@override String get exit => 'Esci';
|
||||
@override String get viewAll => 'Mostra tutto';
|
||||
@override String get checkingNetwork => 'Verifica rete...';
|
||||
@override String get refreshingServers => 'Aggiornamento server...';
|
||||
@override String get loadingServers => 'Caricamento server...';
|
||||
@override String get connectingToServers => 'Connessione ai server...';
|
||||
@override String get startingOfflineMode => 'Avvio modalità offline...';
|
||||
}
|
||||
|
||||
// Path: screens
|
||||
@@ -236,6 +241,8 @@ class _TranslationsSettingsIt implements TranslationsSettingsEn {
|
||||
@override String get alwaysKeepSidebarOpenDescription => 'La barra laterale rimane espansa e l\'area del contenuto si adatta';
|
||||
@override String get showUnwatchedCount => 'Mostra conteggio non visti';
|
||||
@override String get showUnwatchedCountDescription => 'Mostra il numero di episodi non visti per serie e stagioni';
|
||||
@override String get hideSpoilers => 'Nascondi spoiler per episodi non visti';
|
||||
@override String get hideSpoilersDescription => 'Sfoca le miniature e nascondi le descrizioni degli episodi che non hai ancora guardato';
|
||||
@override String get playerBackend => 'Motore di riproduzione';
|
||||
@override String get exoPlayer => 'ExoPlayer (Consigliato)';
|
||||
@override String get exoPlayerDescription => 'Lettore nativo Android con migliore supporto hardware';
|
||||
@@ -309,8 +316,12 @@ class _TranslationsSettingsIt implements TranslationsSettingsEn {
|
||||
@override String maxVolumePercent({required Object percent}) => '${percent}%';
|
||||
@override String get discordRichPresence => 'Discord Rich Presence';
|
||||
@override String get discordRichPresenceDescription => 'Mostra su Discord cosa stai guardando';
|
||||
@override String get autoPip => 'Picture-in-Picture automatico';
|
||||
@override String get autoPipDescription => 'Attiva automaticamente il picture-in-picture quando si esce dall\'app durante la riproduzione';
|
||||
@override String get matchContentFrameRate => 'Adatta frequenza fotogrammi';
|
||||
@override String get matchContentFrameRateDescription => 'Regola la frequenza di aggiornamento del display in base al contenuto video, riducendo i tremolii e risparmiando batteria';
|
||||
@override String get tunneledPlayback => 'Tunneled Playback';
|
||||
@override String get tunneledPlaybackDescription => 'Use hardware-accelerated video tunneling. Disable if you see a black screen with audio on HDR content';
|
||||
@override String get requireProfileSelectionOnOpen => 'Chiedi profilo all\'apertura';
|
||||
@override String get requireProfileSelectionOnOpenDescription => 'Mostra la selezione del profilo ogni volta che l\'app viene aperta';
|
||||
@override String get confirmExitOnBack => 'Conferma prima di uscire';
|
||||
@@ -400,8 +411,9 @@ class _TranslationsMediaMenuIt implements TranslationsMediaMenuEn {
|
||||
@override String get goToSeason => 'Vai alla stagione';
|
||||
@override String get shufflePlay => 'Riproduzione casuale';
|
||||
@override String get fileInfo => 'Info sul file';
|
||||
@override String get confirmDelete => 'Sei sicuro di voler eliminare questo elemento dal tuo filesystem?';
|
||||
@override String get deleteMultipleWarning => 'Potrebbero essere eliminati più elementi.';
|
||||
@override String get deleteFromServer => 'Elimina dal server';
|
||||
@override String get confirmDelete => 'Questo eliminerà permanentemente questo contenuto e i suoi file dal tuo server. Questa azione non può essere annullata.';
|
||||
@override String get deleteMultipleWarning => 'Questo include tutti gli episodi e i loro file.';
|
||||
@override String get mediaDeletedSuccessfully => 'Elemento multimediale eliminato con successo';
|
||||
@override String get mediaFailedToDelete => 'Impossibile eliminare l\'elemento multimediale';
|
||||
@override String get rate => 'Valuta';
|
||||
@@ -1019,6 +1031,7 @@ class _TranslationsVideoSettingsIt implements TranslationsVideoSettingsEn {
|
||||
@override String get audioOutput => 'Uscita audio';
|
||||
@override String get performanceOverlay => 'Overlay prestazioni';
|
||||
@override String get audioPassthrough => 'Audio Passthrough';
|
||||
@override String get audioNormalization => 'Normalizzazione audio';
|
||||
}
|
||||
|
||||
// Path: externalPlayer
|
||||
@@ -1336,6 +1349,11 @@ extension on TranslationsIt {
|
||||
'common.dontAskAgain' => 'Non chiedere più',
|
||||
'common.exit' => 'Esci',
|
||||
'common.viewAll' => 'Mostra tutto',
|
||||
'common.checkingNetwork' => 'Verifica rete...',
|
||||
'common.refreshingServers' => 'Aggiornamento server...',
|
||||
'common.loadingServers' => 'Caricamento server...',
|
||||
'common.connectingToServers' => 'Connessione ai server...',
|
||||
'common.startingOfflineMode' => 'Avvio modalità offline...',
|
||||
'screens.licenses' => 'Licenze',
|
||||
'screens.switchProfile' => 'Cambia profilo',
|
||||
'screens.subtitleStyling' => 'Stile sottotitoli',
|
||||
@@ -1394,6 +1412,8 @@ extension on TranslationsIt {
|
||||
'settings.alwaysKeepSidebarOpenDescription' => 'La barra laterale rimane espansa e l\'area del contenuto si adatta',
|
||||
'settings.showUnwatchedCount' => 'Mostra conteggio non visti',
|
||||
'settings.showUnwatchedCountDescription' => 'Mostra il numero di episodi non visti per serie e stagioni',
|
||||
'settings.hideSpoilers' => 'Nascondi spoiler per episodi non visti',
|
||||
'settings.hideSpoilersDescription' => 'Sfoca le miniature e nascondi le descrizioni degli episodi che non hai ancora guardato',
|
||||
'settings.playerBackend' => 'Motore di riproduzione',
|
||||
'settings.exoPlayer' => 'ExoPlayer (Consigliato)',
|
||||
'settings.exoPlayerDescription' => 'Lettore nativo Android con migliore supporto hardware',
|
||||
@@ -1469,6 +1489,8 @@ extension on TranslationsIt {
|
||||
'settings.discordRichPresenceDescription' => 'Mostra su Discord cosa stai guardando',
|
||||
'settings.matchContentFrameRate' => 'Adatta frequenza fotogrammi',
|
||||
'settings.matchContentFrameRateDescription' => 'Regola la frequenza di aggiornamento del display in base al contenuto video, riducendo i tremolii e risparmiando batteria',
|
||||
'settings.tunneledPlayback' => 'Tunneled Playback',
|
||||
'settings.tunneledPlaybackDescription' => 'Use hardware-accelerated video tunneling. Disable if you see a black screen with audio on HDR content',
|
||||
'settings.requireProfileSelectionOnOpen' => 'Chiedi profilo all\'apertura',
|
||||
'settings.requireProfileSelectionOnOpenDescription' => 'Mostra la selezione del profilo ogni volta che l\'app viene aperta',
|
||||
'settings.confirmExitOnBack' => 'Conferma prima di uscire',
|
||||
@@ -1531,8 +1553,9 @@ extension on TranslationsIt {
|
||||
'mediaMenu.goToSeason' => 'Vai alla stagione',
|
||||
'mediaMenu.shufflePlay' => 'Riproduzione casuale',
|
||||
'mediaMenu.fileInfo' => 'Info sul file',
|
||||
'mediaMenu.confirmDelete' => 'Sei sicuro di voler eliminare questo elemento dal tuo filesystem?',
|
||||
'mediaMenu.deleteMultipleWarning' => 'Potrebbero essere eliminati più elementi.',
|
||||
'mediaMenu.deleteFromServer' => 'Elimina dal server',
|
||||
'mediaMenu.confirmDelete' => 'Questo eliminerà permanentemente questo contenuto e i suoi file dal tuo server. Questa azione non può essere annullata.',
|
||||
'mediaMenu.deleteMultipleWarning' => 'Questo include tutti gli episodi e i loro file.',
|
||||
'mediaMenu.mediaDeletedSuccessfully' => 'Elemento multimediale eliminato con successo',
|
||||
'mediaMenu.mediaFailedToDelete' => 'Impossibile eliminare l\'elemento multimediale',
|
||||
'mediaMenu.rate' => 'Valuta',
|
||||
@@ -2005,6 +2028,7 @@ extension on TranslationsIt {
|
||||
'videoSettings.audioOutput' => 'Uscita audio',
|
||||
'videoSettings.performanceOverlay' => 'Overlay prestazioni',
|
||||
'videoSettings.audioPassthrough' => 'Audio Passthrough',
|
||||
'videoSettings.audioNormalization' => 'Normalizzazione audio',
|
||||
'externalPlayer.title' => 'Lettore esterno',
|
||||
'externalPlayer.useExternalPlayer' => 'Usa lettore esterno',
|
||||
'externalPlayer.useExternalPlayerDescription' => 'Apri i video in un\'app esterna invece del lettore integrato',
|
||||
|
||||
@@ -151,6 +151,11 @@ class _TranslationsCommonKo implements TranslationsCommonEn {
|
||||
@override String get dontAskAgain => '다시 묻지 않기';
|
||||
@override String get exit => '종료';
|
||||
@override String get viewAll => '모두 보기';
|
||||
@override String get checkingNetwork => '네트워크 확인 중...';
|
||||
@override String get refreshingServers => '서버 새로고침 중...';
|
||||
@override String get loadingServers => '서버 로딩 중...';
|
||||
@override String get connectingToServers => '서버 연결 중...';
|
||||
@override String get startingOfflineMode => '오프라인 모드 시작 중...';
|
||||
}
|
||||
|
||||
// Path: screens
|
||||
@@ -236,6 +241,8 @@ class _TranslationsSettingsKo implements TranslationsSettingsEn {
|
||||
@override String get alwaysKeepSidebarOpenDescription => '사이드바가 확장된 상태로 유지되고 콘텐츠 영역이 맞춰집니다';
|
||||
@override String get showUnwatchedCount => '미시청 수 표시';
|
||||
@override String get showUnwatchedCountDescription => '시리즈 및 시즌에 미시청 에피소드 수 표시';
|
||||
@override String get hideSpoilers => '미시청 에피소드 스포일러 숨기기';
|
||||
@override String get hideSpoilersDescription => '아직 시청하지 않은 에피소드의 썸네일을 흐리게 하고 설명을 숨깁니다';
|
||||
@override String get playerBackend => '플레이어 백엔드';
|
||||
@override String get exoPlayer => 'ExoPlayer (권장)';
|
||||
@override String get exoPlayerDescription => '더 나은 하드웨어 지원을 제공하는 Android 네이티브 플레이어';
|
||||
@@ -309,8 +316,12 @@ class _TranslationsSettingsKo implements TranslationsSettingsEn {
|
||||
@override String maxVolumePercent({required Object percent}) => '${percent}%';
|
||||
@override String get discordRichPresence => 'Discord Rich Presence';
|
||||
@override String get discordRichPresenceDescription => 'Discord에서 시청 중인 콘텐츠 표시';
|
||||
@override String get autoPip => '자동 PIP 모드';
|
||||
@override String get autoPipDescription => '재생 중 앱을 나갈 때 자동으로 PIP 모드로 전환';
|
||||
@override String get matchContentFrameRate => '콘텐츠 프레임 레이트 맞춤';
|
||||
@override String get matchContentFrameRateDescription => '비디오 콘텐츠에 맞게 디스플레이 주사율을 조정하여 떨림을 줄이고 배터리를 절약합니다';
|
||||
@override String get tunneledPlayback => 'Tunneled Playback';
|
||||
@override String get tunneledPlaybackDescription => 'Use hardware-accelerated video tunneling. Disable if you see a black screen with audio on HDR content';
|
||||
@override String get requireProfileSelectionOnOpen => '앱 실행 시 프로필 선택';
|
||||
@override String get requireProfileSelectionOnOpenDescription => '앱을 열 때마다 프로필 선택 화면을 표시합니다';
|
||||
@override String get confirmExitOnBack => '종료 전 확인';
|
||||
@@ -400,8 +411,9 @@ class _TranslationsMediaMenuKo implements TranslationsMediaMenuEn {
|
||||
@override String get goToSeason => '시즌으로 이동';
|
||||
@override String get shufflePlay => '무작위 재생';
|
||||
@override String get fileInfo => '파일 정보';
|
||||
@override String get confirmDelete => '파일 시스템에서 이 항목을 삭제하시겠습니까?';
|
||||
@override String get deleteMultipleWarning => '여러 항목이 삭제될 수 있습니다.';
|
||||
@override String get deleteFromServer => '서버에서 삭제';
|
||||
@override String get confirmDelete => '이 미디어와 파일이 서버에서 영구적으로 삭제됩니다. 이 작업은 취소할 수 없습니다.';
|
||||
@override String get deleteMultipleWarning => '모든 에피소드와 파일이 포함됩니다.';
|
||||
@override String get mediaDeletedSuccessfully => '미디어 항목이 성공적으로 삭제되었습니다';
|
||||
@override String get mediaFailedToDelete => '미디어 항목 삭제 실패';
|
||||
@override String get rate => '평가';
|
||||
@@ -1019,6 +1031,7 @@ class _TranslationsVideoSettingsKo implements TranslationsVideoSettingsEn {
|
||||
@override String get audioOutput => '오디오 출력';
|
||||
@override String get performanceOverlay => '성능 오버레이';
|
||||
@override String get audioPassthrough => '오디오 패스스루';
|
||||
@override String get audioNormalization => '오디오 정규화';
|
||||
}
|
||||
|
||||
// Path: externalPlayer
|
||||
@@ -1336,6 +1349,11 @@ extension on TranslationsKo {
|
||||
'common.dontAskAgain' => '다시 묻지 않기',
|
||||
'common.exit' => '종료',
|
||||
'common.viewAll' => '모두 보기',
|
||||
'common.checkingNetwork' => '네트워크 확인 중...',
|
||||
'common.refreshingServers' => '서버 새로고침 중...',
|
||||
'common.loadingServers' => '서버 로딩 중...',
|
||||
'common.connectingToServers' => '서버 연결 중...',
|
||||
'common.startingOfflineMode' => '오프라인 모드 시작 중...',
|
||||
'screens.licenses' => '라이선스',
|
||||
'screens.switchProfile' => '프로필 전환',
|
||||
'screens.subtitleStyling' => '자막 스타일 설정',
|
||||
@@ -1394,6 +1412,8 @@ extension on TranslationsKo {
|
||||
'settings.alwaysKeepSidebarOpenDescription' => '사이드바가 확장된 상태로 유지되고 콘텐츠 영역이 맞춰집니다',
|
||||
'settings.showUnwatchedCount' => '미시청 수 표시',
|
||||
'settings.showUnwatchedCountDescription' => '시리즈 및 시즌에 미시청 에피소드 수 표시',
|
||||
'settings.hideSpoilers' => '미시청 에피소드 스포일러 숨기기',
|
||||
'settings.hideSpoilersDescription' => '아직 시청하지 않은 에피소드의 썸네일을 흐리게 하고 설명을 숨깁니다',
|
||||
'settings.playerBackend' => '플레이어 백엔드',
|
||||
'settings.exoPlayer' => 'ExoPlayer (권장)',
|
||||
'settings.exoPlayerDescription' => '더 나은 하드웨어 지원을 제공하는 Android 네이티브 플레이어',
|
||||
@@ -1469,6 +1489,8 @@ extension on TranslationsKo {
|
||||
'settings.discordRichPresenceDescription' => 'Discord에서 시청 중인 콘텐츠 표시',
|
||||
'settings.matchContentFrameRate' => '콘텐츠 프레임 레이트 맞춤',
|
||||
'settings.matchContentFrameRateDescription' => '비디오 콘텐츠에 맞게 디스플레이 주사율을 조정하여 떨림을 줄이고 배터리를 절약합니다',
|
||||
'settings.tunneledPlayback' => 'Tunneled Playback',
|
||||
'settings.tunneledPlaybackDescription' => 'Use hardware-accelerated video tunneling. Disable if you see a black screen with audio on HDR content',
|
||||
'settings.requireProfileSelectionOnOpen' => '앱 실행 시 프로필 선택',
|
||||
'settings.requireProfileSelectionOnOpenDescription' => '앱을 열 때마다 프로필 선택 화면을 표시합니다',
|
||||
'settings.confirmExitOnBack' => '종료 전 확인',
|
||||
@@ -1531,8 +1553,9 @@ extension on TranslationsKo {
|
||||
'mediaMenu.goToSeason' => '시즌으로 이동',
|
||||
'mediaMenu.shufflePlay' => '무작위 재생',
|
||||
'mediaMenu.fileInfo' => '파일 정보',
|
||||
'mediaMenu.confirmDelete' => '파일 시스템에서 이 항목을 삭제하시겠습니까?',
|
||||
'mediaMenu.deleteMultipleWarning' => '여러 항목이 삭제될 수 있습니다.',
|
||||
'mediaMenu.deleteFromServer' => '서버에서 삭제',
|
||||
'mediaMenu.confirmDelete' => '이 미디어와 파일이 서버에서 영구적으로 삭제됩니다. 이 작업은 취소할 수 없습니다.',
|
||||
'mediaMenu.deleteMultipleWarning' => '모든 에피소드와 파일이 포함됩니다.',
|
||||
'mediaMenu.mediaDeletedSuccessfully' => '미디어 항목이 성공적으로 삭제되었습니다',
|
||||
'mediaMenu.mediaFailedToDelete' => '미디어 항목 삭제 실패',
|
||||
'mediaMenu.rate' => '평가',
|
||||
@@ -2005,6 +2028,7 @@ extension on TranslationsKo {
|
||||
'videoSettings.audioOutput' => '오디오 출력',
|
||||
'videoSettings.performanceOverlay' => '성능 오버레이',
|
||||
'videoSettings.audioPassthrough' => '오디오 패스스루',
|
||||
'videoSettings.audioNormalization' => '오디오 정규화',
|
||||
'externalPlayer.title' => '외부 플레이어',
|
||||
'externalPlayer.useExternalPlayer' => '외부 플레이어 사용',
|
||||
'externalPlayer.useExternalPlayerDescription' => '내장 플레이어 대신 외부 앱에서 동영상 열기',
|
||||
|
||||
@@ -151,6 +151,11 @@ class _TranslationsCommonNl implements TranslationsCommonEn {
|
||||
@override String get dontAskAgain => 'Niet meer vragen';
|
||||
@override String get exit => 'Afsluiten';
|
||||
@override String get viewAll => 'Alles weergeven';
|
||||
@override String get checkingNetwork => 'Netwerk controleren...';
|
||||
@override String get refreshingServers => 'Servers vernieuwen...';
|
||||
@override String get loadingServers => 'Servers laden...';
|
||||
@override String get connectingToServers => 'Verbinden met servers...';
|
||||
@override String get startingOfflineMode => 'Offlinemodus starten...';
|
||||
}
|
||||
|
||||
// Path: screens
|
||||
@@ -236,6 +241,8 @@ class _TranslationsSettingsNl implements TranslationsSettingsEn {
|
||||
@override String get alwaysKeepSidebarOpenDescription => 'Zijbalk blijft uitgevouwen en inhoudsgebied past zich aan';
|
||||
@override String get showUnwatchedCount => 'Aantal ongekeken tonen';
|
||||
@override String get showUnwatchedCountDescription => 'Toon aantal ongekeken afleveringen bij series en seizoenen';
|
||||
@override String get hideSpoilers => 'Spoilers voor ongekeken afleveringen verbergen';
|
||||
@override String get hideSpoilersDescription => 'Miniaturen vervagen en beschrijvingen verbergen voor afleveringen die je nog niet hebt gezien';
|
||||
@override String get playerBackend => 'Speler backend';
|
||||
@override String get exoPlayer => 'ExoPlayer (Aanbevolen)';
|
||||
@override String get exoPlayerDescription => 'Android-native speler met betere hardware-ondersteuning';
|
||||
@@ -309,8 +316,12 @@ class _TranslationsSettingsNl implements TranslationsSettingsEn {
|
||||
@override String maxVolumePercent({required Object percent}) => '${percent}%';
|
||||
@override String get discordRichPresence => 'Discord Rich Presence';
|
||||
@override String get discordRichPresenceDescription => 'Toon op Discord wat je aan het kijken bent';
|
||||
@override String get autoPip => 'Automatische beeld-in-beeld';
|
||||
@override String get autoPipDescription => 'Automatisch beeld-in-beeld activeren bij het verlaten van de app tijdens afspelen';
|
||||
@override String get matchContentFrameRate => 'Inhoudsframesnelheid afstemmen';
|
||||
@override String get matchContentFrameRateDescription => 'Pas de schermverversingssnelheid aan op de video-inhoud, vermindert haperingen en bespaart batterij';
|
||||
@override String get tunneledPlayback => 'Tunneled Playback';
|
||||
@override String get tunneledPlaybackDescription => 'Use hardware-accelerated video tunneling. Disable if you see a black screen with audio on HDR content';
|
||||
@override String get requireProfileSelectionOnOpen => 'Vraag om profiel bij openen';
|
||||
@override String get requireProfileSelectionOnOpenDescription => 'Toon profielselectie telkens wanneer de app wordt geopend';
|
||||
@override String get confirmExitOnBack => 'Bevestigen voor afsluiten';
|
||||
@@ -400,8 +411,9 @@ class _TranslationsMediaMenuNl implements TranslationsMediaMenuEn {
|
||||
@override String get goToSeason => 'Ga naar seizoen';
|
||||
@override String get shufflePlay => 'Willekeurig afspelen';
|
||||
@override String get fileInfo => 'Bestand info';
|
||||
@override String get confirmDelete => 'Weet je zeker dat je dit item van je bestandssysteem wilt verwijderen?';
|
||||
@override String get deleteMultipleWarning => 'Meerdere items kunnen worden verwijderd.';
|
||||
@override String get deleteFromServer => 'Verwijderen van server';
|
||||
@override String get confirmDelete => 'Dit zal deze media en de bijbehorende bestanden permanent van je server verwijderen. Dit kan niet ongedaan worden gemaakt.';
|
||||
@override String get deleteMultipleWarning => 'Dit omvat alle afleveringen en hun bestanden.';
|
||||
@override String get mediaDeletedSuccessfully => 'Media-item succesvol verwijderd';
|
||||
@override String get mediaFailedToDelete => 'Verwijderen van media-item mislukt';
|
||||
@override String get rate => 'Beoordelen';
|
||||
@@ -1019,6 +1031,7 @@ class _TranslationsVideoSettingsNl implements TranslationsVideoSettingsEn {
|
||||
@override String get audioOutput => 'Audio-uitvoer';
|
||||
@override String get performanceOverlay => 'Prestatie-overlay';
|
||||
@override String get audioPassthrough => 'Audio-doorvoer';
|
||||
@override String get audioNormalization => 'Audionormalisatie';
|
||||
}
|
||||
|
||||
// Path: externalPlayer
|
||||
@@ -1336,6 +1349,11 @@ extension on TranslationsNl {
|
||||
'common.dontAskAgain' => 'Niet meer vragen',
|
||||
'common.exit' => 'Afsluiten',
|
||||
'common.viewAll' => 'Alles weergeven',
|
||||
'common.checkingNetwork' => 'Netwerk controleren...',
|
||||
'common.refreshingServers' => 'Servers vernieuwen...',
|
||||
'common.loadingServers' => 'Servers laden...',
|
||||
'common.connectingToServers' => 'Verbinden met servers...',
|
||||
'common.startingOfflineMode' => 'Offlinemodus starten...',
|
||||
'screens.licenses' => 'Licenties',
|
||||
'screens.switchProfile' => 'Wissel van profiel',
|
||||
'screens.subtitleStyling' => 'Ondertitel opmaak',
|
||||
@@ -1394,6 +1412,8 @@ extension on TranslationsNl {
|
||||
'settings.alwaysKeepSidebarOpenDescription' => 'Zijbalk blijft uitgevouwen en inhoudsgebied past zich aan',
|
||||
'settings.showUnwatchedCount' => 'Aantal ongekeken tonen',
|
||||
'settings.showUnwatchedCountDescription' => 'Toon aantal ongekeken afleveringen bij series en seizoenen',
|
||||
'settings.hideSpoilers' => 'Spoilers voor ongekeken afleveringen verbergen',
|
||||
'settings.hideSpoilersDescription' => 'Miniaturen vervagen en beschrijvingen verbergen voor afleveringen die je nog niet hebt gezien',
|
||||
'settings.playerBackend' => 'Speler backend',
|
||||
'settings.exoPlayer' => 'ExoPlayer (Aanbevolen)',
|
||||
'settings.exoPlayerDescription' => 'Android-native speler met betere hardware-ondersteuning',
|
||||
@@ -1469,6 +1489,8 @@ extension on TranslationsNl {
|
||||
'settings.discordRichPresenceDescription' => 'Toon op Discord wat je aan het kijken bent',
|
||||
'settings.matchContentFrameRate' => 'Inhoudsframesnelheid afstemmen',
|
||||
'settings.matchContentFrameRateDescription' => 'Pas de schermverversingssnelheid aan op de video-inhoud, vermindert haperingen en bespaart batterij',
|
||||
'settings.tunneledPlayback' => 'Tunneled Playback',
|
||||
'settings.tunneledPlaybackDescription' => 'Use hardware-accelerated video tunneling. Disable if you see a black screen with audio on HDR content',
|
||||
'settings.requireProfileSelectionOnOpen' => 'Vraag om profiel bij openen',
|
||||
'settings.requireProfileSelectionOnOpenDescription' => 'Toon profielselectie telkens wanneer de app wordt geopend',
|
||||
'settings.confirmExitOnBack' => 'Bevestigen voor afsluiten',
|
||||
@@ -1531,8 +1553,9 @@ extension on TranslationsNl {
|
||||
'mediaMenu.goToSeason' => 'Ga naar seizoen',
|
||||
'mediaMenu.shufflePlay' => 'Willekeurig afspelen',
|
||||
'mediaMenu.fileInfo' => 'Bestand info',
|
||||
'mediaMenu.confirmDelete' => 'Weet je zeker dat je dit item van je bestandssysteem wilt verwijderen?',
|
||||
'mediaMenu.deleteMultipleWarning' => 'Meerdere items kunnen worden verwijderd.',
|
||||
'mediaMenu.deleteFromServer' => 'Verwijderen van server',
|
||||
'mediaMenu.confirmDelete' => 'Dit zal deze media en de bijbehorende bestanden permanent van je server verwijderen. Dit kan niet ongedaan worden gemaakt.',
|
||||
'mediaMenu.deleteMultipleWarning' => 'Dit omvat alle afleveringen en hun bestanden.',
|
||||
'mediaMenu.mediaDeletedSuccessfully' => 'Media-item succesvol verwijderd',
|
||||
'mediaMenu.mediaFailedToDelete' => 'Verwijderen van media-item mislukt',
|
||||
'mediaMenu.rate' => 'Beoordelen',
|
||||
@@ -2005,6 +2028,7 @@ extension on TranslationsNl {
|
||||
'videoSettings.audioOutput' => 'Audio-uitvoer',
|
||||
'videoSettings.performanceOverlay' => 'Prestatie-overlay',
|
||||
'videoSettings.audioPassthrough' => 'Audio-doorvoer',
|
||||
'videoSettings.audioNormalization' => 'Audionormalisatie',
|
||||
'externalPlayer.title' => 'Externe speler',
|
||||
'externalPlayer.useExternalPlayer' => 'Externe speler gebruiken',
|
||||
'externalPlayer.useExternalPlayerDescription' => 'Open video\'s in een externe app in plaats van de ingebouwde speler',
|
||||
|
||||
@@ -151,6 +151,11 @@ class _TranslationsCommonSv implements TranslationsCommonEn {
|
||||
@override String get dontAskAgain => 'Fråga inte igen';
|
||||
@override String get exit => 'Avsluta';
|
||||
@override String get viewAll => 'Visa alla';
|
||||
@override String get checkingNetwork => 'Kontrollerar nätverk...';
|
||||
@override String get refreshingServers => 'Uppdaterar servrar...';
|
||||
@override String get loadingServers => 'Laddar servrar...';
|
||||
@override String get connectingToServers => 'Ansluter till servrar...';
|
||||
@override String get startingOfflineMode => 'Startar offlineläge...';
|
||||
}
|
||||
|
||||
// Path: screens
|
||||
@@ -236,6 +241,8 @@ class _TranslationsSettingsSv implements TranslationsSettingsEn {
|
||||
@override String get alwaysKeepSidebarOpenDescription => 'Sidofältet förblir expanderat och innehållsytan anpassas';
|
||||
@override String get showUnwatchedCount => 'Visa antal osedda';
|
||||
@override String get showUnwatchedCountDescription => 'Visa antal osedda avsnitt för serier och säsonger';
|
||||
@override String get hideSpoilers => 'Dölj spoilers för osedda avsnitt';
|
||||
@override String get hideSpoilersDescription => 'Gör miniatyrer suddiga och dölj beskrivningar för avsnitt du inte har sett ännu';
|
||||
@override String get playerBackend => 'Spelarmotor';
|
||||
@override String get exoPlayer => 'ExoPlayer (Rekommenderad)';
|
||||
@override String get exoPlayerDescription => 'Android-nativ spelare med bättre hårdvarustöd';
|
||||
@@ -309,8 +316,12 @@ class _TranslationsSettingsSv implements TranslationsSettingsEn {
|
||||
@override String maxVolumePercent({required Object percent}) => '${percent}%';
|
||||
@override String get discordRichPresence => 'Discord Rich Presence';
|
||||
@override String get discordRichPresenceDescription => 'Visa vad du tittar på i Discord';
|
||||
@override String get autoPip => 'Automatisk bild-i-bild';
|
||||
@override String get autoPipDescription => 'Aktivera bild-i-bild automatiskt när appen lämnas under uppspelning';
|
||||
@override String get matchContentFrameRate => 'Matcha innehållets bildfrekvens';
|
||||
@override String get matchContentFrameRateDescription => 'Justera skärmens uppdateringsfrekvens för att matcha videoinnehållet, minskar hackighet och sparar batteri';
|
||||
@override String get tunneledPlayback => 'Tunneled Playback';
|
||||
@override String get tunneledPlaybackDescription => 'Use hardware-accelerated video tunneling. Disable if you see a black screen with audio on HDR content';
|
||||
@override String get requireProfileSelectionOnOpen => 'Fråga efter profil vid appstart';
|
||||
@override String get requireProfileSelectionOnOpenDescription => 'Visa profilval varje gång appen öppnas';
|
||||
@override String get confirmExitOnBack => 'Bekräfta innan avslut';
|
||||
@@ -400,8 +411,9 @@ class _TranslationsMediaMenuSv implements TranslationsMediaMenuEn {
|
||||
@override String get goToSeason => 'Gå till säsong';
|
||||
@override String get shufflePlay => 'Blanda uppspelning';
|
||||
@override String get fileInfo => 'Filinformation';
|
||||
@override String get confirmDelete => 'Är du säker på att du vill ta bort detta objekt från ditt filsystem?';
|
||||
@override String get deleteMultipleWarning => 'Flera objekt kan komma att tas bort.';
|
||||
@override String get deleteFromServer => 'Ta bort från servern';
|
||||
@override String get confirmDelete => 'Detta kommer permanent ta bort detta media och dess filer från din server. Detta kan inte ångras.';
|
||||
@override String get deleteMultipleWarning => 'Detta inkluderar alla avsnitt och deras filer.';
|
||||
@override String get mediaDeletedSuccessfully => 'Mediaobjekt borttaget';
|
||||
@override String get mediaFailedToDelete => 'Kunde inte ta bort mediaobjekt';
|
||||
@override String get rate => 'Betygsätt';
|
||||
@@ -1019,6 +1031,7 @@ class _TranslationsVideoSettingsSv implements TranslationsVideoSettingsEn {
|
||||
@override String get audioOutput => 'Ljudutgång';
|
||||
@override String get performanceOverlay => 'Prestandaöverlägg';
|
||||
@override String get audioPassthrough => 'Ljudgenomkoppling';
|
||||
@override String get audioNormalization => 'Ljudnormalisering';
|
||||
}
|
||||
|
||||
// Path: externalPlayer
|
||||
@@ -1336,6 +1349,11 @@ extension on TranslationsSv {
|
||||
'common.dontAskAgain' => 'Fråga inte igen',
|
||||
'common.exit' => 'Avsluta',
|
||||
'common.viewAll' => 'Visa alla',
|
||||
'common.checkingNetwork' => 'Kontrollerar nätverk...',
|
||||
'common.refreshingServers' => 'Uppdaterar servrar...',
|
||||
'common.loadingServers' => 'Laddar servrar...',
|
||||
'common.connectingToServers' => 'Ansluter till servrar...',
|
||||
'common.startingOfflineMode' => 'Startar offlineläge...',
|
||||
'screens.licenses' => 'Licenser',
|
||||
'screens.switchProfile' => 'Byt profil',
|
||||
'screens.subtitleStyling' => 'Undertext-styling',
|
||||
@@ -1394,6 +1412,8 @@ extension on TranslationsSv {
|
||||
'settings.alwaysKeepSidebarOpenDescription' => 'Sidofältet förblir expanderat och innehållsytan anpassas',
|
||||
'settings.showUnwatchedCount' => 'Visa antal osedda',
|
||||
'settings.showUnwatchedCountDescription' => 'Visa antal osedda avsnitt för serier och säsonger',
|
||||
'settings.hideSpoilers' => 'Dölj spoilers för osedda avsnitt',
|
||||
'settings.hideSpoilersDescription' => 'Gör miniatyrer suddiga och dölj beskrivningar för avsnitt du inte har sett ännu',
|
||||
'settings.playerBackend' => 'Spelarmotor',
|
||||
'settings.exoPlayer' => 'ExoPlayer (Rekommenderad)',
|
||||
'settings.exoPlayerDescription' => 'Android-nativ spelare med bättre hårdvarustöd',
|
||||
@@ -1469,6 +1489,8 @@ extension on TranslationsSv {
|
||||
'settings.discordRichPresenceDescription' => 'Visa vad du tittar på i Discord',
|
||||
'settings.matchContentFrameRate' => 'Matcha innehållets bildfrekvens',
|
||||
'settings.matchContentFrameRateDescription' => 'Justera skärmens uppdateringsfrekvens för att matcha videoinnehållet, minskar hackighet och sparar batteri',
|
||||
'settings.tunneledPlayback' => 'Tunneled Playback',
|
||||
'settings.tunneledPlaybackDescription' => 'Use hardware-accelerated video tunneling. Disable if you see a black screen with audio on HDR content',
|
||||
'settings.requireProfileSelectionOnOpen' => 'Fråga efter profil vid appstart',
|
||||
'settings.requireProfileSelectionOnOpenDescription' => 'Visa profilval varje gång appen öppnas',
|
||||
'settings.confirmExitOnBack' => 'Bekräfta innan avslut',
|
||||
@@ -1531,8 +1553,9 @@ extension on TranslationsSv {
|
||||
'mediaMenu.goToSeason' => 'Gå till säsong',
|
||||
'mediaMenu.shufflePlay' => 'Blanda uppspelning',
|
||||
'mediaMenu.fileInfo' => 'Filinformation',
|
||||
'mediaMenu.confirmDelete' => 'Är du säker på att du vill ta bort detta objekt från ditt filsystem?',
|
||||
'mediaMenu.deleteMultipleWarning' => 'Flera objekt kan komma att tas bort.',
|
||||
'mediaMenu.deleteFromServer' => 'Ta bort från servern',
|
||||
'mediaMenu.confirmDelete' => 'Detta kommer permanent ta bort detta media och dess filer från din server. Detta kan inte ångras.',
|
||||
'mediaMenu.deleteMultipleWarning' => 'Detta inkluderar alla avsnitt och deras filer.',
|
||||
'mediaMenu.mediaDeletedSuccessfully' => 'Mediaobjekt borttaget',
|
||||
'mediaMenu.mediaFailedToDelete' => 'Kunde inte ta bort mediaobjekt',
|
||||
'mediaMenu.rate' => 'Betygsätt',
|
||||
@@ -2005,6 +2028,7 @@ extension on TranslationsSv {
|
||||
'videoSettings.audioOutput' => 'Ljudutgång',
|
||||
'videoSettings.performanceOverlay' => 'Prestandaöverlägg',
|
||||
'videoSettings.audioPassthrough' => 'Ljudgenomkoppling',
|
||||
'videoSettings.audioNormalization' => 'Ljudnormalisering',
|
||||
'externalPlayer.title' => 'Extern spelare',
|
||||
'externalPlayer.useExternalPlayer' => 'Använd extern spelare',
|
||||
'externalPlayer.useExternalPlayerDescription' => 'Öppna videor i en extern app istället för den inbyggda spelaren',
|
||||
|
||||
@@ -151,6 +151,11 @@ class _TranslationsCommonZh implements TranslationsCommonEn {
|
||||
@override String get dontAskAgain => '不再询问';
|
||||
@override String get exit => '退出';
|
||||
@override String get viewAll => '查看全部';
|
||||
@override String get checkingNetwork => '正在检查网络...';
|
||||
@override String get refreshingServers => '正在刷新服务器...';
|
||||
@override String get loadingServers => '正在加载服务器...';
|
||||
@override String get connectingToServers => '正在连接服务器...';
|
||||
@override String get startingOfflineMode => '正在启动离线模式...';
|
||||
}
|
||||
|
||||
// Path: screens
|
||||
@@ -236,6 +241,8 @@ class _TranslationsSettingsZh implements TranslationsSettingsEn {
|
||||
@override String get alwaysKeepSidebarOpenDescription => '侧边栏保持展开状态,内容区域自动调整';
|
||||
@override String get showUnwatchedCount => '显示未观看数量';
|
||||
@override String get showUnwatchedCountDescription => '在剧集和季上显示未观看的集数';
|
||||
@override String get hideSpoilers => '隐藏未看剧集的剧透内容';
|
||||
@override String get hideSpoilersDescription => '模糊未观看剧集的缩略图并隐藏其描述';
|
||||
@override String get playerBackend => '播放器引擎';
|
||||
@override String get exoPlayer => 'ExoPlayer(推荐)';
|
||||
@override String get exoPlayerDescription => 'Android 原生播放器,硬件支持更好';
|
||||
@@ -309,8 +316,12 @@ class _TranslationsSettingsZh implements TranslationsSettingsEn {
|
||||
@override String maxVolumePercent({required Object percent}) => '${percent}%';
|
||||
@override String get discordRichPresence => 'Discord 动态状态';
|
||||
@override String get discordRichPresenceDescription => '在 Discord 上显示您正在观看的内容';
|
||||
@override String get autoPip => '自动画中画';
|
||||
@override String get autoPipDescription => '在播放期间离开应用时自动进入画中画模式';
|
||||
@override String get matchContentFrameRate => '匹配内容帧率';
|
||||
@override String get matchContentFrameRateDescription => '调整显示刷新率以匹配视频内容,减少画面抖动并节省电量';
|
||||
@override String get tunneledPlayback => 'Tunneled Playback';
|
||||
@override String get tunneledPlaybackDescription => 'Use hardware-accelerated video tunneling. Disable if you see a black screen with audio on HDR content';
|
||||
@override String get requireProfileSelectionOnOpen => '打开应用时询问配置文件';
|
||||
@override String get requireProfileSelectionOnOpenDescription => '每次打开应用时显示配置文件选择';
|
||||
@override String get confirmExitOnBack => '退出前确认';
|
||||
@@ -400,8 +411,9 @@ class _TranslationsMediaMenuZh implements TranslationsMediaMenuEn {
|
||||
@override String get goToSeason => '转到季';
|
||||
@override String get shufflePlay => '随机播放';
|
||||
@override String get fileInfo => '文件信息';
|
||||
@override String get confirmDelete => '确定要从文件系统中删除此项吗?';
|
||||
@override String get deleteMultipleWarning => '可能会删除多个项目。';
|
||||
@override String get deleteFromServer => '从服务器删除';
|
||||
@override String get confirmDelete => '这将永久删除此媒体及其文件。此操作无法撤销。';
|
||||
@override String get deleteMultipleWarning => '这包括所有剧集及其文件。';
|
||||
@override String get mediaDeletedSuccessfully => '媒体项已成功删除';
|
||||
@override String get mediaFailedToDelete => '删除媒体项失败';
|
||||
@override String get rate => '评分';
|
||||
@@ -1019,6 +1031,7 @@ class _TranslationsVideoSettingsZh implements TranslationsVideoSettingsEn {
|
||||
@override String get audioOutput => '音频输出';
|
||||
@override String get performanceOverlay => '性能监控';
|
||||
@override String get audioPassthrough => '音频直通';
|
||||
@override String get audioNormalization => '音频标准化';
|
||||
}
|
||||
|
||||
// Path: externalPlayer
|
||||
@@ -1336,6 +1349,11 @@ extension on TranslationsZh {
|
||||
'common.dontAskAgain' => '不再询问',
|
||||
'common.exit' => '退出',
|
||||
'common.viewAll' => '查看全部',
|
||||
'common.checkingNetwork' => '正在检查网络...',
|
||||
'common.refreshingServers' => '正在刷新服务器...',
|
||||
'common.loadingServers' => '正在加载服务器...',
|
||||
'common.connectingToServers' => '正在连接服务器...',
|
||||
'common.startingOfflineMode' => '正在启动离线模式...',
|
||||
'screens.licenses' => '许可证',
|
||||
'screens.switchProfile' => '切换用户',
|
||||
'screens.subtitleStyling' => '字幕样式',
|
||||
@@ -1394,6 +1412,8 @@ extension on TranslationsZh {
|
||||
'settings.alwaysKeepSidebarOpenDescription' => '侧边栏保持展开状态,内容区域自动调整',
|
||||
'settings.showUnwatchedCount' => '显示未观看数量',
|
||||
'settings.showUnwatchedCountDescription' => '在剧集和季上显示未观看的集数',
|
||||
'settings.hideSpoilers' => '隐藏未看剧集的剧透内容',
|
||||
'settings.hideSpoilersDescription' => '模糊未观看剧集的缩略图并隐藏其描述',
|
||||
'settings.playerBackend' => '播放器引擎',
|
||||
'settings.exoPlayer' => 'ExoPlayer(推荐)',
|
||||
'settings.exoPlayerDescription' => 'Android 原生播放器,硬件支持更好',
|
||||
@@ -1469,6 +1489,8 @@ extension on TranslationsZh {
|
||||
'settings.discordRichPresenceDescription' => '在 Discord 上显示您正在观看的内容',
|
||||
'settings.matchContentFrameRate' => '匹配内容帧率',
|
||||
'settings.matchContentFrameRateDescription' => '调整显示刷新率以匹配视频内容,减少画面抖动并节省电量',
|
||||
'settings.tunneledPlayback' => 'Tunneled Playback',
|
||||
'settings.tunneledPlaybackDescription' => 'Use hardware-accelerated video tunneling. Disable if you see a black screen with audio on HDR content',
|
||||
'settings.requireProfileSelectionOnOpen' => '打开应用时询问配置文件',
|
||||
'settings.requireProfileSelectionOnOpenDescription' => '每次打开应用时显示配置文件选择',
|
||||
'settings.confirmExitOnBack' => '退出前确认',
|
||||
@@ -1531,8 +1553,9 @@ extension on TranslationsZh {
|
||||
'mediaMenu.goToSeason' => '转到季',
|
||||
'mediaMenu.shufflePlay' => '随机播放',
|
||||
'mediaMenu.fileInfo' => '文件信息',
|
||||
'mediaMenu.confirmDelete' => '确定要从文件系统中删除此项吗?',
|
||||
'mediaMenu.deleteMultipleWarning' => '可能会删除多个项目。',
|
||||
'mediaMenu.deleteFromServer' => '从服务器删除',
|
||||
'mediaMenu.confirmDelete' => '这将永久删除此媒体及其文件。此操作无法撤销。',
|
||||
'mediaMenu.deleteMultipleWarning' => '这包括所有剧集及其文件。',
|
||||
'mediaMenu.mediaDeletedSuccessfully' => '媒体项已成功删除',
|
||||
'mediaMenu.mediaFailedToDelete' => '删除媒体项失败',
|
||||
'mediaMenu.rate' => '评分',
|
||||
@@ -2005,6 +2028,7 @@ extension on TranslationsZh {
|
||||
'videoSettings.audioOutput' => '音频输出',
|
||||
'videoSettings.performanceOverlay' => '性能监控',
|
||||
'videoSettings.audioPassthrough' => '音频直通',
|
||||
'videoSettings.audioNormalization' => '音频标准化',
|
||||
'externalPlayer.title' => '外部播放器',
|
||||
'externalPlayer.useExternalPlayer' => '使用外部播放器',
|
||||
'externalPlayer.useExternalPlayerDescription' => '在外部应用中打开视频,而不是使用内置播放器',
|
||||
|
||||
@@ -52,7 +52,12 @@
|
||||
"exitConfirmMessage": "Är du säker på att du vill avsluta?",
|
||||
"dontAskAgain": "Fråga inte igen",
|
||||
"exit": "Avsluta",
|
||||
"viewAll": "Visa alla"
|
||||
"viewAll": "Visa alla",
|
||||
"checkingNetwork": "Kontrollerar nätverk...",
|
||||
"refreshingServers": "Uppdaterar servrar...",
|
||||
"loadingServers": "Laddar servrar...",
|
||||
"connectingToServers": "Ansluter till servrar...",
|
||||
"startingOfflineMode": "Startar offlineläge..."
|
||||
},
|
||||
"screens": {
|
||||
"licenses": "Licenser",
|
||||
@@ -117,6 +122,8 @@
|
||||
"alwaysKeepSidebarOpenDescription": "Sidofältet förblir expanderat och innehållsytan anpassas",
|
||||
"showUnwatchedCount": "Visa antal osedda",
|
||||
"showUnwatchedCountDescription": "Visa antal osedda avsnitt för serier och säsonger",
|
||||
"hideSpoilers": "Dölj spoilers för osedda avsnitt",
|
||||
"hideSpoilersDescription": "Gör miniatyrer suddiga och dölj beskrivningar för avsnitt du inte har sett ännu",
|
||||
"playerBackend": "Spelarmotor",
|
||||
"exoPlayer": "ExoPlayer (Rekommenderad)",
|
||||
"exoPlayerDescription": "Android-nativ spelare med bättre hårdvarustöd",
|
||||
@@ -190,8 +197,12 @@
|
||||
"maxVolumePercent": "${percent}%",
|
||||
"discordRichPresence": "Discord Rich Presence",
|
||||
"discordRichPresenceDescription": "Visa vad du tittar på i Discord",
|
||||
"autoPip": "Automatisk bild-i-bild",
|
||||
"autoPipDescription": "Aktivera bild-i-bild automatiskt när appen lämnas under uppspelning",
|
||||
"matchContentFrameRate": "Matcha innehållets bildfrekvens",
|
||||
"matchContentFrameRateDescription": "Justera skärmens uppdateringsfrekvens för att matcha videoinnehållet, minskar hackighet och sparar batteri",
|
||||
"tunneledPlayback": "Tunneled Playback",
|
||||
"tunneledPlaybackDescription": "Use hardware-accelerated video tunneling. Disable if you see a black screen with audio on HDR content",
|
||||
"requireProfileSelectionOnOpen": "Fråga efter profil vid appstart",
|
||||
"requireProfileSelectionOnOpenDescription": "Visa profilval varje gång appen öppnas",
|
||||
"confirmExitOnBack": "Bekräfta innan avslut",
|
||||
@@ -266,8 +277,9 @@
|
||||
"goToSeason": "Gå till säsong",
|
||||
"shufflePlay": "Blanda uppspelning",
|
||||
"fileInfo": "Filinformation",
|
||||
"confirmDelete": "Är du säker på att du vill ta bort detta objekt från ditt filsystem?",
|
||||
"deleteMultipleWarning": "Flera objekt kan komma att tas bort.",
|
||||
"deleteFromServer": "Ta bort från servern",
|
||||
"confirmDelete": "Detta kommer permanent ta bort detta media och dess filer från din server. Detta kan inte ångras.",
|
||||
"deleteMultipleWarning": "Detta inkluderar alla avsnitt och deras filer.",
|
||||
"mediaDeletedSuccessfully": "Mediaobjekt borttaget",
|
||||
"mediaFailedToDelete": "Kunde inte ta bort mediaobjekt",
|
||||
"rate": "Betygsätt"
|
||||
@@ -799,7 +811,8 @@
|
||||
"hdr": "HDR",
|
||||
"audioOutput": "Ljudutgång",
|
||||
"performanceOverlay": "Prestandaöverlägg",
|
||||
"audioPassthrough": "Ljudgenomkoppling"
|
||||
"audioPassthrough": "Ljudgenomkoppling",
|
||||
"audioNormalization": "Ljudnormalisering"
|
||||
},
|
||||
"externalPlayer": {
|
||||
"title": "Extern spelare",
|
||||
|
||||
@@ -52,7 +52,12 @@
|
||||
"exitConfirmMessage": "确定要退出吗?",
|
||||
"dontAskAgain": "不再询问",
|
||||
"exit": "退出",
|
||||
"viewAll": "查看全部"
|
||||
"viewAll": "查看全部",
|
||||
"checkingNetwork": "正在检查网络...",
|
||||
"refreshingServers": "正在刷新服务器...",
|
||||
"loadingServers": "正在加载服务器...",
|
||||
"connectingToServers": "正在连接服务器...",
|
||||
"startingOfflineMode": "正在启动离线模式..."
|
||||
},
|
||||
"screens": {
|
||||
"licenses": "许可证",
|
||||
@@ -117,6 +122,8 @@
|
||||
"alwaysKeepSidebarOpenDescription": "侧边栏保持展开状态,内容区域自动调整",
|
||||
"showUnwatchedCount": "显示未观看数量",
|
||||
"showUnwatchedCountDescription": "在剧集和季上显示未观看的集数",
|
||||
"hideSpoilers": "隐藏未看剧集的剧透内容",
|
||||
"hideSpoilersDescription": "模糊未观看剧集的缩略图并隐藏其描述",
|
||||
"playerBackend": "播放器引擎",
|
||||
"exoPlayer": "ExoPlayer(推荐)",
|
||||
"exoPlayerDescription": "Android 原生播放器,硬件支持更好",
|
||||
@@ -190,8 +197,12 @@
|
||||
"maxVolumePercent": "${percent}%",
|
||||
"discordRichPresence": "Discord 动态状态",
|
||||
"discordRichPresenceDescription": "在 Discord 上显示您正在观看的内容",
|
||||
"autoPip": "自动画中画",
|
||||
"autoPipDescription": "在播放期间离开应用时自动进入画中画模式",
|
||||
"matchContentFrameRate": "匹配内容帧率",
|
||||
"matchContentFrameRateDescription": "调整显示刷新率以匹配视频内容,减少画面抖动并节省电量",
|
||||
"tunneledPlayback": "Tunneled Playback",
|
||||
"tunneledPlaybackDescription": "Use hardware-accelerated video tunneling. Disable if you see a black screen with audio on HDR content",
|
||||
"requireProfileSelectionOnOpen": "打开应用时询问配置文件",
|
||||
"requireProfileSelectionOnOpenDescription": "每次打开应用时显示配置文件选择",
|
||||
"confirmExitOnBack": "退出前确认",
|
||||
@@ -266,8 +277,9 @@
|
||||
"goToSeason": "转到季",
|
||||
"shufflePlay": "随机播放",
|
||||
"fileInfo": "文件信息",
|
||||
"confirmDelete": "确定要从文件系统中删除此项吗?",
|
||||
"deleteMultipleWarning": "可能会删除多个项目。",
|
||||
"deleteFromServer": "从服务器删除",
|
||||
"confirmDelete": "这将永久删除此媒体及其文件。此操作无法撤销。",
|
||||
"deleteMultipleWarning": "这包括所有剧集及其文件。",
|
||||
"mediaDeletedSuccessfully": "媒体项已成功删除",
|
||||
"mediaFailedToDelete": "删除媒体项失败",
|
||||
"rate": "评分"
|
||||
@@ -799,7 +811,8 @@
|
||||
"hdr": "HDR",
|
||||
"audioOutput": "音频输出",
|
||||
"performanceOverlay": "性能监控",
|
||||
"audioPassthrough": "音频直通"
|
||||
"audioPassthrough": "音频直通",
|
||||
"audioNormalization": "音频标准化"
|
||||
},
|
||||
"externalPlayer": {
|
||||
"title": "外部播放器",
|
||||
|
||||
@@ -4,10 +4,11 @@ import 'package:flutter/gestures.dart';
|
||||
import 'dart:io' show Platform;
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'screens/main_screen.dart';
|
||||
import 'screens/auth_screen.dart';
|
||||
import 'services/storage_service.dart';
|
||||
import 'services/macos_titlebar_service.dart';
|
||||
import 'services/macos_window_service.dart';
|
||||
import 'services/fullscreen_state_manager.dart';
|
||||
import 'services/settings_service.dart';
|
||||
import 'utils/platform_detector.dart';
|
||||
@@ -46,6 +47,7 @@ import 'i18n/strings.g.dart';
|
||||
import 'focus/input_mode_tracker.dart';
|
||||
import 'focus/key_event_utils.dart';
|
||||
import 'package:intl/date_symbol_data_local.dart';
|
||||
import 'utils/navigation_transitions.dart';
|
||||
|
||||
// Workaround for Flutter bug #177992: iPadOS 26.1+ misinterprets fake touch events
|
||||
// at (0,0) as barrier taps, causing modals to dismiss immediately.
|
||||
@@ -98,7 +100,7 @@ void main() async {
|
||||
}
|
||||
|
||||
// Configure macOS window with custom titlebar (depends on window manager)
|
||||
futures.add(MacOSTitlebarService.setupCustomTitlebar());
|
||||
futures.add(MacOSWindowService.setupCustomTitlebar());
|
||||
|
||||
// Initialize storage service
|
||||
futures.add(StorageService.getInstance());
|
||||
@@ -135,7 +137,7 @@ void main() async {
|
||||
|
||||
void _registerShaderLicenses() {
|
||||
LicenseRegistry.addLicense(() async* {
|
||||
yield LicenseEntryWithLineBreaks(
|
||||
yield const LicenseEntryWithLineBreaks(
|
||||
['Anime4K'],
|
||||
'MIT License\n'
|
||||
'\n'
|
||||
@@ -160,7 +162,7 @@ void _registerShaderLicenses() {
|
||||
'OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE '
|
||||
'SOFTWARE.',
|
||||
);
|
||||
yield LicenseEntryWithLineBreaks(
|
||||
yield const LicenseEntryWithLineBreaks(
|
||||
['NVIDIA Image Scaling (NVScaler)'],
|
||||
'The MIT License (MIT)\n'
|
||||
'\n'
|
||||
@@ -368,24 +370,35 @@ class SetupScreen extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _SetupScreenState extends State<SetupScreen> {
|
||||
String _statusMessage = '';
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_loadSavedCredentials();
|
||||
}
|
||||
|
||||
void _setStatus(String message) {
|
||||
if (mounted) setState(() => _statusMessage = message);
|
||||
}
|
||||
|
||||
Future<void> _loadSavedCredentials() async {
|
||||
_setStatus(t.common.checkingNetwork);
|
||||
|
||||
final storage = await StorageService.getInstance();
|
||||
final registry = ServerRegistry(storage);
|
||||
|
||||
// Check network connectivity early to fast-path airplane mode.
|
||||
// Timeout guards against connectivity_plus hanging on some Android TV devices after force-close.
|
||||
final connectivityResult = await Connectivity()
|
||||
.checkConnectivity()
|
||||
.timeout(const Duration(seconds: 3), onTimeout: () => [ConnectivityResult.other]);
|
||||
final connectivityResult = await Connectivity().checkConnectivity().timeout(
|
||||
const Duration(seconds: 3),
|
||||
onTimeout: () => [ConnectivityResult.other],
|
||||
);
|
||||
final hasNetwork = !connectivityResult.contains(ConnectivityResult.none);
|
||||
|
||||
if (hasNetwork) {
|
||||
_setStatus(t.common.refreshingServers);
|
||||
|
||||
// Refresh servers from API to get updated connection info (IPs may change).
|
||||
// If the stored token is invalid (e.g. after removing a Plex profile PIN),
|
||||
// redirect to AuthScreen so the user can re-authenticate.
|
||||
@@ -393,18 +406,20 @@ class _SetupScreenState extends State<SetupScreen> {
|
||||
if (refreshResult == ServerRefreshResult.authError) {
|
||||
await storage.clearCredentials();
|
||||
if (mounted) {
|
||||
Navigator.pushReplacement(context, MaterialPageRoute(builder: (context) => const AuthScreen()));
|
||||
Navigator.pushReplacement(context, fadeRoute(const AuthScreen()));
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_setStatus(t.common.loadingServers);
|
||||
|
||||
// Load all configured servers
|
||||
final servers = await registry.getServers();
|
||||
|
||||
if (servers.isEmpty) {
|
||||
if (mounted) {
|
||||
Navigator.pushReplacement(context, MaterialPageRoute(builder: (context) => const AuthScreen()));
|
||||
Navigator.pushReplacement(context, fadeRoute(const AuthScreen()));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -413,15 +428,15 @@ class _SetupScreenState extends State<SetupScreen> {
|
||||
|
||||
// No network — skip connection attempts and go straight to offline mode
|
||||
if (!hasNetwork) {
|
||||
_setStatus(t.common.startingOfflineMode);
|
||||
await context.read<DownloadProvider>().ensureInitialized();
|
||||
if (!mounted) return;
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => const MainScreen(isOfflineMode: true)),
|
||||
);
|
||||
Navigator.pushReplacement(context, fadeRoute(const MainScreen(isOfflineMode: true)));
|
||||
return;
|
||||
}
|
||||
|
||||
_setStatus(t.common.connectingToServers);
|
||||
|
||||
try {
|
||||
final result = await ServerConnectionOrchestrator.connectAndInitialize(
|
||||
servers: servers,
|
||||
@@ -440,40 +455,52 @@ class _SetupScreenState extends State<SetupScreen> {
|
||||
downloadProvider.resumeQueuedDownloads(result.firstClient!);
|
||||
});
|
||||
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => MainScreen(client: result.firstClient!)),
|
||||
);
|
||||
Navigator.pushReplacement(context, fadeRoute(MainScreen(client: result.firstClient!)));
|
||||
} else {
|
||||
_setStatus(t.common.startingOfflineMode);
|
||||
await context.read<DownloadProvider>().ensureInitialized();
|
||||
if (!mounted) return;
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => const MainScreen(isOfflineMode: true)),
|
||||
);
|
||||
Navigator.pushReplacement(context, fadeRoute(const MainScreen(isOfflineMode: true)));
|
||||
}
|
||||
} catch (e, stackTrace) {
|
||||
appLogger.e('Error during multi-server connection', error: e, stackTrace: stackTrace);
|
||||
|
||||
if (mounted) {
|
||||
_setStatus(t.common.startingOfflineMode);
|
||||
await context.read<DownloadProvider>().ensureInitialized();
|
||||
if (!mounted) return;
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => const MainScreen(isOfflineMode: true)),
|
||||
);
|
||||
Navigator.pushReplacement(context, fadeRoute(const MainScreen(isOfflineMode: true)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [const CircularProgressIndicator(), const SizedBox(height: 16), Text(t.common.loading)],
|
||||
),
|
||||
return ColoredBox(
|
||||
color: Theme.of(context).scaffoldBackgroundColor,
|
||||
child: Stack(
|
||||
children: [
|
||||
// Icon dead-center, matching Android 12+ splash position.
|
||||
// 192dp accounts for the 16% inset in ic_launcher.xml.
|
||||
Center(child: SvgPicture.asset('assets/plezy_adaptive_foreground.svg', width: 288, height: 288)),
|
||||
// Status text below center, independent of icon position.
|
||||
Positioned(
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: MediaQuery.of(context).size.height * 0.5 - 140,
|
||||
child: AnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
child: Text(
|
||||
_statusMessage,
|
||||
key: ValueKey(_statusMessage),
|
||||
textAlign: TextAlign.center,
|
||||
style: Theme.of(
|
||||
context,
|
||||
).textTheme.bodyMedium?.copyWith(color: Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.6)),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,56 @@
|
||||
import 'remote_command_type.dart';
|
||||
enum RemoteCommandType {
|
||||
// Navigation
|
||||
dpadUp,
|
||||
dpadDown,
|
||||
dpadLeft,
|
||||
dpadRight,
|
||||
select,
|
||||
back,
|
||||
contextMenu,
|
||||
|
||||
// Playback
|
||||
play,
|
||||
pause,
|
||||
playPause,
|
||||
stop,
|
||||
seekForward,
|
||||
seekBackward,
|
||||
nextTrack,
|
||||
previousTrack,
|
||||
skipIntro,
|
||||
skipCredits,
|
||||
|
||||
// Volume
|
||||
volumeUp,
|
||||
volumeDown,
|
||||
volumeMute,
|
||||
volumeSet,
|
||||
|
||||
// Tab Navigation
|
||||
tabNext,
|
||||
tabPrevious,
|
||||
tabDiscover,
|
||||
tabLibraries,
|
||||
tabSearch,
|
||||
tabDownloads,
|
||||
tabSettings,
|
||||
|
||||
// Quick Actions
|
||||
home,
|
||||
search,
|
||||
subtitles,
|
||||
audioTracks,
|
||||
qualitySettings,
|
||||
fullscreen,
|
||||
|
||||
// Session Management
|
||||
ping,
|
||||
pong,
|
||||
deviceInfo,
|
||||
disconnect,
|
||||
ack,
|
||||
syncState,
|
||||
}
|
||||
|
||||
class RemoteCommand {
|
||||
final RemoteCommandType type;
|
||||
|
||||
@@ -1,53 +0,0 @@
|
||||
enum RemoteCommandType {
|
||||
// Navigation
|
||||
dpadUp,
|
||||
dpadDown,
|
||||
dpadLeft,
|
||||
dpadRight,
|
||||
select,
|
||||
back,
|
||||
contextMenu,
|
||||
|
||||
// Playback
|
||||
play,
|
||||
pause,
|
||||
playPause,
|
||||
stop,
|
||||
seekForward,
|
||||
seekBackward,
|
||||
nextTrack,
|
||||
previousTrack,
|
||||
skipIntro,
|
||||
skipCredits,
|
||||
|
||||
// Volume
|
||||
volumeUp,
|
||||
volumeDown,
|
||||
volumeMute,
|
||||
volumeSet,
|
||||
|
||||
// Tab Navigation
|
||||
tabNext,
|
||||
tabPrevious,
|
||||
tabDiscover,
|
||||
tabLibraries,
|
||||
tabSearch,
|
||||
tabDownloads,
|
||||
tabSettings,
|
||||
|
||||
// Quick Actions
|
||||
home,
|
||||
search,
|
||||
subtitles,
|
||||
audioTracks,
|
||||
qualitySettings,
|
||||
fullscreen,
|
||||
|
||||
// Session Management
|
||||
ping,
|
||||
pong,
|
||||
deviceInfo,
|
||||
disconnect,
|
||||
ack,
|
||||
syncState,
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'trusted_device.g.dart';
|
||||
|
||||
@JsonSerializable()
|
||||
class TrustedDevice {
|
||||
final String peerId;
|
||||
final String deviceName;
|
||||
final String platform;
|
||||
final DateTime firstConnected;
|
||||
final DateTime lastConnected;
|
||||
final bool isApproved;
|
||||
|
||||
TrustedDevice({
|
||||
required this.peerId,
|
||||
required this.deviceName,
|
||||
required this.platform,
|
||||
DateTime? firstConnected,
|
||||
DateTime? lastConnected,
|
||||
this.isApproved = false,
|
||||
}) : firstConnected = firstConnected ?? DateTime.now(),
|
||||
lastConnected = lastConnected ?? DateTime.now();
|
||||
|
||||
factory TrustedDevice.fromJson(Map<String, dynamic> json) => _$TrustedDeviceFromJson(json);
|
||||
|
||||
Map<String, dynamic> toJson() => _$TrustedDeviceToJson(this);
|
||||
|
||||
TrustedDevice copyWith({
|
||||
String? peerId,
|
||||
String? deviceName,
|
||||
String? platform,
|
||||
DateTime? firstConnected,
|
||||
DateTime? lastConnected,
|
||||
bool? isApproved,
|
||||
}) {
|
||||
return TrustedDevice(
|
||||
peerId: peerId ?? this.peerId,
|
||||
deviceName: deviceName ?? this.deviceName,
|
||||
platform: platform ?? this.platform,
|
||||
firstConnected: firstConnected ?? this.firstConnected,
|
||||
lastConnected: lastConnected ?? this.lastConnected,
|
||||
isApproved: isApproved ?? this.isApproved,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
if (identical(this, other)) return true;
|
||||
return other is TrustedDevice && other.peerId == peerId;
|
||||
}
|
||||
|
||||
@override
|
||||
int get hashCode => peerId.hashCode;
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'trusted_device.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
TrustedDevice _$TrustedDeviceFromJson(Map<String, dynamic> json) => TrustedDevice(
|
||||
peerId: json['peerId'] as String,
|
||||
deviceName: json['deviceName'] as String,
|
||||
platform: json['platform'] as String,
|
||||
firstConnected: json['firstConnected'] == null ? null : DateTime.parse(json['firstConnected'] as String),
|
||||
lastConnected: json['lastConnected'] == null ? null : DateTime.parse(json['lastConnected'] as String),
|
||||
isApproved: json['isApproved'] as bool? ?? false,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$TrustedDeviceToJson(TrustedDevice instance) => <String, dynamic>{
|
||||
'peerId': instance.peerId,
|
||||
'deviceName': instance.deviceName,
|
||||
'platform': instance.platform,
|
||||
'firstConnected': instance.firstConnected.toIso8601String(),
|
||||
'lastConnected': instance.lastConnected.toIso8601String(),
|
||||
'isApproved': instance.isApproved,
|
||||
};
|
||||
@@ -1,3 +1,4 @@
|
||||
import '../utils/app_logger.dart';
|
||||
import '../utils/codec_utils.dart';
|
||||
|
||||
class PlexMediaInfo {
|
||||
@@ -15,6 +16,63 @@ class PlexMediaInfo {
|
||||
this.partId,
|
||||
});
|
||||
int? getPartId() => partId;
|
||||
|
||||
/// Creates a [PlexMediaInfo] from cached metadata JSON (as stored by [PlexApiCache]).
|
||||
/// Parses audio/subtitle tracks from `Media[0].Part[0].Stream[]` so that
|
||||
/// offline playback can still apply language-based track selection.
|
||||
static PlexMediaInfo? fromMetadataJson(Map<String, dynamic> metadata) {
|
||||
final media = metadata['Media'] as List<dynamic>?;
|
||||
if (media == null || media.isEmpty) return null;
|
||||
final parts = media[0]['Part'] as List<dynamic>?;
|
||||
if (parts == null || parts.isEmpty) return null;
|
||||
final streams = parts[0]['Stream'] as List<dynamic>?;
|
||||
|
||||
final audioTracks = <PlexAudioTrack>[];
|
||||
final subtitleTracks = <PlexSubtitleTrack>[];
|
||||
|
||||
if (streams != null) {
|
||||
for (final s in streams) {
|
||||
try {
|
||||
final streamType = s['streamType'] as int?;
|
||||
if (streamType == 2) {
|
||||
audioTracks.add(PlexAudioTrack(
|
||||
id: s['id'] as int,
|
||||
index: s['index'] as int?,
|
||||
codec: s['codec'] as String?,
|
||||
language: s['language'] as String?,
|
||||
languageCode: s['languageCode'] as String?,
|
||||
title: s['title'] as String?,
|
||||
displayTitle: s['displayTitle'] as String?,
|
||||
channels: s['channels'] as int?,
|
||||
selected: s['selected'] == 1 || s['selected'] == true,
|
||||
));
|
||||
} else if (streamType == 3) {
|
||||
subtitleTracks.add(PlexSubtitleTrack(
|
||||
id: s['id'] as int,
|
||||
index: s['index'] as int?,
|
||||
codec: s['codec'] as String?,
|
||||
language: s['language'] as String?,
|
||||
languageCode: s['languageCode'] as String?,
|
||||
title: s['title'] as String?,
|
||||
displayTitle: s['displayTitle'] as String?,
|
||||
selected: s['selected'] == 1 || s['selected'] == true,
|
||||
forced: s['forced'] == 1,
|
||||
key: s['key'] as String?,
|
||||
));
|
||||
}
|
||||
} catch (e) {
|
||||
appLogger.d('Skipping malformed stream in cached metadata', error: e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return PlexMediaInfo(
|
||||
videoUrl: '',
|
||||
audioTracks: audioTracks,
|
||||
subtitleTracks: subtitleTracks,
|
||||
chapters: const [],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Builds a track label from parts with the standard `' · '` joiner pattern.
|
||||
|
||||
@@ -112,6 +112,9 @@ class PlexMetadata with MultiServerFields {
|
||||
// Clear logo URL (extracted from Image array, but serialized for offline storage)
|
||||
final String? clearLogo;
|
||||
|
||||
// Square background art URL (extracted from Image array, used for near-square hero layouts)
|
||||
final String? backgroundSquare;
|
||||
|
||||
/// Global unique identifier across all servers (serverId:ratingKey)
|
||||
String get globalKey => serverId != null ? buildGlobalKey(serverId!, ratingKey) : ratingKey;
|
||||
|
||||
@@ -186,6 +189,7 @@ class PlexMetadata with MultiServerFields {
|
||||
this.serverId,
|
||||
this.serverName,
|
||||
this.clearLogo,
|
||||
this.backgroundSquare,
|
||||
});
|
||||
|
||||
/// Create a copy of this metadata with optional field overrides
|
||||
@@ -242,6 +246,7 @@ class PlexMetadata with MultiServerFields {
|
||||
String? serverId,
|
||||
String? serverName,
|
||||
String? clearLogo,
|
||||
String? backgroundSquare,
|
||||
}) {
|
||||
return PlexMetadata(
|
||||
ratingKey: ratingKey ?? this.ratingKey,
|
||||
@@ -296,35 +301,48 @@ class PlexMetadata with MultiServerFields {
|
||||
serverId: serverId ?? this.serverId,
|
||||
serverName: serverName ?? this.serverName,
|
||||
clearLogo: clearLogo ?? this.clearLogo,
|
||||
backgroundSquare: backgroundSquare ?? this.backgroundSquare,
|
||||
);
|
||||
}
|
||||
|
||||
/// Extract clearLogo from Image array in raw JSON
|
||||
static String? _extractClearLogoFromJson(Map<String, dynamic> json) {
|
||||
/// Extract an image URL by type from the Image array in raw JSON
|
||||
static String? _extractImageFromJson(Map<String, dynamic> json, String imageType) {
|
||||
if (!json.containsKey('Image')) return null;
|
||||
|
||||
final images = json['Image'] as List?;
|
||||
if (images == null) return null;
|
||||
|
||||
for (var image in images) {
|
||||
if (image is Map && image['type'] == 'clearLogo') {
|
||||
if (image is Map && image['type'] == imageType) {
|
||||
return image['url'] as String?;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Create from JSON with clearLogo extracted from Image array
|
||||
/// Create from JSON with Image array fields extracted
|
||||
factory PlexMetadata.fromJsonWithImages(Map<String, dynamic> json) {
|
||||
// Extract clearLogo before parsing
|
||||
final clearLogoUrl = _extractClearLogoFromJson(json);
|
||||
// Add it to the json so it gets parsed
|
||||
final clearLogoUrl = _extractImageFromJson(json, 'clearLogo');
|
||||
if (clearLogoUrl != null) {
|
||||
json['clearLogo'] = clearLogoUrl;
|
||||
}
|
||||
final backgroundSquareUrl = _extractImageFromJson(json, 'backgroundSquare');
|
||||
if (backgroundSquareUrl != null) {
|
||||
json['backgroundSquare'] = backgroundSquareUrl;
|
||||
}
|
||||
return PlexMetadata.fromJson(json);
|
||||
}
|
||||
|
||||
/// Returns the best hero art path based on the container's aspect ratio.
|
||||
/// Uses backgroundSquare when the container is closer to 1:1 than 16:9.
|
||||
String? heroArt({required double containerAspectRatio}) {
|
||||
// Threshold = midpoint of 1:1 (1.0) and 16:9 (~1.78) ≈ 1.39
|
||||
if (containerAspectRatio < 1.39 && backgroundSquare != null) {
|
||||
return backgroundSquare;
|
||||
}
|
||||
return art;
|
||||
}
|
||||
|
||||
// Helper to get the display title (show name for episodes/seasons, title otherwise)
|
||||
String get displayTitle {
|
||||
final itemType = type.toLowerCase();
|
||||
|
||||
@@ -57,6 +57,7 @@ PlexMetadata _$PlexMetadataFromJson(Map<String, dynamic> json) => PlexMetadata(
|
||||
extraType: (json['extraType'] as num?)?.toInt(),
|
||||
primaryExtraKey: json['primaryExtraKey'] as String?,
|
||||
clearLogo: json['clearLogo'] as String?,
|
||||
backgroundSquare: json['backgroundSquare'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$PlexMetadataToJson(PlexMetadata instance) => <String, dynamic>{
|
||||
@@ -110,4 +111,5 @@ Map<String, dynamic> _$PlexMetadataToJson(PlexMetadata instance) => <String, dyn
|
||||
'extraType': instance.extraType,
|
||||
'primaryExtraKey': instance.primaryExtraKey,
|
||||
'clearLogo': instance.clearLogo,
|
||||
'backgroundSquare': instance.backgroundSquare,
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../models.dart';
|
||||
import 'player_base.dart';
|
||||
import '../../models.dart';
|
||||
import '../player_base.dart';
|
||||
|
||||
/// Android implementation of [Player] using ExoPlayer.
|
||||
/// Provides hardware-accelerated playback with ASS subtitle support via libass-android.
|
||||
@@ -10,6 +10,7 @@ class PlayerAndroid extends PlayerBase {
|
||||
static const _eventChannel = EventChannel('com.plezy/exo_player/events');
|
||||
|
||||
int? _bufferSizeBytes;
|
||||
bool _tunnelingEnabled = true;
|
||||
|
||||
@override
|
||||
MethodChannel get methodChannel => _methodChannel;
|
||||
@@ -36,12 +37,6 @@ class PlayerAndroid extends PlayerBase {
|
||||
return;
|
||||
}
|
||||
|
||||
if (name == 'memory-pressure') {
|
||||
// System memory is critically low — playback may be at risk of OOM crash
|
||||
errorController.add('Low memory — playback may be unstable');
|
||||
return;
|
||||
}
|
||||
|
||||
// Delegate to base class for common events
|
||||
super.handlePlayerEvent(name, data);
|
||||
}
|
||||
@@ -56,6 +51,7 @@ class PlayerAndroid extends PlayerBase {
|
||||
try {
|
||||
final result = await methodChannel.invokeMethod<bool>('initialize', {
|
||||
'bufferSizeBytes': _bufferSizeBytes,
|
||||
'tunnelingEnabled': _tunnelingEnabled,
|
||||
});
|
||||
initialized = result == true;
|
||||
if (!initialized) {
|
||||
@@ -194,6 +190,9 @@ class PlayerAndroid extends PlayerBase {
|
||||
case 'demuxer-max-bytes':
|
||||
_bufferSizeBytes = int.tryParse(value);
|
||||
break;
|
||||
case 'tunneled-playback':
|
||||
_tunnelingEnabled = value != 'no';
|
||||
break;
|
||||
// Other properties are no-ops for ExoPlayer
|
||||
}
|
||||
}
|
||||
@@ -369,4 +368,15 @@ class PlayerAndroid extends PlayerBase {
|
||||
|
||||
await methodChannel.invokeMethod('abandonAudioFocus');
|
||||
}
|
||||
|
||||
// ============================================
|
||||
// Log Level
|
||||
// ============================================
|
||||
|
||||
@override
|
||||
Future<void> setLogLevel(String level) async {
|
||||
checkDisposed();
|
||||
if (!initialized) return;
|
||||
await methodChannel.invokeMethod('setLogLevel', {'level': level});
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'dart:io' show Platform;
|
||||
|
||||
import '../models.dart';
|
||||
import 'player_android.dart';
|
||||
import 'platform/player_android.dart';
|
||||
import 'player_native.dart';
|
||||
import 'player_state.dart';
|
||||
import 'player_streams.dart';
|
||||
|
||||
@@ -40,6 +40,7 @@ abstract class PlayerBase with PlayerStreamControllersMixin implements Player {
|
||||
bool _disposed = false;
|
||||
final _throttleSw = Stopwatch()..start();
|
||||
int _lastEmitMs = 0;
|
||||
int _lastCacheStateMs = 0;
|
||||
int _positionMs = 0;
|
||||
int _nextPropId = 0;
|
||||
final Map<int, String> _propIdToName = {};
|
||||
@@ -173,6 +174,9 @@ abstract class PlayerBase with PlayerStreamControllersMixin implements Player {
|
||||
|
||||
case 'demuxer-cache-time':
|
||||
if (value is num) {
|
||||
final nowMs = _throttleSw.elapsedMilliseconds;
|
||||
if (nowMs - _lastCacheStateMs < 250) break;
|
||||
_lastCacheStateMs = nowMs;
|
||||
final buffer = Duration(milliseconds: (value * 1000).toInt());
|
||||
_state = _state.copyWith(buffer: buffer);
|
||||
bufferController.add(buffer);
|
||||
@@ -274,6 +278,10 @@ abstract class PlayerBase with PlayerStreamControllersMixin implements Player {
|
||||
if (value is Map) {
|
||||
cacheState = value;
|
||||
} else if (value is String && value.isNotEmpty) {
|
||||
// Throttle JSON parsing to avoid ANR on low-end devices
|
||||
final nowMs = _throttleSw.elapsedMilliseconds;
|
||||
if (nowMs - _lastCacheStateMs < 250) return;
|
||||
_lastCacheStateMs = nowMs;
|
||||
try {
|
||||
final parsed = jsonDecode(value);
|
||||
if (parsed is Map) cacheState = parsed;
|
||||
@@ -331,10 +339,6 @@ abstract class PlayerBase with PlayerStreamControllersMixin implements Player {
|
||||
break;
|
||||
|
||||
case 'playback-restart':
|
||||
// Clear stale buffer ranges from before the seek; fresh ones will
|
||||
// arrive shortly via the next demuxer-cache-state update.
|
||||
_state = _state.copyWith(bufferRanges: const []);
|
||||
bufferRangesController.add(const []);
|
||||
playbackRestartController.add(null);
|
||||
break;
|
||||
|
||||
|
||||
@@ -1,31 +1,23 @@
|
||||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
|
||||
import '../models/companion_remote/remote_command.dart';
|
||||
import '../models/companion_remote/remote_command_type.dart';
|
||||
import '../models/companion_remote/remote_session.dart';
|
||||
import '../models/companion_remote/trusted_device.dart';
|
||||
import '../services/companion_remote/companion_remote_peer_service.dart';
|
||||
import '../services/storage_service.dart';
|
||||
import '../utils/app_logger.dart';
|
||||
|
||||
typedef CommandReceivedCallback = void Function(RemoteCommand command);
|
||||
typedef DeviceApprovalCallback = Future<bool> Function(RemoteDevice device);
|
||||
|
||||
class CompanionRemoteProvider with ChangeNotifier {
|
||||
RemoteSession? _session;
|
||||
CompanionRemotePeerService? _peerService;
|
||||
String _deviceName = 'Unknown Device';
|
||||
String _platform = 'unknown';
|
||||
final List<TrustedDevice> _trustedDevices = [];
|
||||
bool _isPlayerActive = false;
|
||||
|
||||
static const String _storageKey = 'companion_remote_trusted_devices';
|
||||
static const String _lastDeviceKey = 'companion_remote_last_device';
|
||||
static const int _maxReconnectAttempts = 5;
|
||||
|
||||
Timer? _reconnectTimer;
|
||||
@@ -44,7 +36,6 @@ class CompanionRemoteProvider with ChangeNotifier {
|
||||
StreamSubscription<RemoteSessionStatus>? _statusSubscription;
|
||||
|
||||
CommandReceivedCallback? onCommandReceived;
|
||||
DeviceApprovalCallback? onDeviceApprovalRequired;
|
||||
|
||||
bool get isInSession => _session != null && _session!.status != RemoteSessionStatus.disconnected;
|
||||
bool get isHost => _session?.isHost ?? false;
|
||||
@@ -55,12 +46,10 @@ class CompanionRemoteProvider with ChangeNotifier {
|
||||
String? get sessionId => _session?.sessionId;
|
||||
String? get pin => _session?.pin;
|
||||
RemoteDevice? get connectedDevice => _session?.connectedDevice;
|
||||
List<TrustedDevice> get trustedDevices => List.unmodifiable(_trustedDevices);
|
||||
bool get isPlayerActive => _isPlayerActive;
|
||||
|
||||
CompanionRemoteProvider() {
|
||||
_initializeDeviceInfo();
|
||||
_loadTrustedDevices();
|
||||
}
|
||||
|
||||
Future<void> _initializeDeviceInfo() async {
|
||||
@@ -117,12 +106,10 @@ class CompanionRemoteProvider with ChangeNotifier {
|
||||
},
|
||||
);
|
||||
|
||||
_deviceConnectedSubscription = _peerService!.onDeviceConnected.listen((device) async {
|
||||
_deviceConnectedSubscription = _peerService!.onDeviceConnected.listen((device) {
|
||||
appLogger.d('CompanionRemote: Device connected: ${device.name}');
|
||||
_session = _session?.copyWith(status: RemoteSessionStatus.connected, connectedDevice: device);
|
||||
notifyListeners();
|
||||
|
||||
await addTrustedDevice(device, requireApproval: isHost);
|
||||
});
|
||||
|
||||
_deviceDisconnectedSubscription = _peerService!.onDeviceDisconnected.listen((_) {
|
||||
@@ -375,92 +362,6 @@ class CompanionRemoteProvider with ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<void> _loadTrustedDevices() async {
|
||||
try {
|
||||
final storage = await StorageService.getInstance();
|
||||
final json = storage.prefs.getString(_storageKey);
|
||||
if (json != null) {
|
||||
final List<dynamic> list = jsonDecode(json);
|
||||
_trustedDevices.clear();
|
||||
_trustedDevices.addAll(list.map((e) => TrustedDevice.fromJson(e as Map<String, dynamic>)));
|
||||
appLogger.d('CompanionRemote: Loaded ${_trustedDevices.length} trusted devices');
|
||||
}
|
||||
} catch (e) {
|
||||
appLogger.e('CompanionRemote: Failed to load trusted devices', error: e);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> _saveTrustedDevices() async {
|
||||
try {
|
||||
final storage = await StorageService.getInstance();
|
||||
final json = jsonEncode(_trustedDevices.map((e) => e.toJson()).toList());
|
||||
await storage.prefs.setString(_storageKey, json);
|
||||
appLogger.d('CompanionRemote: Saved ${_trustedDevices.length} trusted devices');
|
||||
} catch (e) {
|
||||
appLogger.e('CompanionRemote: Failed to save trusted devices', error: e);
|
||||
}
|
||||
}
|
||||
|
||||
bool isDeviceTrusted(String peerId) {
|
||||
return _trustedDevices.any((d) => d.peerId == peerId && d.isApproved);
|
||||
}
|
||||
|
||||
Future<void> addTrustedDevice(RemoteDevice device, {bool requireApproval = true}) async {
|
||||
final existing = _trustedDevices.where((d) => d.peerId == device.id).firstOrNull;
|
||||
|
||||
if (existing != null) {
|
||||
final updated = existing.copyWith(
|
||||
deviceName: device.name,
|
||||
platform: device.platform,
|
||||
lastConnected: DateTime.now(),
|
||||
isApproved: !requireApproval || existing.isApproved,
|
||||
);
|
||||
_trustedDevices.remove(existing);
|
||||
_trustedDevices.add(updated);
|
||||
} else {
|
||||
bool approved = !requireApproval;
|
||||
|
||||
if (requireApproval && onDeviceApprovalRequired != null) {
|
||||
approved = await onDeviceApprovalRequired!(device);
|
||||
}
|
||||
|
||||
_trustedDevices.add(
|
||||
TrustedDevice(peerId: device.id, deviceName: device.name, platform: device.platform, isApproved: approved),
|
||||
);
|
||||
}
|
||||
|
||||
await _saveTrustedDevices();
|
||||
|
||||
if (isRemote) {
|
||||
final storage = await StorageService.getInstance();
|
||||
await storage.prefs.setString(_lastDeviceKey, device.id);
|
||||
}
|
||||
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<void> removeTrustedDevice(String peerId) async {
|
||||
_trustedDevices.removeWhere((d) => d.peerId == peerId);
|
||||
await _saveTrustedDevices();
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
Future<void> approveTrustedDevice(String peerId) async {
|
||||
final device = _trustedDevices.where((d) => d.peerId == peerId).firstOrNull;
|
||||
if (device != null) {
|
||||
final updated = device.copyWith(isApproved: true);
|
||||
_trustedDevices.remove(device);
|
||||
_trustedDevices.add(updated);
|
||||
await _saveTrustedDevices();
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
Future<String?> getLastConnectedDevicePeerId() async {
|
||||
final storage = await StorageService.getInstance();
|
||||
return storage.prefs.getString(_lastDeviceKey);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_reconnectTimer?.cancel();
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
import '../services/plex_client.dart';
|
||||
@@ -20,6 +22,7 @@ class LiveTvServerInfo {
|
||||
class MultiServerProvider extends ChangeNotifier {
|
||||
final MultiServerManager _serverManager;
|
||||
final DataAggregationService _aggregationService;
|
||||
StreamSubscription? _statusSubscription;
|
||||
|
||||
/// Whether any connected server has Live TV / DVR
|
||||
bool _hasLiveTv = false;
|
||||
@@ -31,7 +34,7 @@ class MultiServerProvider extends ChangeNotifier {
|
||||
|
||||
MultiServerProvider(this._serverManager, this._aggregationService) {
|
||||
// Listen to server status changes
|
||||
_serverManager.statusStream.listen((_) {
|
||||
_statusSubscription = _serverManager.statusStream.listen((_) {
|
||||
notifyListeners();
|
||||
// Re-check live TV availability when servers come online
|
||||
checkLiveTvAvailability();
|
||||
@@ -145,6 +148,7 @@ class MultiServerProvider extends ChangeNotifier {
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_statusSubscription?.cancel();
|
||||
_serverManager.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ class SettingsProvider extends ChangeNotifier {
|
||||
bool _showServerNameOnHubs = false;
|
||||
bool _alwaysKeepSidebarOpen = false;
|
||||
bool _showUnwatchedCount = true;
|
||||
bool _hideSpoilers = false;
|
||||
bool _isInitialized = false;
|
||||
Future<void>? _initFuture;
|
||||
|
||||
@@ -36,6 +37,7 @@ class SettingsProvider extends ChangeNotifier {
|
||||
_showServerNameOnHubs = _settingsService!.getShowServerNameOnHubs();
|
||||
_alwaysKeepSidebarOpen = _settingsService!.getAlwaysKeepSidebarOpen();
|
||||
_showUnwatchedCount = _settingsService!.getShowUnwatchedCount();
|
||||
_hideSpoilers = _settingsService!.getHideSpoilers();
|
||||
_isInitialized = true;
|
||||
notifyListeners();
|
||||
}
|
||||
@@ -59,6 +61,8 @@ class SettingsProvider extends ChangeNotifier {
|
||||
|
||||
bool get showUnwatchedCount => _showUnwatchedCount;
|
||||
|
||||
bool get hideSpoilers => _hideSpoilers;
|
||||
|
||||
/// Helper to update a setting: ensures init, deduplicates, persists, notifies.
|
||||
Future<void> _updateSetting<T>({
|
||||
required T current,
|
||||
@@ -122,6 +126,12 @@ class SettingsProvider extends ChangeNotifier {
|
||||
persist: _settingsService!.setShowUnwatchedCount,
|
||||
);
|
||||
|
||||
Future<void> setHideSpoilers(bool value) => _updateSetting(
|
||||
current: _hideSpoilers, value: value,
|
||||
setLocal: (v) => _hideSpoilers = v,
|
||||
persist: _settingsService!.setHideSpoilers,
|
||||
);
|
||||
|
||||
String get libraryDensityDisplayName {
|
||||
switch (_libraryDensity) {
|
||||
case LibraryDensity.compact:
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import 'dart:io' show Platform;
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import '../services/settings_service.dart' as settings;
|
||||
import '../theme/mono_theme.dart';
|
||||
@@ -24,6 +26,7 @@ class ThemeProvider extends ChangeNotifier {
|
||||
Future<void> _initializeSettings() async {
|
||||
_settingsService = await settings.SettingsService.getInstance();
|
||||
_themeMode = _settingsService.getThemeMode();
|
||||
_updateSplashTheme(_themeMode);
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
@@ -63,14 +66,28 @@ class ThemeProvider extends ChangeNotifier {
|
||||
}
|
||||
}
|
||||
|
||||
static const _themeChannel = MethodChannel('app.plezy/theme');
|
||||
|
||||
Future<void> setThemeMode(settings.ThemeMode mode) async {
|
||||
if (_themeMode != mode) {
|
||||
_themeMode = mode;
|
||||
await _settingsService.setThemeMode(mode);
|
||||
_updateSplashTheme(mode);
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
void _updateSplashTheme(settings.ThemeMode mode) {
|
||||
if (!Platform.isAndroid) return;
|
||||
final name = switch (mode) {
|
||||
settings.ThemeMode.dark => 'dark',
|
||||
settings.ThemeMode.oled => 'oled',
|
||||
settings.ThemeMode.light => 'light',
|
||||
settings.ThemeMode.system => 'system',
|
||||
};
|
||||
_themeChannel.invokeMethod('setSplashTheme', {'mode': name});
|
||||
}
|
||||
|
||||
String get themeModeDisplayName {
|
||||
switch (_themeMode) {
|
||||
case settings.ThemeMode.light:
|
||||
|
||||
@@ -17,6 +17,7 @@ import '../theme/mono_tokens.dart';
|
||||
import '../utils/app_logger.dart';
|
||||
import '../utils/platform_detector.dart';
|
||||
import '../focus/focusable_button.dart';
|
||||
import '../utils/navigation_transitions.dart';
|
||||
import 'main_screen.dart';
|
||||
|
||||
class AuthScreen extends StatefulWidget {
|
||||
@@ -96,6 +97,7 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||
multiServerProvider: context.read<MultiServerProvider>(),
|
||||
librariesProvider: context.read<LibrariesProvider>(),
|
||||
syncService: context.read<OfflineWatchSyncService>(),
|
||||
clientIdentifier: _authService.clientIdentifier,
|
||||
);
|
||||
|
||||
if (!result.hasConnections) {
|
||||
@@ -112,10 +114,7 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||
await profileFuture;
|
||||
|
||||
if (!mounted) return;
|
||||
Navigator.pushReplacement(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => MainScreen(client: result.firstClient!)),
|
||||
);
|
||||
Navigator.pushReplacement(context, fadeRoute(MainScreen(client: result.firstClient!)));
|
||||
} catch (e) {
|
||||
appLogger.e('Failed to connect to servers', error: e);
|
||||
setState(() {
|
||||
@@ -454,7 +453,7 @@ class _AuthScreenState extends State<AuthScreen> {
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
side: BorderSide(color: Theme.of(context).colorScheme.outline.withValues(alpha: 0.5)),
|
||||
),
|
||||
child: Text(t.auth.debugEnterToken, style: TextStyle(fontSize: 12)),
|
||||
child: Text(t.auth.debugEnterToken, style: const TextStyle(fontSize: 12)),
|
||||
),
|
||||
],
|
||||
if (_errorMessage != null) ...[
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import '../focus/focusable_action_bar.dart';
|
||||
import '../models/plex_metadata.dart';
|
||||
import '../widgets/desktop_app_bar.dart';
|
||||
import '../i18n/strings.g.dart';
|
||||
@@ -38,9 +39,6 @@ class _CollectionDetailScreenState extends BaseMediaListDetailScreen<CollectionD
|
||||
@override
|
||||
bool get hasItems => items.isNotEmpty;
|
||||
|
||||
@override
|
||||
int get appBarButtonCount => items.isNotEmpty ? 3 : 1; // play, shuffle, delete (or just delete if empty)
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
disposeFocusResources();
|
||||
@@ -69,23 +67,14 @@ class _CollectionDetailScreenState extends BaseMediaListDetailScreen<CollectionD
|
||||
}
|
||||
|
||||
@override
|
||||
List<AppBarButtonConfig> getAppBarButtons() {
|
||||
final buttons = <AppBarButtonConfig>[];
|
||||
if (items.isNotEmpty) {
|
||||
buttons.add(AppBarButtonConfig(icon: Symbols.play_arrow_rounded, tooltip: t.common.play, onPressed: playItems));
|
||||
buttons.add(
|
||||
AppBarButtonConfig(icon: Symbols.shuffle_rounded, tooltip: t.common.shuffle, onPressed: shufflePlayItems),
|
||||
);
|
||||
}
|
||||
buttons.add(
|
||||
AppBarButtonConfig(
|
||||
icon: Symbols.delete_rounded,
|
||||
tooltip: t.common.delete,
|
||||
onPressed: _deleteCollection,
|
||||
color: Colors.red,
|
||||
),
|
||||
);
|
||||
return buttons;
|
||||
List<FocusableAction> getAppBarActions() {
|
||||
return [
|
||||
if (items.isNotEmpty) ...[
|
||||
FocusableAction(icon: Symbols.play_arrow_rounded, tooltip: t.common.play, onPressed: playItems),
|
||||
FocusableAction(icon: Symbols.shuffle_rounded, tooltip: t.common.shuffle, onPressed: shufflePlayItems),
|
||||
],
|
||||
FocusableAction(icon: Symbols.delete_rounded, tooltip: t.common.delete, onPressed: _deleteCollection, iconColor: Colors.red),
|
||||
];
|
||||
}
|
||||
|
||||
Future<void> _deleteCollection() async {
|
||||
|
||||
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../models/companion_remote/remote_command_type.dart';
|
||||
import '../../models/companion_remote/remote_command.dart';
|
||||
import '../../models/companion_remote/remote_session.dart';
|
||||
import '../../i18n/strings.g.dart';
|
||||
import '../../providers/companion_remote_provider.dart';
|
||||
@@ -201,7 +201,7 @@ class _RemoteControlContentState extends State<_RemoteControlContent> {
|
||||
Container(
|
||||
width: 8,
|
||||
height: 8,
|
||||
decoration: BoxDecoration(color: Colors.green, shape: BoxShape.circle),
|
||||
decoration: const BoxDecoration(color: Colors.green, shape: BoxShape.circle),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -648,7 +648,7 @@ class _SearchBottomSheetState extends State<_SearchBottomSheet> {
|
||||
hintText: t.companionRemote.remote.searchHint,
|
||||
prefixIcon: const Icon(Icons.search),
|
||||
suffixIcon: IconButton(icon: const Icon(Icons.send), onPressed: () => _submit(_controller.text)),
|
||||
border: OutlineInputBorder(borderRadius: const BorderRadius.all(Radius.circular(100))),
|
||||
border: const OutlineInputBorder(borderRadius: BorderRadius.all(Radius.circular(100))),
|
||||
),
|
||||
onSubmitted: _submit,
|
||||
),
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:plezy/widgets/app_icon.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../focus/focusable_action_bar.dart';
|
||||
import '../focus/key_event_utils.dart';
|
||||
import '../utils/global_key_utils.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
@@ -131,14 +132,7 @@ class _DiscoverScreenState extends State<DiscoverScreen>
|
||||
|
||||
// Hero and app bar focus
|
||||
late FocusNode _heroFocusNode;
|
||||
late FocusNode _refreshButtonFocusNode;
|
||||
late FocusNode _watchTogetherButtonFocusNode;
|
||||
late FocusNode _companionRemoteButtonFocusNode;
|
||||
late FocusNode _userButtonFocusNode;
|
||||
bool _isRefreshFocused = false;
|
||||
bool _isWatchTogetherFocused = false;
|
||||
bool _isCompanionRemoteFocused = false;
|
||||
bool _isUserFocused = false;
|
||||
final _actionBarKey = GlobalKey<FocusableActionBarState>();
|
||||
|
||||
/// Get the correct PlexClient for an item's server
|
||||
PlexClient _getClientForItem(PlexMetadata? item) {
|
||||
@@ -188,7 +182,7 @@ class _DiscoverScreenState extends State<DiscoverScreen>
|
||||
if (_isHeroSectionVisible) {
|
||||
_heroFocusNode.requestFocus();
|
||||
} else {
|
||||
_refreshButtonFocusNode.requestFocus();
|
||||
_actionBarKey.currentState?.getFocusNode(0).requestFocus();
|
||||
}
|
||||
_scrollToTop();
|
||||
}
|
||||
@@ -245,14 +239,6 @@ class _DiscoverScreenState extends State<DiscoverScreen>
|
||||
super.initState();
|
||||
WidgetsBinding.instance.addObserver(this);
|
||||
_heroFocusNode = FocusNode(debugLabel: 'hero_section');
|
||||
_refreshButtonFocusNode = FocusNode(debugLabel: 'refresh_button');
|
||||
_watchTogetherButtonFocusNode = FocusNode(debugLabel: 'watch_together_button');
|
||||
_companionRemoteButtonFocusNode = FocusNode(debugLabel: 'companion_remote_button');
|
||||
_userButtonFocusNode = FocusNode(debugLabel: 'user_button');
|
||||
_refreshButtonFocusNode.addListener(_onRefreshFocusChange);
|
||||
_watchTogetherButtonFocusNode.addListener(_onWatchTogetherFocusChange);
|
||||
_companionRemoteButtonFocusNode.addListener(_onCompanionRemoteFocusChange);
|
||||
_userButtonFocusNode.addListener(_onUserFocusChange);
|
||||
_loadContent();
|
||||
_startAutoScroll();
|
||||
}
|
||||
@@ -272,45 +258,13 @@ class _DiscoverScreenState extends State<DiscoverScreen>
|
||||
_loadContent();
|
||||
}
|
||||
|
||||
void _onRefreshFocusChange() {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_isRefreshFocused = _refreshButtonFocusNode.hasFocus;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void _onWatchTogetherFocusChange() {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_isWatchTogetherFocused = _watchTogetherButtonFocusNode.hasFocus;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void _onCompanionRemoteFocusChange() {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_isCompanionRemoteFocused = _companionRemoteButtonFocusNode.hasFocus;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void _onUserFocusChange() {
|
||||
if (mounted) {
|
||||
setState(() {
|
||||
_isUserFocused = _userButtonFocusNode.hasFocus;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// Handle key events for the hero section
|
||||
late final _handleHeroKeyEvent = dpadKeyHandler(
|
||||
onDown: () {
|
||||
final keys = _allHubKeys;
|
||||
if (keys.isNotEmpty) keys.first.currentState?.requestFocusFromMemory();
|
||||
},
|
||||
onUp: () => _refreshButtonFocusNode.requestFocus(),
|
||||
onUp: () => _actionBarKey.currentState?.getFocusNode(0).requestFocus(),
|
||||
onLeft: () {
|
||||
if (_currentHeroIndex > 0) {
|
||||
_heroController.previousPage(duration: tokens(context).slow, curve: Curves.easeInOut);
|
||||
@@ -330,45 +284,6 @@ class _DiscoverScreenState extends State<DiscoverScreen>
|
||||
},
|
||||
);
|
||||
|
||||
/// Handle key events for the refresh button in app bar
|
||||
late final _handleRefreshKeyEvent = dpadKeyHandler(
|
||||
onDown: _focusContentFromAppBar,
|
||||
onRight: () => _watchTogetherButtonFocusNode.requestFocus(),
|
||||
onLeft: _navigateToSidebar,
|
||||
onUp: () {}, // Block at boundary
|
||||
onSelect: _loadContent,
|
||||
);
|
||||
|
||||
/// Handle key events for the watch together button in app bar
|
||||
late final _handleWatchTogetherKeyEvent = dpadKeyHandler(
|
||||
onDown: _focusContentFromAppBar,
|
||||
onLeft: () => _refreshButtonFocusNode.requestFocus(),
|
||||
onRight: () => _companionRemoteButtonFocusNode.requestFocus(),
|
||||
onUp: () {}, // Block at boundary
|
||||
onSelect: () => Navigator.push(context, MaterialPageRoute(builder: (_) => const WatchTogetherScreen())),
|
||||
);
|
||||
|
||||
/// Handle key events for the companion remote button in app bar
|
||||
late final _handleCompanionRemoteKeyEvent = dpadKeyHandler(
|
||||
onDown: () => _heroFocusNode.requestFocus(),
|
||||
onLeft: () => _watchTogetherButtonFocusNode.requestFocus(),
|
||||
onRight: () => _userButtonFocusNode.requestFocus(),
|
||||
onUp: () {}, // Block at boundary
|
||||
onSelect: () => RemoteSessionDialog.show(context),
|
||||
);
|
||||
|
||||
/// Handle key events for the user button in app bar
|
||||
late final _handleUserKeyEvent = dpadKeyHandler(
|
||||
onDown: _focusContentFromAppBar,
|
||||
onLeft: () => _companionRemoteButtonFocusNode.requestFocus(),
|
||||
onRight: () {}, // Block at boundary
|
||||
onUp: () {}, // Block at boundary
|
||||
onSelect: () {
|
||||
final userProvider = context.read<UserProfileProvider>();
|
||||
_showUserMenu(context, userProvider);
|
||||
},
|
||||
);
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_hiddenLibrariesProvider?.removeListener(_onHiddenLibrariesChanged);
|
||||
@@ -379,14 +294,6 @@ class _DiscoverScreenState extends State<DiscoverScreen>
|
||||
_heroController.dispose();
|
||||
_scrollController.dispose();
|
||||
_heroFocusNode.dispose();
|
||||
_refreshButtonFocusNode.removeListener(_onRefreshFocusChange);
|
||||
_refreshButtonFocusNode.dispose();
|
||||
_watchTogetherButtonFocusNode.removeListener(_onWatchTogetherFocusChange);
|
||||
_watchTogetherButtonFocusNode.dispose();
|
||||
_companionRemoteButtonFocusNode.removeListener(_onCompanionRemoteFocusChange);
|
||||
_companionRemoteButtonFocusNode.dispose();
|
||||
_userButtonFocusNode.removeListener(_onUserFocusChange);
|
||||
_userButtonFocusNode.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@@ -849,7 +756,10 @@ class _DiscoverScreenState extends State<DiscoverScreen>
|
||||
|
||||
/// Show user menu programmatically (for D-pad select)
|
||||
void _showUserMenu(BuildContext context, UserProfileProvider userProvider) {
|
||||
final RenderBox? button = _userButtonFocusNode.context?.findRenderObject() as RenderBox?;
|
||||
final actionBar = _actionBarKey.currentState;
|
||||
if (actionBar == null) return;
|
||||
final lastNode = actionBar.getFocusNode(actionBar.widget.actions.length - 1);
|
||||
final RenderBox? button = lastNode.context?.findRenderObject() as RenderBox?;
|
||||
if (button == null) return;
|
||||
|
||||
final RenderBox overlay = Navigator.of(context).overlay!.context.findRenderObject() as RenderBox;
|
||||
@@ -869,12 +779,18 @@ class _DiscoverScreenState extends State<DiscoverScreen>
|
||||
PopupMenuItem(
|
||||
value: 'switch_profile',
|
||||
child: Row(
|
||||
children: [AppIcon(Symbols.people_rounded, fill: 1), SizedBox(width: 8), Text(t.discover.switchProfile)],
|
||||
children: [
|
||||
AppIcon(Symbols.people_rounded, fill: 1),
|
||||
const SizedBox(width: 8),
|
||||
Text(t.discover.switchProfile),
|
||||
],
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: 'logout',
|
||||
child: Row(children: [AppIcon(Symbols.logout_rounded, fill: 1), SizedBox(width: 8), Text(t.common.logout)]),
|
||||
child: Row(
|
||||
children: [AppIcon(Symbols.logout_rounded, fill: 1), const SizedBox(width: 8), Text(t.common.logout)],
|
||||
),
|
||||
),
|
||||
],
|
||||
).then((value) {
|
||||
@@ -916,171 +832,149 @@ class _DiscoverScreenState extends State<DiscoverScreen>
|
||||
).textTheme.titleLarge?.copyWith(color: Colors.white, fontWeight: FontWeight.bold),
|
||||
),
|
||||
const Spacer(),
|
||||
Focus(
|
||||
focusNode: _refreshButtonFocusNode,
|
||||
onKeyEvent: _handleRefreshKeyEvent,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: _isRefreshFocused ? Colors.white.withValues(alpha: 0.2) : Colors.transparent,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(20)),
|
||||
),
|
||||
child: IconButton(
|
||||
icon: const AppIcon(Symbols.refresh_rounded, fill: 1, color: Colors.white),
|
||||
onPressed: _loadContent,
|
||||
),
|
||||
),
|
||||
),
|
||||
// Watch Together button
|
||||
Consumer<WatchTogetherProvider>(
|
||||
builder: (context, watchTogether, child) {
|
||||
return Focus(
|
||||
focusNode: _watchTogetherButtonFocusNode,
|
||||
onKeyEvent: _handleWatchTogetherKeyEvent,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: _isWatchTogetherFocused ? Colors.white.withValues(alpha: 0.2) : Colors.transparent,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(20)),
|
||||
),
|
||||
child: Stack(
|
||||
children: [
|
||||
IconButton(
|
||||
icon: AppIcon(
|
||||
Symbols.group_rounded,
|
||||
fill: watchTogether.isInSession ? 1 : 0,
|
||||
color: watchTogether.isInSession ? Theme.of(context).colorScheme.primary : Colors.white,
|
||||
Consumer2<WatchTogetherProvider, CompanionRemoteProvider>(
|
||||
builder: (context, watchTogether, companionRemote, _) {
|
||||
final isDesktop = PlatformDetector.isDesktop(context);
|
||||
final userProvider = context.watch<UserProfileProvider>();
|
||||
|
||||
return FocusableActionBar(
|
||||
key: _actionBarKey,
|
||||
onNavigateLeft: _navigateToSidebar,
|
||||
onNavigateDown: _focusContentFromAppBar,
|
||||
actions: [
|
||||
FocusableAction(icon: Symbols.refresh_rounded, iconColor: Colors.white, onPressed: _loadContent),
|
||||
// Watch Together
|
||||
FocusableAction(
|
||||
onPressed: () =>
|
||||
Navigator.push(context, MaterialPageRoute(builder: (_) => const WatchTogetherScreen())),
|
||||
child: Stack(
|
||||
children: [
|
||||
IconButton(
|
||||
icon: AppIcon(
|
||||
Symbols.group_rounded,
|
||||
fill: watchTogether.isInSession ? 1 : 0,
|
||||
color: watchTogether.isInSession ? Theme.of(context).colorScheme.primary : Colors.white,
|
||||
),
|
||||
onPressed: () => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (_) => const WatchTogetherScreen()),
|
||||
),
|
||||
tooltip: 'Watch Together',
|
||||
),
|
||||
onPressed: () =>
|
||||
Navigator.push(context, MaterialPageRoute(builder: (_) => const WatchTogetherScreen())),
|
||||
tooltip: 'Watch Together',
|
||||
),
|
||||
// Badge showing participant count when in session
|
||||
if (watchTogether.isInSession && watchTogether.participantCount > 1)
|
||||
Positioned(
|
||||
top: 6,
|
||||
right: 6,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 1),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
||||
),
|
||||
child: Text(
|
||||
'${watchTogether.participantCount}',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.onPrimary,
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.bold,
|
||||
if (watchTogether.isInSession && watchTogether.participantCount > 1)
|
||||
Positioned(
|
||||
top: 6,
|
||||
right: 6,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 1),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
||||
),
|
||||
child: Text(
|
||||
'${watchTogether.participantCount}',
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.onPrimary,
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
// Companion Remote button
|
||||
Consumer<CompanionRemoteProvider>(
|
||||
builder: (context, companionRemote, child) {
|
||||
final isDesktop = PlatformDetector.isDesktop(context);
|
||||
final hasDpadNav = isDesktop || PlatformDetector.isTV();
|
||||
|
||||
return Focus(
|
||||
focusNode: hasDpadNav ? _companionRemoteButtonFocusNode : null,
|
||||
onKeyEvent: hasDpadNav ? _handleCompanionRemoteKeyEvent : null,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: hasDpadNav && _isCompanionRemoteFocused
|
||||
? Colors.white.withValues(alpha: 0.2)
|
||||
: Colors.transparent,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(20)),
|
||||
),
|
||||
child: Stack(
|
||||
children: [
|
||||
IconButton(
|
||||
icon: AppIcon(
|
||||
Symbols.phone_android_rounded,
|
||||
fill: companionRemote.isConnected ? 1 : 0,
|
||||
color: companionRemote.isConnected ? Theme.of(context).colorScheme.primary : Colors.white,
|
||||
),
|
||||
onPressed: () {
|
||||
if (isDesktop) {
|
||||
RemoteSessionDialog.show(context);
|
||||
} else {
|
||||
Navigator.push(context, MaterialPageRoute(builder: (context) => MobileRemoteScreen()));
|
||||
}
|
||||
},
|
||||
tooltip: t.companionRemote.title,
|
||||
),
|
||||
// Badge showing connection status
|
||||
if (companionRemote.isConnected)
|
||||
Positioned(
|
||||
top: 6,
|
||||
right: 6,
|
||||
child: Container(
|
||||
width: 8,
|
||||
height: 8,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.green,
|
||||
shape: BoxShape.circle,
|
||||
border: const Border.fromBorderSide(BorderSide(color: Colors.white, width: 1)),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
Consumer<UserProfileProvider>(
|
||||
builder: (context, userProvider, child) {
|
||||
return Focus(
|
||||
focusNode: _userButtonFocusNode,
|
||||
onKeyEvent: _handleUserKeyEvent,
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: _isUserFocused ? Colors.white.withValues(alpha: 0.2) : Colors.transparent,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(20)),
|
||||
),
|
||||
child: PopupMenuButton<String>(
|
||||
icon: userProvider.currentUser?.thumb != null
|
||||
? UserAvatarWidget(user: userProvider.currentUser!, size: 32, showIndicators: false)
|
||||
: const AppIcon(Symbols.account_circle_rounded, fill: 1, size: 32, color: Colors.white),
|
||||
onSelected: (value) {
|
||||
if (value == 'switch_profile') {
|
||||
_handleSwitchProfile(context);
|
||||
} else if (value == 'logout') {
|
||||
_handleLogout();
|
||||
// Companion Remote
|
||||
FocusableAction(
|
||||
onPressed: () {
|
||||
if (isDesktop) {
|
||||
RemoteSessionDialog.show(context);
|
||||
} else {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => const MobileRemoteScreen()),
|
||||
);
|
||||
}
|
||||
},
|
||||
itemBuilder: (context) => [
|
||||
// Only show Switch Profile if multiple users available
|
||||
if (userProvider.hasMultipleUsers)
|
||||
child: Stack(
|
||||
children: [
|
||||
IconButton(
|
||||
icon: AppIcon(
|
||||
Symbols.phone_android_rounded,
|
||||
fill: companionRemote.isConnected ? 1 : 0,
|
||||
color: companionRemote.isConnected
|
||||
? Theme.of(context).colorScheme.primary
|
||||
: Colors.white,
|
||||
),
|
||||
onPressed: () {
|
||||
if (isDesktop) {
|
||||
RemoteSessionDialog.show(context);
|
||||
} else {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => const MobileRemoteScreen()),
|
||||
);
|
||||
}
|
||||
},
|
||||
tooltip: t.companionRemote.title,
|
||||
),
|
||||
if (companionRemote.isConnected)
|
||||
Positioned(
|
||||
top: 6,
|
||||
right: 6,
|
||||
child: Container(
|
||||
width: 8,
|
||||
height: 8,
|
||||
decoration: const BoxDecoration(
|
||||
color: Colors.green,
|
||||
shape: BoxShape.circle,
|
||||
border: Border.fromBorderSide(BorderSide(color: Colors.white, width: 1)),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
// User menu
|
||||
FocusableAction(
|
||||
onPressed: () => _showUserMenu(context, userProvider),
|
||||
child: PopupMenuButton<String>(
|
||||
icon: userProvider.currentUser?.thumb != null
|
||||
? UserAvatarWidget(user: userProvider.currentUser!, size: 32, showIndicators: false)
|
||||
: const AppIcon(Symbols.account_circle_rounded, fill: 1, size: 32, color: Colors.white),
|
||||
onSelected: (value) {
|
||||
if (value == 'switch_profile') {
|
||||
_handleSwitchProfile(context);
|
||||
} else if (value == 'logout') {
|
||||
_handleLogout();
|
||||
}
|
||||
},
|
||||
itemBuilder: (context) => [
|
||||
if (userProvider.hasMultipleUsers)
|
||||
PopupMenuItem(
|
||||
value: 'switch_profile',
|
||||
child: Row(
|
||||
children: [
|
||||
AppIcon(Symbols.people_rounded, fill: 1),
|
||||
const SizedBox(width: 8),
|
||||
Text(t.discover.switchProfile),
|
||||
],
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: 'switch_profile',
|
||||
value: 'logout',
|
||||
child: Row(
|
||||
children: [
|
||||
AppIcon(Symbols.people_rounded, fill: 1),
|
||||
SizedBox(width: 8),
|
||||
Text(t.discover.switchProfile),
|
||||
AppIcon(Symbols.logout_rounded, fill: 1),
|
||||
const SizedBox(width: 8),
|
||||
Text(t.common.logout),
|
||||
],
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: 'logout',
|
||||
child: Row(
|
||||
children: [
|
||||
AppIcon(Symbols.logout_rounded, fill: 1),
|
||||
SizedBox(width: 8),
|
||||
Text(t.common.logout),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
@@ -1215,11 +1109,11 @@ class _DiscoverScreenState extends State<DiscoverScreen>
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
AppIcon(Symbols.movie_rounded, fill: 1, size: 64, color: Colors.grey),
|
||||
SizedBox(height: 16),
|
||||
const AppIcon(Symbols.movie_rounded, fill: 1, size: 64, color: Colors.grey),
|
||||
const SizedBox(height: 16),
|
||||
Text(t.discover.noContentAvailable),
|
||||
SizedBox(height: 8),
|
||||
Text(t.discover.addMediaToLibraries, style: TextStyle(color: Colors.grey)),
|
||||
const SizedBox(height: 8),
|
||||
Text(t.discover.addMediaToLibraries, style: const TextStyle(color: Colors.grey)),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -1264,7 +1158,7 @@ class _DiscoverScreenState extends State<DiscoverScreen>
|
||||
}
|
||||
},
|
||||
itemBuilder: (context, index) {
|
||||
return _buildHeroItem(_onDeck[index]);
|
||||
return _buildHeroItem(_onDeck[index], heroHeight);
|
||||
},
|
||||
),
|
||||
// Bottom gradient that extends past hero bounds to ensure seamless blend
|
||||
@@ -1380,7 +1274,7 @@ class _DiscoverScreenState extends State<DiscoverScreen>
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildHeroItem(PlexMetadata heroItem) {
|
||||
Widget _buildHeroItem(PlexMetadata heroItem, double heroHeight) {
|
||||
final isEpisode = heroItem.isEpisode;
|
||||
final showName = heroItem.grandparentTitle ?? heroItem.title;
|
||||
final screenWidth = MediaQuery.of(context).size.width;
|
||||
@@ -1389,6 +1283,10 @@ class _DiscoverScreenState extends State<DiscoverScreen>
|
||||
// Determine content type label for chip
|
||||
final contentTypeLabel = heroItem.isMovie ? t.discover.movie : t.discover.tvShow;
|
||||
|
||||
// Spoiler protection
|
||||
final hideSpoilers = context.watch<SettingsProvider>().hideSpoilers;
|
||||
final shouldHideSpoiler = hideSpoilers && heroItem.shouldHideSpoiler;
|
||||
|
||||
// Build semantic label for hero item
|
||||
final heroLabel = isEpisode ? "${heroItem.grandparentTitle}, ${heroItem.title}" : heroItem.title;
|
||||
|
||||
@@ -1406,7 +1304,7 @@ class _DiscoverScreenState extends State<DiscoverScreen>
|
||||
clipBehavior: Clip.none,
|
||||
children: [
|
||||
// Background Image with fade/zoom animation and parallax
|
||||
if (heroItem.art != null || heroItem.grandparentArt != null)
|
||||
if (heroItem.art != null || heroItem.backgroundSquare != null || heroItem.grandparentArt != null)
|
||||
ClipRect(
|
||||
child: AnimatedBuilder(
|
||||
animation: _scrollController,
|
||||
@@ -1429,9 +1327,10 @@ class _DiscoverScreenState extends State<DiscoverScreen>
|
||||
final client = _getClientForItem(heroItem);
|
||||
final mediaQuery = MediaQuery.of(context);
|
||||
final dpr = PlexImageHelper.effectiveDevicePixelRatio(context);
|
||||
final containerAspect = screenWidth / heroHeight;
|
||||
final imageUrl = PlexImageHelper.getOptimizedImageUrl(
|
||||
client: client,
|
||||
thumbPath: heroItem.art ?? heroItem.grandparentArt,
|
||||
thumbPath: heroItem.heroArt(containerAspectRatio: containerAspect) ?? heroItem.grandparentArt,
|
||||
maxWidth: mediaQuery.size.width,
|
||||
maxHeight: mediaQuery.size.height * 0.7,
|
||||
devicePixelRatio: dpr,
|
||||
@@ -1597,7 +1496,7 @@ class _DiscoverScreenState extends State<DiscoverScreen>
|
||||
if (!isLargeScreen) ...[const SizedBox(height: 20), _buildSmartPlayButton(heroItem)],
|
||||
|
||||
// Summary with episode info (Apple TV style)
|
||||
if (heroItem.summary != null) ...[
|
||||
if (heroItem.summary != null && !shouldHideSpoiler) ...[
|
||||
const SizedBox(height: 12),
|
||||
RichText(
|
||||
maxLines: 2,
|
||||
@@ -1628,6 +1527,21 @@ class _DiscoverScreenState extends State<DiscoverScreen>
|
||||
],
|
||||
),
|
||||
),
|
||||
] else if (shouldHideSpoiler && isEpisode && heroItem.parentIndex != null && heroItem.index != null) ...[
|
||||
const SizedBox(height: 12),
|
||||
Text(
|
||||
'S${heroItem.parentIndex}, E${heroItem.index}: ${heroItem.title}',
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
textAlign: isLargeScreen ? TextAlign.left : TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: isLargeScreen
|
||||
? Colors.white.withValues(alpha: 0.7)
|
||||
: Theme.of(context).colorScheme.onSurface.withValues(alpha: 0.7),
|
||||
fontSize: 14,
|
||||
height: 1.4,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
// On large screens: show button after summary
|
||||
@@ -1692,7 +1606,7 @@ class _DiscoverScreenState extends State<DiscoverScreen>
|
||||
] else
|
||||
Text(
|
||||
t.common.play,
|
||||
style: TextStyle(color: Colors.black, fontSize: 14, fontWeight: FontWeight.w600),
|
||||
style: const TextStyle(color: Colors.black, fontSize: 14, fontWeight: FontWeight.w600),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -1,26 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../focus/dpad_navigator.dart';
|
||||
import '../focus/focusable_action_bar.dart';
|
||||
import '../focus/input_mode_tracker.dart';
|
||||
import '../focus/key_event_utils.dart';
|
||||
import '../mixins/grid_focus_node_mixin.dart';
|
||||
import '../providers/settings_provider.dart';
|
||||
import '../utils/grid_size_calculator.dart';
|
||||
import '../widgets/app_icon.dart';
|
||||
import '../widgets/focusable_media_card.dart';
|
||||
import '../widgets/media_grid_delegate.dart';
|
||||
|
||||
/// Configuration for app bar buttons
|
||||
class AppBarButtonConfig {
|
||||
final IconData icon;
|
||||
final String tooltip;
|
||||
final VoidCallback onPressed;
|
||||
final Color? color;
|
||||
|
||||
const AppBarButtonConfig({required this.icon, required this.tooltip, required this.onPressed, this.color});
|
||||
}
|
||||
|
||||
/// Mixin that provides common focus navigation functionality for detail screens.
|
||||
/// Handles app bar focus, back navigation, scroll-to-top, and grid item focus management.
|
||||
///
|
||||
@@ -29,36 +16,27 @@ mixin FocusableDetailScreenMixin<T extends StatefulWidget> on State<T>, GridFocu
|
||||
// Scroll controller for scrolling to top when app bar is focused
|
||||
final ScrollController scrollController = ScrollController();
|
||||
|
||||
// App bar focus nodes
|
||||
final FocusNode playButtonFocusNode = FocusNode(debugLabel: 'detail_play');
|
||||
final FocusNode shuffleButtonFocusNode = FocusNode(debugLabel: 'detail_shuffle');
|
||||
final FocusNode deleteButtonFocusNode = FocusNode(debugLabel: 'detail_delete');
|
||||
// Action bar key for accessing focus nodes
|
||||
final GlobalKey<FocusableActionBarState> actionBarKey = GlobalKey<FocusableActionBarState>();
|
||||
|
||||
// Grid item focus
|
||||
final FocusNode firstItemFocusNode = FocusNode(debugLabel: 'detail_first_item');
|
||||
|
||||
// App bar focus state
|
||||
bool isAppBarFocused = false;
|
||||
int appBarFocusedButton = 0; // 0=play, 1=shuffle, 2=delete (or less if fewer buttons)
|
||||
|
||||
// Flag to prevent PopScope from exiting when BACK was handled by a key handler
|
||||
bool backHandledByKeyEvent = false;
|
||||
|
||||
/// Number of app bar buttons (override if different from 3)
|
||||
int get appBarButtonCount => 3;
|
||||
|
||||
/// Called when items are available and we want to check if focus should be set
|
||||
bool get hasItems;
|
||||
|
||||
/// Called to get the list of app bar button configurations
|
||||
List<AppBarButtonConfig> getAppBarButtons();
|
||||
/// Called to get the list of app bar action configurations
|
||||
List<FocusableAction> getAppBarActions();
|
||||
|
||||
/// Dispose focus-related resources. Call this from your dispose() method.
|
||||
void disposeFocusResources() {
|
||||
scrollController.dispose();
|
||||
playButtonFocusNode.dispose();
|
||||
shuffleButtonFocusNode.dispose();
|
||||
deleteButtonFocusNode.dispose();
|
||||
firstItemFocusNode.dispose();
|
||||
disposeGridFocusNodes();
|
||||
}
|
||||
@@ -67,9 +45,8 @@ mixin FocusableDetailScreenMixin<T extends StatefulWidget> on State<T>, GridFocu
|
||||
void navigateToAppBar() {
|
||||
setState(() {
|
||||
isAppBarFocused = true;
|
||||
appBarFocusedButton = 0;
|
||||
});
|
||||
_focusAppBarButton(0);
|
||||
actionBarKey.currentState?.getFocusNode(0).requestFocus();
|
||||
// Scroll to top to show the app bar
|
||||
scrollController.animateTo(0, duration: const Duration(milliseconds: 200), curve: Curves.easeOut);
|
||||
}
|
||||
@@ -115,103 +92,16 @@ mixin FocusableDetailScreenMixin<T extends StatefulWidget> on State<T>, GridFocu
|
||||
}
|
||||
}
|
||||
|
||||
/// Focus a specific app bar button by index
|
||||
void _focusAppBarButton(int index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
playButtonFocusNode.requestFocus();
|
||||
break;
|
||||
case 1:
|
||||
shuffleButtonFocusNode.requestFocus();
|
||||
break;
|
||||
case 2:
|
||||
deleteButtonFocusNode.requestFocus();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// Handle key events when app bar is focused
|
||||
KeyEventResult handleAppBarKeyEvent(FocusNode _, KeyEvent event) {
|
||||
final key = event.logicalKey;
|
||||
final maxButton = appBarButtonCount - 1;
|
||||
|
||||
final backResult = handleBackKeyAction(event, () => Navigator.pop(context));
|
||||
if (backResult != KeyEventResult.ignored) {
|
||||
return backResult;
|
||||
}
|
||||
|
||||
if (event is! KeyDownEvent) return KeyEventResult.ignored;
|
||||
|
||||
if (key.isLeftKey && appBarFocusedButton > 0) {
|
||||
setState(() => appBarFocusedButton--);
|
||||
_focusAppBarButton(appBarFocusedButton);
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
if (key.isRightKey && appBarFocusedButton < maxButton) {
|
||||
setState(() => appBarFocusedButton++);
|
||||
_focusAppBarButton(appBarFocusedButton);
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
if (key.isDownKey) {
|
||||
// Return focus to grid
|
||||
navigateToGrid();
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
if (key.isSelectKey) {
|
||||
final buttons = getAppBarButtons();
|
||||
if (appBarFocusedButton < buttons.length) {
|
||||
buttons[appBarFocusedButton].onPressed();
|
||||
}
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
return KeyEventResult.ignored;
|
||||
}
|
||||
|
||||
/// Build focusable app bar action widgets
|
||||
List<Widget> buildFocusableAppBarActions() {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final isKeyboardMode = InputModeTracker.isKeyboardMode(context);
|
||||
final buttons = getAppBarButtons();
|
||||
|
||||
return buttons.asMap().entries.map((entry) {
|
||||
final index = entry.key;
|
||||
final config = entry.value;
|
||||
final isFocused = isKeyboardMode && isAppBarFocused && appBarFocusedButton == index;
|
||||
|
||||
FocusNode focusNode;
|
||||
switch (index) {
|
||||
case 0:
|
||||
focusNode = playButtonFocusNode;
|
||||
break;
|
||||
case 1:
|
||||
focusNode = shuffleButtonFocusNode;
|
||||
break;
|
||||
case 2:
|
||||
focusNode = deleteButtonFocusNode;
|
||||
break;
|
||||
default:
|
||||
focusNode = FocusNode();
|
||||
}
|
||||
|
||||
return Focus(
|
||||
focusNode: focusNode,
|
||||
onKeyEvent: handleAppBarKeyEvent,
|
||||
child: Container(
|
||||
decoration: isFocused
|
||||
? BoxDecoration(
|
||||
color: colorScheme.surfaceContainerHighest,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(20)),
|
||||
)
|
||||
: null,
|
||||
child: IconButton(
|
||||
icon: AppIcon(config.icon, fill: 1),
|
||||
tooltip: config.tooltip,
|
||||
onPressed: config.onPressed,
|
||||
color: config.color,
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList();
|
||||
return [
|
||||
FocusableActionBar(
|
||||
key: actionBarKey,
|
||||
onNavigateDown: navigateToGrid,
|
||||
onBack: () => Navigator.pop(context),
|
||||
actions: getAppBarActions(),
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
/// Auto-focus first item after load if in keyboard mode.
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:plezy/widgets/app_icon.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import '../../services/plex_client.dart';
|
||||
@@ -15,11 +14,8 @@ import '../widgets/focusable_media_card.dart';
|
||||
import '../widgets/media_grid_delegate.dart';
|
||||
import '../widgets/desktop_app_bar.dart';
|
||||
import '../widgets/overlay_sheet.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import '../focus/dpad_navigator.dart';
|
||||
import '../focus/focus_theme.dart';
|
||||
import '../focus/focusable_action_bar.dart';
|
||||
import '../focus/input_mode_tracker.dart';
|
||||
import '../focus/key_event_utils.dart';
|
||||
import '../mixins/grid_focus_node_mixin.dart';
|
||||
import 'libraries/sort_bottom_sheet.dart';
|
||||
import 'libraries/state_messages.dart';
|
||||
@@ -48,7 +44,7 @@ class _HubDetailScreenState extends State<HubDetailScreen> with Refreshable, Gri
|
||||
String? _errorMessage;
|
||||
|
||||
late final FocusNode _firstItemFocusNode = FocusNode(debugLabel: 'hub_detail_first_item');
|
||||
late final FocusNode _sortButtonFocusNode = FocusNode(debugLabel: 'hub_detail_sort');
|
||||
final _actionBarKey = GlobalKey<FocusableActionBarState>();
|
||||
bool _isAppBarFocused = false;
|
||||
bool _backHandledByKeyEvent = false;
|
||||
|
||||
@@ -63,7 +59,6 @@ class _HubDetailScreenState extends State<HubDetailScreen> with Refreshable, Gri
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_sortButtonFocusNode.addListener(_onSortButtonFocusChange);
|
||||
// Start with items already loaded in the hub
|
||||
_items = widget.hub.items;
|
||||
_filteredItems = widget.hub.items;
|
||||
@@ -84,23 +79,11 @@ class _HubDetailScreenState extends State<HubDetailScreen> with Refreshable, Gri
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_sortButtonFocusNode.removeListener(_onSortButtonFocusChange);
|
||||
_firstItemFocusNode.dispose();
|
||||
_sortButtonFocusNode.dispose();
|
||||
disposeGridFocusNodes();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _onSortButtonFocusChange() {
|
||||
if (!mounted) return;
|
||||
final hasFocus = _sortButtonFocusNode.hasFocus;
|
||||
if (hasFocus && !_isAppBarFocused) {
|
||||
setState(() => _isAppBarFocused = true);
|
||||
} else if (!hasFocus && _isAppBarFocused) {
|
||||
setState(() => _isAppBarFocused = false);
|
||||
}
|
||||
}
|
||||
|
||||
void _focusGrid() {
|
||||
if (_filteredItems.isEmpty) return;
|
||||
final targetIndex =
|
||||
@@ -114,7 +97,7 @@ class _HubDetailScreenState extends State<HubDetailScreen> with Refreshable, Gri
|
||||
|
||||
void _navigateToAppBar() {
|
||||
setState(() => _isAppBarFocused = true);
|
||||
_sortButtonFocusNode.requestFocus();
|
||||
_actionBarKey.currentState?.getFocusNode(0).requestFocus();
|
||||
}
|
||||
|
||||
void _handleBackFromContent() {
|
||||
@@ -122,24 +105,6 @@ class _HubDetailScreenState extends State<HubDetailScreen> with Refreshable, Gri
|
||||
_navigateToAppBar();
|
||||
}
|
||||
|
||||
KeyEventResult _handleSortButtonKeyEvent(FocusNode _, KeyEvent event) {
|
||||
final key = event.logicalKey;
|
||||
|
||||
final backResult = handleBackKeyAction(event, () => Navigator.pop(context));
|
||||
if (backResult != KeyEventResult.ignored) return backResult;
|
||||
|
||||
if (event is! KeyDownEvent) return KeyEventResult.ignored;
|
||||
|
||||
if (key.isDownKey) {
|
||||
_focusGrid();
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
if (key.isSelectKey) {
|
||||
_showSortBottomSheet();
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
return KeyEventResult.ignored;
|
||||
}
|
||||
|
||||
Future<void> _loadSorts() async {
|
||||
try {
|
||||
@@ -315,7 +280,6 @@ class _HubDetailScreenState extends State<HubDetailScreen> with Refreshable, Gri
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final isKeyboardMode = InputModeTracker.isKeyboardMode(context);
|
||||
final sortButtonFocused = isKeyboardMode && _isAppBarFocused;
|
||||
|
||||
return PopScope(
|
||||
canPop: !isKeyboardMode || _isAppBarFocused,
|
||||
@@ -336,16 +300,17 @@ class _HubDetailScreenState extends State<HubDetailScreen> with Refreshable, Gri
|
||||
title: Text(widget.hub.title),
|
||||
pinned: true,
|
||||
actions: [
|
||||
Focus(
|
||||
focusNode: _sortButtonFocusNode,
|
||||
onKeyEvent: _handleSortButtonKeyEvent,
|
||||
child: Container(
|
||||
decoration: FocusTheme.focusBackgroundDecoration(isFocused: sortButtonFocused, borderRadius: 20),
|
||||
child: IconButton(
|
||||
icon: AppIcon(Symbols.swap_vert_rounded, fill: 1, semanticLabel: t.libraries.sort),
|
||||
FocusableActionBar(
|
||||
key: _actionBarKey,
|
||||
onNavigateDown: _focusGrid,
|
||||
onBack: () => Navigator.pop(context),
|
||||
actions: [
|
||||
FocusableAction(
|
||||
icon: Symbols.swap_vert_rounded,
|
||||
tooltip: t.libraries.sort,
|
||||
onPressed: _showSortBottomSheet,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -3,7 +3,7 @@ import 'dart:async';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import '../models/plex_first_character.dart';
|
||||
import '../../models/plex_first_character.dart';
|
||||
import 'alpha_jump_helper.dart';
|
||||
|
||||
/// Vertical strip of letters for jumping through sorted library items.
|
||||
@@ -1,5 +1,5 @@
|
||||
import '../data/ducet_order.dart';
|
||||
import '../models/plex_first_character.dart';
|
||||
import '../../data/ducet_order.dart';
|
||||
import '../../models/plex_first_character.dart';
|
||||
|
||||
/// Shared letter-index mapping logic used by both [AlphaJumpBar] (desktop/tablet/TV)
|
||||
/// and [AlphaScrollHandle] (phone).
|
||||
@@ -2,7 +2,7 @@ import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../models/plex_first_character.dart';
|
||||
import '../../models/plex_first_character.dart';
|
||||
import 'alpha_jump_helper.dart';
|
||||
|
||||
/// Phone-optimized draggable scroll handle that appears on scroll and shows
|
||||
@@ -4,9 +4,10 @@ import 'package:material_symbols_icons/symbols.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import '../../focus/focus_theme.dart';
|
||||
import '../../focus/focusable_action_bar.dart';
|
||||
import '../../focus/focusable_button.dart';
|
||||
import '../../focus/dpad_navigator.dart';
|
||||
import '../../focus/focus_theme.dart';
|
||||
import '../../focus/input_mode_tracker.dart';
|
||||
import '../../focus/key_event_utils.dart';
|
||||
import '../../mixins/tab_navigation_mixin.dart';
|
||||
@@ -127,11 +128,8 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
_playlistsTabChipFocusNode,
|
||||
];
|
||||
|
||||
// App bar action button focus
|
||||
late FocusNode _editButtonFocusNode;
|
||||
late FocusNode _refreshButtonFocusNode;
|
||||
bool _isEditFocused = false;
|
||||
bool _isRefreshFocused = false;
|
||||
// App bar action bar
|
||||
final _actionBarKey = GlobalKey<FocusableActionBarState>();
|
||||
|
||||
// Scroll controller for the outer CustomScrollView
|
||||
final ScrollController _outerScrollController = ScrollController();
|
||||
@@ -141,12 +139,6 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
super.initState();
|
||||
initTabNavigation();
|
||||
|
||||
// Initialize action button focus nodes
|
||||
_editButtonFocusNode = FocusNode(debugLabel: 'EditButton');
|
||||
_refreshButtonFocusNode = FocusNode(debugLabel: 'RefreshButton');
|
||||
_editButtonFocusNode.addListener(_onEditFocusChange);
|
||||
_refreshButtonFocusNode.addListener(_onRefreshFocusChange);
|
||||
|
||||
// Initialize with libraries from the provider
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
_initializeWithLibraries();
|
||||
@@ -338,42 +330,6 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
_focusCurrentTab();
|
||||
}
|
||||
|
||||
void _onEditFocusChange() {
|
||||
if (mounted) {
|
||||
setState(() => _isEditFocused = _editButtonFocusNode.hasFocus);
|
||||
}
|
||||
}
|
||||
|
||||
void _onRefreshFocusChange() {
|
||||
if (mounted) {
|
||||
setState(() => _isRefreshFocused = _refreshButtonFocusNode.hasFocus);
|
||||
}
|
||||
}
|
||||
|
||||
/// Handle key events for the edit button in app bar
|
||||
late final _handleEditKeyEvent = dpadKeyHandler(
|
||||
onLeft: () => getTabChipFocusNode(3).requestFocus(),
|
||||
onRight: () => _refreshButtonFocusNode.requestFocus(),
|
||||
onDown: _focusCurrentTab,
|
||||
onUp: () {}, // Block at boundary
|
||||
onSelect: _showLibraryManagementSheet,
|
||||
);
|
||||
|
||||
/// Handle key events for the refresh button in app bar
|
||||
late final _handleRefreshKeyEvent = dpadKeyHandler(
|
||||
onLeft: () {
|
||||
final librariesProvider = context.read<LibrariesProvider>();
|
||||
if (librariesProvider.libraries.isNotEmpty) {
|
||||
_editButtonFocusNode.requestFocus();
|
||||
} else {
|
||||
getTabChipFocusNode(3).requestFocus();
|
||||
}
|
||||
},
|
||||
onRight: () {}, // Block at boundary
|
||||
onUp: () {}, // Block at boundary
|
||||
onDown: _focusCurrentTab,
|
||||
onSelect: _refreshCurrentTab,
|
||||
);
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
@@ -383,10 +339,6 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
_browseTabChipFocusNode.dispose();
|
||||
_collectionsTabChipFocusNode.dispose();
|
||||
_playlistsTabChipFocusNode.dispose();
|
||||
_editButtonFocusNode.removeListener(_onEditFocusChange);
|
||||
_editButtonFocusNode.dispose();
|
||||
_refreshButtonFocusNode.removeListener(_onRefreshFocusChange);
|
||||
_refreshButtonFocusNode.dispose();
|
||||
disposeTabNavigation();
|
||||
super.dispose();
|
||||
}
|
||||
@@ -935,13 +887,7 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
getTabChipFocusNode(newIndex).requestFocus();
|
||||
}
|
||||
: () {
|
||||
// Navigate to first action button (edit if libraries exist, else refresh)
|
||||
final librariesProvider = context.read<LibrariesProvider>();
|
||||
if (librariesProvider.libraries.isNotEmpty) {
|
||||
_editButtonFocusNode.requestFocus();
|
||||
} else {
|
||||
_refreshButtonFocusNode.requestFocus();
|
||||
}
|
||||
_actionBarKey.currentState?.getFocusNode(0).requestFocus();
|
||||
},
|
||||
onNavigateDown: _focusCurrentTabFromTabBar,
|
||||
onBack: onTabBarBack,
|
||||
@@ -1048,36 +994,23 @@ class _LibrariesScreenState extends State<LibrariesScreen>
|
||||
shadowColor: Colors.transparent,
|
||||
scrolledUnderElevation: 0,
|
||||
actions: [
|
||||
if (allLibraries.isNotEmpty)
|
||||
Focus(
|
||||
focusNode: _editButtonFocusNode,
|
||||
onKeyEvent: _handleEditKeyEvent,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: _isEditFocused ? Colors.white.withValues(alpha: 0.2) : Colors.transparent,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(20)),
|
||||
),
|
||||
child: IconButton(
|
||||
icon: const AppIcon(Symbols.edit_rounded, fill: 1),
|
||||
FocusableActionBar(
|
||||
key: _actionBarKey,
|
||||
onNavigateLeft: () => getTabChipFocusNode(3).requestFocus(),
|
||||
onNavigateDown: _focusCurrentTab,
|
||||
actions: [
|
||||
if (allLibraries.isNotEmpty)
|
||||
FocusableAction(
|
||||
icon: Symbols.edit_rounded,
|
||||
tooltip: t.libraries.manageLibraries,
|
||||
onPressed: _showLibraryManagementSheet,
|
||||
),
|
||||
),
|
||||
),
|
||||
Focus(
|
||||
focusNode: _refreshButtonFocusNode,
|
||||
onKeyEvent: _handleRefreshKeyEvent,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: _isRefreshFocused ? Colors.white.withValues(alpha: 0.2) : Colors.transparent,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(20)),
|
||||
),
|
||||
child: IconButton(
|
||||
icon: const AppIcon(Symbols.refresh_rounded, fill: 1),
|
||||
FocusableAction(
|
||||
icon: Symbols.refresh_rounded,
|
||||
tooltip: t.common.refresh,
|
||||
onPressed: _refreshCurrentTab,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -14,9 +14,9 @@ import '../../../providers/settings_provider.dart';
|
||||
import '../../../utils/error_message_utils.dart';
|
||||
import '../../../utils/grid_size_calculator.dart';
|
||||
import '../../../utils/layout_constants.dart';
|
||||
import '../../../widgets/alpha_jump_bar.dart';
|
||||
import '../../../widgets/alpha_jump_helper.dart';
|
||||
import '../../../widgets/alpha_scroll_handle.dart';
|
||||
import '../alpha_jump_bar.dart';
|
||||
import '../alpha_jump_helper.dart';
|
||||
import '../alpha_scroll_handle.dart';
|
||||
import '../../../widgets/focusable_media_card.dart';
|
||||
import '../../../widgets/media_card.dart';
|
||||
import '../../../widgets/focusable_filter_chip.dart';
|
||||
@@ -392,6 +392,8 @@ class _LibraryBrowseTabState extends BaseLibraryTabState<PlexMetadata, LibraryBr
|
||||
filterParams['sort'] = _selectedSort!.getSortKey(descending: _isSortDescending);
|
||||
}
|
||||
|
||||
filterParams['includeCollections'] = '1';
|
||||
|
||||
return filterParams;
|
||||
}
|
||||
|
||||
@@ -786,6 +788,7 @@ class _LibraryBrowseTabState extends BaseLibraryTabState<PlexMetadata, LibraryBr
|
||||
bool get _shouldShowAlphaJumpBar {
|
||||
if (_selectedGrouping == 'folders') return false;
|
||||
if (_firstCharacters.isEmpty) return false;
|
||||
if (_firstCharacters.length < 6 || _alphaHelper.totalItemCount < 80) return false;
|
||||
// Show when no sort is selected (default is titleSort) or when explicitly sorting by title
|
||||
final sortKey = _selectedSort?.key ?? '';
|
||||
return sortKey.isEmpty || sortKey.startsWith('titleSort');
|
||||
@@ -797,6 +800,8 @@ class _LibraryBrowseTabState extends BaseLibraryTabState<PlexMetadata, LibraryBr
|
||||
final filterParams = Map<String, String>.from(_selectedFilters);
|
||||
final typeId = _getGroupingTypeId();
|
||||
|
||||
filterParams['includeCollections'] = '1';
|
||||
|
||||
try {
|
||||
final chars = await client.getFirstCharacters(
|
||||
widget.library.key,
|
||||
|
||||
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../focus/dpad_navigator.dart';
|
||||
import '../../focus/focusable_action_bar.dart';
|
||||
import '../../i18n/strings.g.dart';
|
||||
import '../../models/livetv_channel.dart';
|
||||
import '../../models/livetv_dvr.dart';
|
||||
@@ -10,6 +10,7 @@ import '../../mixins/refreshable.dart';
|
||||
import '../../mixins/tab_navigation_mixin.dart';
|
||||
import '../../providers/multi_server_provider.dart';
|
||||
import '../../utils/app_logger.dart';
|
||||
import '../../utils/desktop_window_padding.dart';
|
||||
import '../../utils/platform_detector.dart';
|
||||
import '../../widgets/app_icon.dart';
|
||||
import '../../widgets/focusable_tab_chip.dart';
|
||||
@@ -31,9 +32,8 @@ class _LiveTvScreenState extends State<LiveTvScreen>
|
||||
final _guideTabKey = GlobalKey<GuideTabState>();
|
||||
final _whatsOnTabKey = GlobalKey<WhatsOnTabState>();
|
||||
|
||||
// App bar action button focus
|
||||
final _refreshButtonFocusNode = FocusNode(debugLabel: 'RefreshButton');
|
||||
bool _isRefreshFocused = false;
|
||||
// App bar action bar
|
||||
final _actionBarKey = GlobalKey<FocusableActionBarState>();
|
||||
|
||||
List<LiveTvChannel> _channels = [];
|
||||
bool _isLoading = true;
|
||||
@@ -47,7 +47,6 @@ class _LiveTvScreenState extends State<LiveTvScreen>
|
||||
super.initState();
|
||||
suppressAutoFocus = true;
|
||||
initTabNavigation();
|
||||
_refreshButtonFocusNode.addListener(_onRefreshFocusChange);
|
||||
_loadChannels();
|
||||
}
|
||||
|
||||
@@ -55,15 +54,10 @@ class _LiveTvScreenState extends State<LiveTvScreen>
|
||||
void dispose() {
|
||||
_guideTabFocusNode.dispose();
|
||||
_whatsOnTabFocusNode.dispose();
|
||||
_refreshButtonFocusNode.removeListener(_onRefreshFocusChange);
|
||||
_refreshButtonFocusNode.dispose();
|
||||
disposeTabNavigation();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _onRefreshFocusChange() {
|
||||
if (mounted) setState(() => _isRefreshFocused = _refreshButtonFocusNode.hasFocus);
|
||||
}
|
||||
|
||||
@override
|
||||
void onTabChanged() {
|
||||
@@ -208,34 +202,6 @@ class _LiveTvScreenState extends State<LiveTvScreen>
|
||||
@override
|
||||
void focusActiveTabIfReady() => _focusCurrentTab();
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Action button key handlers
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
KeyEventResult _handleRefreshKeyEvent(FocusNode _, KeyEvent event) {
|
||||
if (!event.isActionable) return KeyEventResult.ignored;
|
||||
final key = event.logicalKey;
|
||||
|
||||
if (key.isLeftKey) {
|
||||
getTabChipFocusNode(tabCount - 1).requestFocus();
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
if (key.isRightKey) {
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
if (key.isDownKey) {
|
||||
_focusCurrentTab();
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
if (key.isUpKey) {
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
if (key.isSelectKey) {
|
||||
_loadChannels();
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
return KeyEventResult.ignored;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Tab chips
|
||||
@@ -276,7 +242,7 @@ class _LiveTvScreenState extends State<LiveTvScreen>
|
||||
});
|
||||
getTabChipFocusNode(newIndex).requestFocus();
|
||||
}
|
||||
: () => _refreshButtonFocusNode.requestFocus(),
|
||||
: () => _actionBarKey.currentState?.getFocusNode(0).requestFocus(),
|
||||
onNavigateDown: _focusCurrentTab,
|
||||
onBack: onTabBarBack,
|
||||
);
|
||||
@@ -302,23 +268,20 @@ class _LiveTvScreenState extends State<LiveTvScreen>
|
||||
],
|
||||
)
|
||||
: Text(t.liveTv.title),
|
||||
actions: [
|
||||
Focus(
|
||||
focusNode: _refreshButtonFocusNode,
|
||||
onKeyEvent: _handleRefreshKeyEvent,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: _isRefreshFocused ? Colors.white.withValues(alpha: 0.2) : Colors.transparent,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(20)),
|
||||
),
|
||||
child: IconButton(
|
||||
icon: const AppIcon(Symbols.refresh_rounded),
|
||||
actions: DesktopAppBarHelper.buildAdjustedActions([
|
||||
FocusableActionBar(
|
||||
key: _actionBarKey,
|
||||
onNavigateLeft: () => getTabChipFocusNode(tabCount - 1).requestFocus(),
|
||||
onNavigateDown: _focusCurrentTab,
|
||||
actions: [
|
||||
FocusableAction(
|
||||
icon: Symbols.refresh_rounded,
|
||||
tooltip: t.liveTv.reloadGuide,
|
||||
onPressed: _loadChannels,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
]),
|
||||
),
|
||||
body: _buildLiveTvBody(theme, useSideNav),
|
||||
);
|
||||
|
||||
@@ -120,7 +120,7 @@ class _ProgramDetailsSheetContentState extends State<_ProgramDetailsSheetContent
|
||||
}
|
||||
|
||||
if (!program.isCurrentlyAiring && widget.onTuneChannel != null) {
|
||||
buttons.add(const SizedBox(width: 8));
|
||||
if (buttons.isNotEmpty) buttons.add(const SizedBox(width: 8));
|
||||
final idx = buttonIndex;
|
||||
buttons.add(
|
||||
FocusableButton(
|
||||
|
||||
@@ -6,6 +6,7 @@ import 'package:material_symbols_icons/symbols.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../../../focus/dpad_navigator.dart';
|
||||
import '../../../focus/input_mode_tracker.dart';
|
||||
import '../../../focus/key_event_utils.dart';
|
||||
import '../../../i18n/strings.g.dart';
|
||||
import '../../../models/livetv_channel.dart';
|
||||
@@ -68,6 +69,7 @@ class GuideTabState extends State<GuideTab> {
|
||||
|
||||
/// Focus into the guide content (called from tab bar navigation or initial load).
|
||||
void focusContent() {
|
||||
if (!InputModeTracker.isKeyboardMode(context)) return;
|
||||
// If still loading programs, defer until the Focus widget is in the tree.
|
||||
if (_isLoading) {
|
||||
_pendingFocus = true;
|
||||
@@ -533,7 +535,7 @@ class GuideTabState extends State<GuideTab> {
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
SizedBox(width: _channelColumnWidth, height: _timeHeaderHeight),
|
||||
const SizedBox(width: _channelColumnWidth, height: _timeHeaderHeight),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
controller: _headerHorizontalController,
|
||||
@@ -999,16 +1001,16 @@ class GuideTabState extends State<GuideTab> {
|
||||
if (isFocused) {
|
||||
materialColor = theme.colorScheme.primary.withValues(alpha: 0.25);
|
||||
} else if (isCurrentlyAiring) {
|
||||
materialColor = theme.colorScheme.primaryContainer;
|
||||
materialColor = theme.colorScheme.onSurface;
|
||||
} else {
|
||||
materialColor = theme.colorScheme.surfaceContainerHigh;
|
||||
materialColor = theme.colorScheme.onSurface.withValues(alpha: 0.12);
|
||||
}
|
||||
|
||||
Color titleColor;
|
||||
if (isFocused) {
|
||||
titleColor = theme.colorScheme.primary;
|
||||
} else if (isCurrentlyAiring) {
|
||||
titleColor = theme.colorScheme.onPrimaryContainer;
|
||||
titleColor = theme.colorScheme.surface;
|
||||
} else {
|
||||
titleColor = theme.colorScheme.onSurface;
|
||||
}
|
||||
@@ -1017,7 +1019,7 @@ class GuideTabState extends State<GuideTab> {
|
||||
if (isFocused) {
|
||||
subtitleColor = theme.colorScheme.primary.withValues(alpha: 0.7);
|
||||
} else if (isCurrentlyAiring) {
|
||||
subtitleColor = theme.colorScheme.onPrimaryContainer.withValues(alpha: 0.7);
|
||||
subtitleColor = theme.colorScheme.surface.withValues(alpha: 0.7);
|
||||
} else {
|
||||
subtitleColor = theme.colorScheme.onSurfaceVariant;
|
||||
}
|
||||
@@ -1027,12 +1029,10 @@ class GuideTabState extends State<GuideTab> {
|
||||
child: Material(
|
||||
color: materialColor,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(4)),
|
||||
side: isFocused ? BorderSide(color: theme.colorScheme.primary, width: 2) : BorderSide.none,
|
||||
),
|
||||
child: InkWell(
|
||||
canRequestFocus: false,
|
||||
borderRadius: const BorderRadius.all(Radius.circular(4)),
|
||||
onTap: () => _showProgramDetails(channel, program),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
|
||||
@@ -65,6 +65,7 @@ class MediaDetailScreen extends StatefulWidget {
|
||||
class _MediaDetailScreenState extends State<MediaDetailScreen> with WatchStateAware, DeletionAware {
|
||||
List<PlexMetadata> _seasons = [];
|
||||
bool _isLoadingSeasons = false;
|
||||
Completer<void>? _seasonsCompleter;
|
||||
PlexMetadata? _fullMetadata;
|
||||
PlexMetadata? _onDeckEpisode;
|
||||
PlexVideoPlaybackData? _playbackData;
|
||||
@@ -713,11 +714,11 @@ class _MediaDetailScreenState extends State<MediaDetailScreen> with WatchStateAw
|
||||
const SizedBox(width: 12),
|
||||
IconButton.filledTonal(
|
||||
onPressed: () async {
|
||||
final result = await Navigator.push(
|
||||
await Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => MetadataEditScreen(metadata: metadata)),
|
||||
);
|
||||
if (result == true && mounted) {
|
||||
if (mounted) {
|
||||
_loadFullMetadata();
|
||||
}
|
||||
},
|
||||
@@ -1025,6 +1026,7 @@ class _MediaDetailScreenState extends State<MediaDetailScreen> with WatchStateAw
|
||||
}
|
||||
|
||||
Future<void> _loadSeasons() async {
|
||||
_seasonsCompleter = Completer<void>();
|
||||
setState(() {
|
||||
_isLoadingSeasons = true;
|
||||
});
|
||||
@@ -1048,11 +1050,16 @@ class _MediaDetailScreenState extends State<MediaDetailScreen> with WatchStateAw
|
||||
setState(() {
|
||||
_isLoadingSeasons = false;
|
||||
});
|
||||
} finally {
|
||||
if (!(_seasonsCompleter?.isCompleted ?? true)) {
|
||||
_seasonsCompleter?.complete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Load seasons from downloaded episodes (offline mode)
|
||||
void _loadSeasonsFromDownloads() {
|
||||
_seasonsCompleter = Completer<void>();
|
||||
setState(() {
|
||||
_isLoadingSeasons = true;
|
||||
});
|
||||
@@ -1087,6 +1094,9 @@ class _MediaDetailScreenState extends State<MediaDetailScreen> with WatchStateAw
|
||||
_seasons = seasons;
|
||||
_isLoadingSeasons = false;
|
||||
});
|
||||
if (!(_seasonsCompleter?.isCompleted ?? true)) {
|
||||
_seasonsCompleter?.complete();
|
||||
}
|
||||
}
|
||||
|
||||
/// Load extras (trailers, behind-the-scenes, etc.)
|
||||
@@ -1654,8 +1664,8 @@ class _MediaDetailScreenState extends State<MediaDetailScreen> with WatchStateAw
|
||||
}
|
||||
|
||||
// Wait for seasons to finish loading if they're currently loading
|
||||
while (_isLoadingSeasons) {
|
||||
await Future.delayed(const Duration(milliseconds: 100));
|
||||
if (_isLoadingSeasons && _seasonsCompleter != null) {
|
||||
await _seasonsCompleter!.future.timeout(const Duration(seconds: 10), onTimeout: () {});
|
||||
}
|
||||
|
||||
if (!mounted) return;
|
||||
@@ -1853,14 +1863,17 @@ class _MediaDetailScreenState extends State<MediaDetailScreen> with WatchStateAw
|
||||
SizedBox(
|
||||
height: headerHeight,
|
||||
width: double.infinity,
|
||||
child: metadata.art != null
|
||||
child: (metadata.art != null || metadata.backgroundSquare != null)
|
||||
? Builder(
|
||||
builder: (context) {
|
||||
final containerAspect = size.width / headerHeight;
|
||||
final heroArtPath = metadata.heroArt(containerAspectRatio: containerAspect);
|
||||
|
||||
// Check for offline local file first
|
||||
if (widget.isOffline && widget.metadata.serverId != null) {
|
||||
final localPath = context.read<DownloadProvider>().getArtworkLocalPath(
|
||||
widget.metadata.serverId!,
|
||||
metadata.art,
|
||||
heroArtPath,
|
||||
);
|
||||
if (localPath != null && File(localPath).existsSync()) {
|
||||
return Image.file(
|
||||
@@ -1879,7 +1892,7 @@ class _MediaDetailScreenState extends State<MediaDetailScreen> with WatchStateAw
|
||||
final dpr = PlexImageHelper.effectiveDevicePixelRatio(context);
|
||||
final imageUrl = PlexImageHelper.getOptimizedImageUrl(
|
||||
client: client,
|
||||
thumbPath: metadata.art,
|
||||
thumbPath: heroArtPath,
|
||||
maxWidth: mediaQuery.size.width,
|
||||
maxHeight: mediaQuery.size.height * 0.6,
|
||||
devicePixelRatio: dpr,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import '../../focus/focusable_action_bar.dart';
|
||||
import '../../services/plex_client.dart';
|
||||
import '../../services/play_queue_launcher.dart';
|
||||
import '../../models/plex_playlist.dart';
|
||||
@@ -51,33 +52,15 @@ class _PlaylistDetailScreenState extends BaseMediaListDetailScreen<PlaylistDetai
|
||||
bool get hasItems => items.isNotEmpty;
|
||||
|
||||
@override
|
||||
int get appBarButtonCount {
|
||||
int count = 0;
|
||||
if (items.isNotEmpty) count += 2; // play + shuffle
|
||||
if (!widget.playlist.smart) count += 1; // delete
|
||||
return count;
|
||||
}
|
||||
|
||||
@override
|
||||
List<AppBarButtonConfig> getAppBarButtons() {
|
||||
final buttons = <AppBarButtonConfig>[];
|
||||
if (items.isNotEmpty) {
|
||||
buttons.add(AppBarButtonConfig(icon: Symbols.play_arrow_rounded, tooltip: t.common.play, onPressed: playItems));
|
||||
buttons.add(
|
||||
AppBarButtonConfig(icon: Symbols.shuffle_rounded, tooltip: t.common.shuffle, onPressed: shufflePlayItems),
|
||||
);
|
||||
}
|
||||
if (!widget.playlist.smart) {
|
||||
buttons.add(
|
||||
AppBarButtonConfig(
|
||||
icon: Symbols.delete_rounded,
|
||||
tooltip: t.playlists.delete,
|
||||
onPressed: _deletePlaylist,
|
||||
color: Colors.red,
|
||||
),
|
||||
);
|
||||
}
|
||||
return buttons;
|
||||
List<FocusableAction> getAppBarActions() {
|
||||
return [
|
||||
if (items.isNotEmpty) ...[
|
||||
FocusableAction(icon: Symbols.play_arrow_rounded, tooltip: t.common.play, onPressed: playItems),
|
||||
FocusableAction(icon: Symbols.shuffle_rounded, tooltip: t.common.shuffle, onPressed: shufflePlayItems),
|
||||
],
|
||||
if (!widget.playlist.smart)
|
||||
FocusableAction(icon: Symbols.delete_rounded, tooltip: t.playlists.delete, onPressed: _deletePlaylist, iconColor: Colors.red),
|
||||
];
|
||||
}
|
||||
|
||||
// Focus management for regular (non-smart) reorderable lists
|
||||
|
||||
@@ -365,7 +365,7 @@ class _TvPinInputState extends State<_TvPinInput> {
|
||||
_digits[index] = digit;
|
||||
_activeIndex = index;
|
||||
_mobileControllers[index].text = digit.toString();
|
||||
_mobileControllers[index].selection = TextSelection.collapsed(offset: 1);
|
||||
_mobileControllers[index].selection = const TextSelection.collapsed(offset: 1);
|
||||
});
|
||||
|
||||
if (index < 3) {
|
||||
@@ -436,12 +436,12 @@ class _TvPinInputState extends State<_TvPinInput> {
|
||||
maxLength: 2, // allow overwrite
|
||||
obscureText: true,
|
||||
style: Theme.of(context).textTheme.headlineSmall?.copyWith(fontWeight: FontWeight.bold),
|
||||
decoration: InputDecoration(
|
||||
decoration: const InputDecoration(
|
||||
counterText: '',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(FocusTheme.defaultBorderRadius)),
|
||||
borderRadius: BorderRadius.all(Radius.circular(FocusTheme.defaultBorderRadius)),
|
||||
),
|
||||
contentPadding: const EdgeInsets.symmetric(vertical: 14),
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 14),
|
||||
),
|
||||
inputFormatters: [FilteringTextInputFormatter.digitsOnly],
|
||||
onChanged: (value) => _onMobileDigitChanged(i, value),
|
||||
|
||||
@@ -9,11 +9,7 @@ import '../i18n/strings.g.dart';
|
||||
import '../mixins/refreshable.dart';
|
||||
import '../models/plex_metadata.dart';
|
||||
import '../providers/multi_server_provider.dart';
|
||||
import '../providers/settings_provider.dart';
|
||||
import '../services/settings_service.dart' show ViewMode;
|
||||
import '../utils/app_logger.dart';
|
||||
import '../utils/grid_size_calculator.dart';
|
||||
import '../utils/sliver_adaptive_media_builder.dart';
|
||||
import '../utils/snackbar_helper.dart';
|
||||
import '../widgets/desktop_app_bar.dart';
|
||||
import '../widgets/focusable_media_card.dart';
|
||||
@@ -130,7 +126,7 @@ class _SearchScreenState extends State<SearchScreen> with Refreshable, FullRefre
|
||||
/// Focus the search input field
|
||||
@override
|
||||
void focusSearchInput() {
|
||||
FocusUtils.requestFocusAfterBuild(this, _searchFocusNode);
|
||||
_searchFocusNode.requestFocus();
|
||||
}
|
||||
|
||||
/// Set the search query externally (e.g. from companion remote)
|
||||
@@ -196,130 +192,101 @@ class _SearchScreenState extends State<SearchScreen> with Refreshable, FullRefre
|
||||
return KeyEventResult.ignored;
|
||||
}
|
||||
|
||||
/// Calculate column count based on available width.
|
||||
int _calculateColumnCount(double availableWidth, double maxCrossAxisExtent, double crossAxisSpacing) {
|
||||
return ((availableWidth + crossAxisSpacing) / (maxCrossAxisExtent + crossAxisSpacing)).ceil().clamp(1, 100);
|
||||
Widget _buildResultsList(BuildContext context) {
|
||||
final multiServer = context.watch<MultiServerProvider>();
|
||||
final showServerName = multiServer.totalServerCount > 1;
|
||||
return SliverPadding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
sliver: SliverList(
|
||||
delegate: SliverChildBuilderDelegate((context, index) {
|
||||
final item = _searchResults[index];
|
||||
return FocusableMediaCard(
|
||||
key: Key(item.globalKey),
|
||||
item: item,
|
||||
forceListMode: true,
|
||||
focusNode: index == 0 ? _firstResultFocusNode : null,
|
||||
onListRefresh: () => updateItem(item.ratingKey),
|
||||
onNavigateLeft: _navigateToSidebar,
|
||||
onNavigateUp: index == 0 ? focusSearchInput : null,
|
||||
showServerName: showServerName,
|
||||
);
|
||||
}, childCount: _searchResults.length),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// Use LayoutBuilder to get the actual available width (accounting for sidebar)
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final availableWidth = constraints.maxWidth;
|
||||
|
||||
return Scaffold(
|
||||
body: SafeArea(
|
||||
child: CustomScrollView(
|
||||
slivers: [
|
||||
DesktopSliverAppBar(title: Text(t.common.search), floating: true),
|
||||
SliverToBoxAdapter(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 16, right: 16, bottom: 16),
|
||||
child: Focus(
|
||||
onKeyEvent: _handleSearchInputKeyEvent,
|
||||
child: TextField(
|
||||
controller: _searchController,
|
||||
focusNode: _searchFocusNode,
|
||||
decoration: InputDecoration(
|
||||
hintText: t.search.hint,
|
||||
prefixIcon: const AppIcon(Symbols.search_rounded, fill: 1),
|
||||
suffixIcon: _searchController.text.isNotEmpty
|
||||
? IconButton(
|
||||
icon: const AppIcon(Symbols.clear_rounded, fill: 1),
|
||||
onPressed: () {
|
||||
_searchController.clear();
|
||||
// State update handled by listener
|
||||
},
|
||||
)
|
||||
: null,
|
||||
filled: true,
|
||||
fillColor: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(100)),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(100)),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(100)),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
),
|
||||
return Scaffold(
|
||||
body: SafeArea(
|
||||
child: CustomScrollView(
|
||||
slivers: [
|
||||
DesktopSliverAppBar(title: Text(t.common.search), floating: true),
|
||||
SliverToBoxAdapter(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 16, right: 16, bottom: 16),
|
||||
child: Focus(
|
||||
onKeyEvent: _handleSearchInputKeyEvent,
|
||||
child: TextField(
|
||||
controller: _searchController,
|
||||
focusNode: _searchFocusNode,
|
||||
decoration: InputDecoration(
|
||||
hintText: t.search.hint,
|
||||
prefixIcon: const AppIcon(Symbols.search_rounded, fill: 1),
|
||||
suffixIcon: _searchController.text.isNotEmpty
|
||||
? IconButton(
|
||||
icon: const AppIcon(Symbols.clear_rounded, fill: 1),
|
||||
onPressed: () {
|
||||
_searchController.clear();
|
||||
// State update handled by listener
|
||||
},
|
||||
)
|
||||
: null,
|
||||
filled: true,
|
||||
fillColor: Theme.of(context).colorScheme.surfaceContainerHighest,
|
||||
border: const OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(100)),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
enabledBorder: const OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(100)),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
focusedBorder: const OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(100)),
|
||||
borderSide: BorderSide.none,
|
||||
),
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (_isSearching)
|
||||
const SliverFillRemaining(child: Center(child: CircularProgressIndicator()))
|
||||
else if (!_hasSearched)
|
||||
SliverFillRemaining(
|
||||
child: StateMessageWidget(
|
||||
message: t.search.searchYourMedia,
|
||||
subtitle: t.search.enterTitleActorOrKeyword,
|
||||
icon: Symbols.search_rounded,
|
||||
iconSize: 80,
|
||||
),
|
||||
)
|
||||
else if (_searchResults.isEmpty)
|
||||
SliverFillRemaining(
|
||||
child: StateMessageWidget(
|
||||
message: t.messages.noResultsFound,
|
||||
subtitle: t.search.tryDifferentTerm,
|
||||
icon: Symbols.search_off_rounded,
|
||||
iconSize: 80,
|
||||
),
|
||||
)
|
||||
else
|
||||
Consumer<SettingsProvider>(
|
||||
builder: (context, settingsProvider, child) {
|
||||
final maxCrossAxisExtent = GridSizeCalculator.getMaxCrossAxisExtent(
|
||||
context,
|
||||
settingsProvider.libraryDensity,
|
||||
);
|
||||
const gridPadding = EdgeInsets.all(16);
|
||||
const crossAxisSpacing = 8.0;
|
||||
final gridAvailableWidth = availableWidth - gridPadding.left - gridPadding.right;
|
||||
final columnCount = _calculateColumnCount(
|
||||
gridAvailableWidth,
|
||||
maxCrossAxisExtent,
|
||||
crossAxisSpacing,
|
||||
);
|
||||
final isList = settingsProvider.viewMode == ViewMode.list;
|
||||
|
||||
return buildAdaptiveMediaSliverBuilder<PlexMetadata>(
|
||||
context: context,
|
||||
items: _searchResults,
|
||||
itemBuilder: (context, item, index) {
|
||||
// In list view, all items are in the first column
|
||||
final isFirstColumn = isList || GridSizeCalculator.isFirstColumn(index, columnCount);
|
||||
final isFirstRow = isList ? index == 0 : GridSizeCalculator.isFirstRow(index, columnCount);
|
||||
return FocusableMediaCard(
|
||||
key: Key(item.ratingKey),
|
||||
item: item,
|
||||
focusNode: index == 0 ? _firstResultFocusNode : null,
|
||||
onListRefresh: () => updateItem(item.ratingKey),
|
||||
onNavigateLeft: isFirstColumn ? _navigateToSidebar : null,
|
||||
onNavigateUp: isFirstRow ? focusSearchInput : null,
|
||||
);
|
||||
},
|
||||
viewMode: settingsProvider.viewMode,
|
||||
density: settingsProvider.libraryDensity,
|
||||
padding: const EdgeInsets.all(16),
|
||||
childAspectRatio: 2 / 3.3,
|
||||
crossAxisSpacing: 8,
|
||||
mainAxisSpacing: 8,
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
if (_isSearching)
|
||||
const SliverFillRemaining(child: Center(child: CircularProgressIndicator()))
|
||||
else if (!_hasSearched)
|
||||
SliverFillRemaining(
|
||||
child: StateMessageWidget(
|
||||
message: t.search.searchYourMedia,
|
||||
subtitle: t.search.enterTitleActorOrKeyword,
|
||||
icon: Symbols.search_rounded,
|
||||
iconSize: 80,
|
||||
),
|
||||
)
|
||||
else if (_searchResults.isEmpty)
|
||||
SliverFillRemaining(
|
||||
child: StateMessageWidget(
|
||||
message: t.messages.noResultsFound,
|
||||
subtitle: t.search.tryDifferentTerm,
|
||||
icon: Symbols.search_off_rounded,
|
||||
iconSize: 80,
|
||||
),
|
||||
)
|
||||
else
|
||||
_buildResultsList(context),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'dart:io';
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
@@ -14,10 +15,14 @@ import '../focus/dpad_navigator.dart';
|
||||
import '../focus/input_mode_tracker.dart';
|
||||
import '../models/download_models.dart';
|
||||
import '../providers/download_provider.dart';
|
||||
import '../providers/settings_provider.dart';
|
||||
import '../utils/content_utils.dart';
|
||||
import '../services/download_storage_service.dart';
|
||||
import '../widgets/collapsible_text.dart';
|
||||
import '../widgets/plex_optimized_image.dart';
|
||||
import '../models/plex_metadata.dart';
|
||||
import '../utils/provider_extensions.dart';
|
||||
import '../utils/platform_detector.dart';
|
||||
import '../utils/video_player_navigation.dart';
|
||||
import '../utils/formatters.dart';
|
||||
import '../widgets/desktop_app_bar.dart';
|
||||
@@ -56,7 +61,8 @@ class _SeasonDetailScreenState extends State<SeasonDetailScreen>
|
||||
bool _suppressNextBackKeyUp = false;
|
||||
bool _routeSubscribed = false;
|
||||
|
||||
String _toGlobalKey(String ratingKey, {String? serverId}) => buildGlobalKey(serverId ?? widget.season.serverId ?? '', ratingKey);
|
||||
String _toGlobalKey(String ratingKey, {String? serverId}) =>
|
||||
buildGlobalKey(serverId ?? widget.season.serverId ?? '', ratingKey);
|
||||
|
||||
// WatchStateAware: watch all episode ratingKeys
|
||||
@override
|
||||
@@ -361,14 +367,18 @@ class _EpisodeCardState extends State<_EpisodeCard> {
|
||||
);
|
||||
return Row(
|
||||
children: [
|
||||
if (widget.episode.duration != null) Text(formatDurationTimestamp(Duration(milliseconds: widget.episode.duration!)), style: mutedStyle),
|
||||
if (widget.episode.duration != null)
|
||||
Text(formatDurationTimestamp(Duration(milliseconds: widget.episode.duration!)), style: mutedStyle),
|
||||
if (widget.episode.originallyAvailableAt != null) ...[
|
||||
dot,
|
||||
Text(formatFullDate(widget.episode.originallyAvailableAt!), style: mutedStyle),
|
||||
],
|
||||
if (widget.episode.userRating != null && widget.episode.userRating! > 0) ...[
|
||||
dot,
|
||||
Padding(padding: const EdgeInsets.only(top: 2), child: Icon(Symbols.star_rounded, size: 12, fill: 1, color: Colors.amber)),
|
||||
const Padding(
|
||||
padding: EdgeInsets.only(top: 2),
|
||||
child: Icon(Symbols.star_rounded, size: 12, fill: 1, color: Colors.amber),
|
||||
),
|
||||
const SizedBox(width: 2),
|
||||
Text(
|
||||
(widget.episode.userRating! / 2) == (widget.episode.userRating! / 2).truncateToDouble()
|
||||
@@ -383,6 +393,9 @@ class _EpisodeCardState extends State<_EpisodeCard> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final hideSpoilers = context.watch<SettingsProvider>().hideSpoilers;
|
||||
final shouldBlur = hideSpoilers && widget.episode.shouldHideSpoiler;
|
||||
|
||||
// Hide progress when offline (not tracked)
|
||||
final hasProgress =
|
||||
!widget.isOffline &&
|
||||
@@ -430,7 +443,17 @@ class _EpisodeCardState extends State<_EpisodeCard> {
|
||||
children: [
|
||||
ClipRRect(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(6)),
|
||||
child: AspectRatio(aspectRatio: 16 / 9, child: _buildEpisodeThumbnail()),
|
||||
child: AspectRatio(
|
||||
aspectRatio: 16 / 9,
|
||||
child: shouldBlur
|
||||
? ClipRect(
|
||||
child: ImageFiltered(
|
||||
imageFilter: ImageFilter.blur(sigmaX: 12, sigmaY: 12),
|
||||
child: _buildEpisodeThumbnail(),
|
||||
),
|
||||
)
|
||||
: _buildEpisodeThumbnail(),
|
||||
),
|
||||
),
|
||||
|
||||
// Play overlay
|
||||
@@ -634,17 +657,27 @@ class _EpisodeCardState extends State<_EpisodeCard> {
|
||||
},
|
||||
),
|
||||
|
||||
// Summary
|
||||
if (widget.episode.summary != null && widget.episode.summary!.isNotEmpty) ...[
|
||||
// Summary (hidden when spoiler protection is active)
|
||||
if (!shouldBlur && widget.episode.summary != null && widget.episode.summary!.isNotEmpty) ...[
|
||||
const SizedBox(height: 6),
|
||||
Text(
|
||||
widget.episode.summary!,
|
||||
style: Theme.of(
|
||||
context,
|
||||
).textTheme.bodySmall?.copyWith(color: tokens(context).textMuted, height: 1.3),
|
||||
maxLines: 3,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
if (PlatformDetector.isTV())
|
||||
Text(
|
||||
widget.episode.summary!,
|
||||
style: Theme.of(
|
||||
context,
|
||||
).textTheme.bodySmall?.copyWith(color: tokens(context).textMuted, height: 1.3),
|
||||
maxLines: 3,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
)
|
||||
else
|
||||
CollapsibleText(
|
||||
text: widget.episode.summary!,
|
||||
maxLines: 3,
|
||||
small: true,
|
||||
style: Theme.of(
|
||||
context,
|
||||
).textTheme.bodySmall?.copyWith(color: tokens(context).textMuted, height: 1.3),
|
||||
),
|
||||
],
|
||||
|
||||
// Metadata row (duration, watched status)
|
||||
|
||||
@@ -1,16 +1,21 @@
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:device_info_plus/device_info_plus.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:plezy/widgets/app_icon.dart';
|
||||
import 'package:material_symbols_icons/symbols.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:logger/logger.dart';
|
||||
import 'package:package_info_plus/package_info_plus.dart';
|
||||
import '../../focus/focusable_action_bar.dart';
|
||||
import '../../focus/focusable_button.dart';
|
||||
import '../../focus/key_event_utils.dart';
|
||||
import '../../i18n/strings.g.dart';
|
||||
import '../../utils/app_logger.dart';
|
||||
import '../../utils/platform_detector.dart';
|
||||
import '../../utils/snackbar_helper.dart';
|
||||
import '../../widgets/focused_scroll_scaffold.dart';
|
||||
import '../../widgets/desktop_app_bar.dart';
|
||||
|
||||
class LogsScreen extends StatefulWidget {
|
||||
const LogsScreen({super.key});
|
||||
@@ -21,11 +26,47 @@ class LogsScreen extends StatefulWidget {
|
||||
|
||||
class _LogsScreenState extends State<LogsScreen> {
|
||||
List<LogEntry> _logs = [];
|
||||
String _deviceInfo = '';
|
||||
final ScrollController _scrollController = ScrollController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_logs = MemoryLogOutput.getLogs();
|
||||
_loadDeviceInfo();
|
||||
}
|
||||
|
||||
Future<void> _loadDeviceInfo() async {
|
||||
final packageInfo = await PackageInfo.fromPlatform();
|
||||
final deviceInfo = DeviceInfoPlugin();
|
||||
final buffer = StringBuffer();
|
||||
buffer.writeln('${t.app.title} v${packageInfo.version} (${packageInfo.buildNumber})');
|
||||
|
||||
if (Platform.isAndroid) {
|
||||
final info = await deviceInfo.androidInfo;
|
||||
buffer.writeln('Android ${info.version.release} (API ${info.version.sdkInt})');
|
||||
buffer.writeln('${info.manufacturer} ${info.model}');
|
||||
if (TvDetectionService.isTVSync()) buffer.writeln('TV mode: yes');
|
||||
} else if (Platform.isIOS) {
|
||||
final info = await deviceInfo.iosInfo;
|
||||
buffer.writeln('iOS ${info.systemVersion}');
|
||||
buffer.writeln(info.utsname.machine);
|
||||
} else if (Platform.isMacOS) {
|
||||
final info = await deviceInfo.macOsInfo;
|
||||
buffer.writeln('macOS ${info.osRelease}');
|
||||
buffer.writeln(info.model);
|
||||
} else if (Platform.isLinux) {
|
||||
final info = await deviceInfo.linuxInfo;
|
||||
buffer.writeln('Linux ${info.versionId ?? info.id}');
|
||||
}
|
||||
|
||||
if (mounted) setState(() => _deviceInfo = buffer.toString().trimRight());
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_scrollController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void _loadLogs() {
|
||||
@@ -52,6 +93,10 @@ class _LogsScreenState extends State<LogsScreen> {
|
||||
|
||||
String _formatAllLogs() {
|
||||
final buffer = StringBuffer();
|
||||
if (_deviceInfo.isNotEmpty) {
|
||||
buffer.writeln(_deviceInfo);
|
||||
buffer.writeln('---');
|
||||
}
|
||||
bool isFirst = true;
|
||||
for (final log in _logs.reversed) {
|
||||
if (!isFirst) {
|
||||
@@ -115,7 +160,7 @@ class _LogsScreenState extends State<LogsScreen> {
|
||||
icon: const Icon(Icons.copy, size: 20),
|
||||
onPressed: () {
|
||||
Clipboard.setData(ClipboardData(text: id));
|
||||
showSuccessSnackBar(ctx, t.messages.logsCopied);
|
||||
showSuccessSnackBar(context, t.messages.logsCopied);
|
||||
},
|
||||
),
|
||||
],
|
||||
@@ -156,178 +201,132 @@ class _LogsScreenState extends State<LogsScreen> {
|
||||
}
|
||||
}
|
||||
|
||||
IconData _getLevelIcon(Level level) {
|
||||
switch (level) {
|
||||
case Level.error:
|
||||
case Level.fatal:
|
||||
return Symbols.error_rounded;
|
||||
case Level.warning:
|
||||
return Symbols.warning_rounded;
|
||||
case Level.info:
|
||||
return Symbols.info_rounded;
|
||||
case Level.debug:
|
||||
case Level.trace:
|
||||
return Symbols.bug_report_rounded;
|
||||
default:
|
||||
return Symbols.circle_rounded;
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return FocusedScrollScaffold(
|
||||
title: Text(t.screens.logs),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const AppIcon(Symbols.refresh_rounded, fill: 1),
|
||||
onPressed: _loadLogs,
|
||||
tooltip: t.common.refresh,
|
||||
),
|
||||
IconButton(
|
||||
icon: const AppIcon(Symbols.upload_rounded, fill: 1),
|
||||
onPressed: _logs.isNotEmpty ? _uploadLogs : null,
|
||||
tooltip: t.logs.uploadLogs,
|
||||
),
|
||||
IconButton(
|
||||
icon: const AppIcon(Symbols.content_copy_rounded, fill: 1),
|
||||
onPressed: _logs.isNotEmpty ? _copyAllLogs : null,
|
||||
tooltip: t.logs.copyLogs,
|
||||
),
|
||||
IconButton(
|
||||
icon: const AppIcon(Symbols.delete_outline_rounded, fill: 1),
|
||||
onPressed: _logs.isNotEmpty ? _clearLogs : null,
|
||||
tooltip: t.logs.clearLogs,
|
||||
),
|
||||
],
|
||||
slivers: [
|
||||
if (_logs.isEmpty)
|
||||
SliverFillRemaining(child: Center(child: Text(t.messages.noLogsAvailable)))
|
||||
else
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
sliver: SliverList(
|
||||
delegate: SliverChildBuilderDelegate((context, index) {
|
||||
final log = _logs[index];
|
||||
return _LogEntryCard(
|
||||
log: log,
|
||||
formatTime: _formatTime,
|
||||
levelColor: _getLevelColor(log.level),
|
||||
levelIcon: _getLevelIcon(log.level),
|
||||
);
|
||||
}, childCount: _logs.length),
|
||||
),
|
||||
),
|
||||
],
|
||||
void _scroll(double delta) {
|
||||
final pos = _scrollController.position;
|
||||
_scrollController.animateTo(
|
||||
(pos.pixels + delta).clamp(pos.minScrollExtent, pos.maxScrollExtent),
|
||||
duration: const Duration(milliseconds: 100),
|
||||
curve: Curves.easeOut,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _LogEntryCard extends StatefulWidget {
|
||||
final LogEntry log;
|
||||
final String Function(DateTime) formatTime;
|
||||
final Color levelColor;
|
||||
final IconData levelIcon;
|
||||
|
||||
const _LogEntryCard({required this.log, required this.formatTime, required this.levelColor, required this.levelIcon});
|
||||
|
||||
@override
|
||||
State<_LogEntryCard> createState() => _LogEntryCardState();
|
||||
}
|
||||
|
||||
class _LogEntryCardState extends State<_LogEntryCard> {
|
||||
bool _isExpanded = false;
|
||||
List<TextSpan> _buildLogSpans() {
|
||||
final spans = <TextSpan>[];
|
||||
if (_deviceInfo.isNotEmpty) {
|
||||
spans.add(TextSpan(
|
||||
text: '$_deviceInfo\n',
|
||||
style: TextStyle(color: Colors.grey.withValues(alpha: 0.6)),
|
||||
));
|
||||
spans.add(TextSpan(
|
||||
text: '---\n',
|
||||
style: TextStyle(color: Colors.grey.withValues(alpha: 0.3)),
|
||||
));
|
||||
}
|
||||
for (var i = 0; i < _logs.length; i++) {
|
||||
if (i > 0) spans.add(const TextSpan(text: '\n'));
|
||||
final log = _logs[i];
|
||||
final color = _getLevelColor(log.level);
|
||||
spans.add(TextSpan(
|
||||
text: '[${_formatTime(log.timestamp)}] ',
|
||||
style: TextStyle(color: color.withValues(alpha: 0.6)),
|
||||
));
|
||||
spans.add(TextSpan(
|
||||
text: '[${log.level.name.toUpperCase()}] ',
|
||||
style: TextStyle(color: color, fontWeight: FontWeight.bold),
|
||||
));
|
||||
spans.add(TextSpan(text: log.message));
|
||||
if (log.error != null) {
|
||||
spans.add(TextSpan(
|
||||
text: '\n Error: ${log.error}',
|
||||
style: TextStyle(color: color),
|
||||
));
|
||||
}
|
||||
if (log.stackTrace != null) {
|
||||
spans.add(TextSpan(
|
||||
text: '\n ${log.stackTrace.toString().replaceAll('\n', '\n ')}',
|
||||
style: TextStyle(color: Colors.grey.withValues(alpha: 0.7)),
|
||||
));
|
||||
}
|
||||
}
|
||||
return spans;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final hasErrorOrStackTrace = widget.log.error != null || widget.log.stackTrace != null;
|
||||
final theme = Theme.of(context);
|
||||
|
||||
return Card(
|
||||
margin: const EdgeInsets.symmetric(vertical: 4),
|
||||
child: InkWell(
|
||||
onTap: hasErrorOrStackTrace ? () => setState(() => _isExpanded = !_isExpanded) : null,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
AppIcon(widget.levelIcon, fill: 1, color: widget.levelColor, size: 20),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text(
|
||||
widget.log.level.name.toUpperCase(),
|
||||
style: TextStyle(fontWeight: FontWeight.bold, color: widget.levelColor, fontSize: 12),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
widget.formatTime(widget.log.timestamp),
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Theme.of(context).textTheme.bodySmall?.color?.withValues(alpha: 0.6),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Text(widget.log.message, style: Theme.of(context).textTheme.bodyMedium),
|
||||
],
|
||||
return Focus(
|
||||
canRequestFocus: false,
|
||||
onKeyEvent: (node, event) {
|
||||
final backResult = handleBackKeyNavigation(context, event);
|
||||
if (backResult != KeyEventResult.ignored) return backResult;
|
||||
if (event is KeyDownEvent || event is KeyRepeatEvent) {
|
||||
if (event.logicalKey == LogicalKeyboardKey.arrowDown) {
|
||||
_scroll(80);
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
if (event.logicalKey == LogicalKeyboardKey.arrowUp) {
|
||||
_scroll(-80);
|
||||
return KeyEventResult.handled;
|
||||
}
|
||||
}
|
||||
return KeyEventResult.ignored;
|
||||
},
|
||||
child: Scaffold(
|
||||
body: CustomScrollView(
|
||||
controller: _scrollController,
|
||||
slivers: [
|
||||
CustomAppBar(
|
||||
title: Text(t.screens.logs),
|
||||
pinned: true,
|
||||
actions: [
|
||||
FocusableActionBar(
|
||||
actions: [
|
||||
FocusableAction(
|
||||
icon: Symbols.refresh_rounded,
|
||||
tooltip: t.common.refresh,
|
||||
onPressed: _loadLogs,
|
||||
),
|
||||
FocusableAction(
|
||||
icon: Symbols.upload_rounded,
|
||||
tooltip: t.logs.uploadLogs,
|
||||
onPressed: _logs.isNotEmpty ? _uploadLogs : null,
|
||||
),
|
||||
FocusableAction(
|
||||
icon: Symbols.content_copy_rounded,
|
||||
tooltip: t.logs.copyLogs,
|
||||
onPressed: _logs.isNotEmpty ? _copyAllLogs : null,
|
||||
),
|
||||
FocusableAction(
|
||||
icon: Symbols.delete_outline_rounded,
|
||||
tooltip: t.logs.clearLogs,
|
||||
onPressed: _logs.isNotEmpty ? _clearLogs : null,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
if (_logs.isEmpty)
|
||||
SliverFillRemaining(child: Center(child: Text(t.messages.noLogsAvailable)))
|
||||
else
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
sliver: SliverToBoxAdapter(
|
||||
child: SelectableText.rich(
|
||||
TextSpan(
|
||||
style: theme.textTheme.bodySmall?.copyWith(
|
||||
fontFamily: 'monospace',
|
||||
fontSize: 12,
|
||||
height: 1.5,
|
||||
),
|
||||
children: _buildLogSpans(),
|
||||
),
|
||||
),
|
||||
if (hasErrorOrStackTrace)
|
||||
AppIcon(
|
||||
_isExpanded ? Symbols.expand_less_rounded : Symbols.expand_more_rounded,
|
||||
fill: 1,
|
||||
color: Theme.of(context).iconTheme.color?.withValues(alpha: 0.6),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
if (_isExpanded && hasErrorOrStackTrace) ...[
|
||||
const SizedBox(height: 12),
|
||||
const Divider(),
|
||||
const SizedBox(height: 8),
|
||||
if (widget.log.error != null)
|
||||
_buildDetailSection(title: t.logs.error, content: widget.log.error.toString()),
|
||||
if (widget.log.stackTrace != null) ...[
|
||||
const SizedBox(height: 12),
|
||||
_buildDetailSection(title: t.logs.stackTrace, content: widget.log.stackTrace.toString()),
|
||||
],
|
||||
],
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildDetailSection({required String title, required String content}) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: Theme.of(
|
||||
context,
|
||||
).textTheme.titleSmall?.copyWith(color: widget.levelColor, fontWeight: FontWeight.bold),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).brightness == Brightness.dark ? Colors.grey[900] : Colors.grey[200],
|
||||
borderRadius: const BorderRadius.all(Radius.circular(4)),
|
||||
),
|
||||
child: SelectableText(
|
||||
content,
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(fontFamily: 'monospace'),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import '../../providers/settings_provider.dart';
|
||||
import '../../providers/theme_provider.dart';
|
||||
import '../../providers/user_profile_provider.dart';
|
||||
import '../../services/keyboard_shortcuts_service.dart';
|
||||
import '../../mpv/player/player_android.dart';
|
||||
import '../../mpv/player/platform/player_android.dart';
|
||||
import '../../services/settings_service.dart' as settings;
|
||||
import '../../services/update_service.dart';
|
||||
import '../../utils/snackbar_helper.dart';
|
||||
@@ -71,12 +71,15 @@ class _SettingsScreenState extends State<SettingsScreen> with FocusableTab {
|
||||
static const _kShowServerNameOnHubs = 'show_server_name_on_hubs';
|
||||
static const _kAlwaysKeepSidebarOpen = 'always_keep_sidebar_open';
|
||||
static const _kShowUnwatchedCount = 'show_unwatched_count';
|
||||
static const _kHideSpoilers = 'hide_spoilers';
|
||||
static const _kRequireProfileSelectionOnOpen = 'require_profile_selection_on_open';
|
||||
static const _kConfirmExitOnBack = 'confirm_exit_on_back';
|
||||
static const _kPlayerBackend = 'player_backend';
|
||||
static const _kExternalPlayer = 'external_player';
|
||||
static const _kHardwareDecoding = 'hardware_decoding';
|
||||
static const _kAutoPip = 'auto_pip';
|
||||
static const _kMatchContentFrameRate = 'match_content_frame_rate';
|
||||
static const _kTunneledPlayback = 'tunneled_playback';
|
||||
static const _kBufferSize = 'buffer_size';
|
||||
static const _kSubtitleStyling = 'subtitle_styling';
|
||||
static const _kMpvConfig = 'mpv_config';
|
||||
@@ -119,7 +122,9 @@ class _SettingsScreenState extends State<SettingsScreen> with FocusableTab {
|
||||
bool _videoPlayerNavigationEnabled = false;
|
||||
int _maxVolume = 100;
|
||||
bool _enableDiscordRPC = false;
|
||||
bool _autoPip = true;
|
||||
bool _matchContentFrameRate = false;
|
||||
bool _tunneledPlayback = true;
|
||||
bool _useExoPlayer = true; // Android only: ExoPlayer vs MPV
|
||||
bool _requireProfileSelectionOnOpen = false;
|
||||
bool _useExternalPlayer = false;
|
||||
@@ -193,7 +198,9 @@ class _SettingsScreenState extends State<SettingsScreen> with FocusableTab {
|
||||
_videoPlayerNavigationEnabled = _settingsService.getVideoPlayerNavigationEnabled();
|
||||
_maxVolume = _settingsService.getMaxVolume();
|
||||
_enableDiscordRPC = _settingsService.getEnableDiscordRPC();
|
||||
_autoPip = _settingsService.getAutoPip();
|
||||
_matchContentFrameRate = _settingsService.getMatchContentFrameRate();
|
||||
_tunneledPlayback = _settingsService.getTunneledPlayback();
|
||||
_useExoPlayer = _settingsService.getUseExoPlayer();
|
||||
_requireProfileSelectionOnOpen = _settingsService.getRequireProfileSelectionOnOpen();
|
||||
_useExternalPlayer = _settingsService.getUseExternalPlayer();
|
||||
@@ -383,6 +390,20 @@ class _SettingsScreenState extends State<SettingsScreen> with FocusableTab {
|
||||
);
|
||||
},
|
||||
),
|
||||
Consumer<SettingsProvider>(
|
||||
builder: (context, settingsProvider, child) {
|
||||
return SwitchListTile(
|
||||
focusNode: _focusTracker.get(_kHideSpoilers),
|
||||
secondary: const AppIcon(Symbols.visibility_off_rounded, fill: 1),
|
||||
title: Text(t.settings.hideSpoilers),
|
||||
subtitle: Text(t.settings.hideSpoilersDescription),
|
||||
value: settingsProvider.hideSpoilers,
|
||||
onChanged: (value) async {
|
||||
await settingsProvider.setHideSpoilers(value);
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
Consumer<UserProfileProvider>(
|
||||
builder: (context, userProfileProvider, child) {
|
||||
if (!userProfileProvider.hasMultipleUsers) return const SizedBox.shrink();
|
||||
@@ -469,6 +490,20 @@ class _SettingsScreenState extends State<SettingsScreen> with FocusableTab {
|
||||
await _settingsService.setEnableHardwareDecoding(value);
|
||||
},
|
||||
),
|
||||
if (Platform.isAndroid)
|
||||
SwitchListTile(
|
||||
focusNode: _focusTracker.get(_kAutoPip),
|
||||
secondary: const AppIcon(Symbols.picture_in_picture_alt_rounded, fill: 1),
|
||||
title: Text(t.settings.autoPip),
|
||||
subtitle: Text(t.settings.autoPipDescription),
|
||||
value: _autoPip,
|
||||
onChanged: (value) async {
|
||||
setState(() {
|
||||
_autoPip = value;
|
||||
});
|
||||
await _settingsService.setAutoPip(value);
|
||||
},
|
||||
),
|
||||
if (Platform.isAndroid)
|
||||
SwitchListTile(
|
||||
focusNode: _focusTracker.get(_kMatchContentFrameRate),
|
||||
@@ -483,6 +518,20 @@ class _SettingsScreenState extends State<SettingsScreen> with FocusableTab {
|
||||
await _settingsService.setMatchContentFrameRate(value);
|
||||
},
|
||||
),
|
||||
if (Platform.isAndroid && _useExoPlayer)
|
||||
SwitchListTile(
|
||||
focusNode: _focusTracker.get(_kTunneledPlayback),
|
||||
secondary: const AppIcon(Symbols.tv_options_input_settings_rounded, fill: 1),
|
||||
title: Text(t.settings.tunneledPlayback),
|
||||
subtitle: Text(t.settings.tunneledPlaybackDescription),
|
||||
value: _tunneledPlayback,
|
||||
onChanged: (value) async {
|
||||
setState(() {
|
||||
_tunneledPlayback = value;
|
||||
});
|
||||
await _settingsService.setTunneledPlayback(value);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
focusNode: _focusTracker.get(_kBufferSize),
|
||||
leading: const AppIcon(Symbols.memory_rounded, fill: 1),
|
||||
|
||||
@@ -11,8 +11,9 @@ import 'package:wakelock_plus/wakelock_plus.dart';
|
||||
import 'package:window_manager/window_manager.dart';
|
||||
|
||||
import '../mpv/mpv.dart';
|
||||
import '../mpv/player/player_android.dart';
|
||||
import '../mpv/player/platform/player_android.dart';
|
||||
|
||||
import '../../services/bif_thumbnail_service.dart';
|
||||
import '../../services/plex_client.dart';
|
||||
import '../models/livetv_channel.dart';
|
||||
import '../services/plex_api_cache.dart';
|
||||
@@ -20,11 +21,12 @@ import '../models/plex_media_version.dart';
|
||||
import '../models/plex_metadata.dart';
|
||||
import '../models/plex_video_playback_data.dart';
|
||||
import '../utils/content_utils.dart';
|
||||
import '../utils/plex_cache_parser.dart';
|
||||
import '../models/plex_media_info.dart';
|
||||
import '../providers/download_provider.dart';
|
||||
import '../providers/multi_server_provider.dart';
|
||||
import '../providers/playback_state_provider.dart';
|
||||
import '../models/companion_remote/remote_command_type.dart';
|
||||
import '../models/companion_remote/remote_command.dart';
|
||||
import '../providers/companion_remote_provider.dart';
|
||||
import '../services/companion_remote/companion_remote_receiver.dart';
|
||||
import '../services/fullscreen_state_manager.dart';
|
||||
@@ -138,8 +140,9 @@ class VideoPlayerScreenState extends State<VideoPlayerScreen> with WidgetsBindin
|
||||
bool _isReplacingWithVideo = false; // Flag to skip orientation restoration during video-to-video navigation
|
||||
bool _isDisposingForNavigation = false;
|
||||
bool _waitingForExternalSubsTrackSelection = false;
|
||||
bool _isApplyingTrackSelection = false;
|
||||
bool _isHandlingBack = false;
|
||||
bool _hasThumbnails = false;
|
||||
BifThumbnailService? _bifService;
|
||||
|
||||
// Live TV channel navigation
|
||||
int _liveChannelIndex = -1;
|
||||
@@ -170,12 +173,14 @@ class VideoPlayerScreenState extends State<VideoPlayerScreen> with WidgetsBindin
|
||||
// Screen-level focus node: persists across loading/initialized phases so
|
||||
// key events never escape the video player route.
|
||||
late final FocusNode _screenFocusNode;
|
||||
bool _reclaimingFocus = false;
|
||||
|
||||
// Cached setting: when false on Windows/Linux, ESC should not exit the player
|
||||
bool _videoPlayerNavigationEnabled = false;
|
||||
|
||||
// App lifecycle state tracking
|
||||
bool _wasPlayingBeforeInactive = false;
|
||||
bool _autoPipEnabled = false;
|
||||
|
||||
// Services
|
||||
MediaControlsManager? _mediaControlsManager;
|
||||
@@ -198,14 +203,7 @@ class VideoPlayerScreenState extends State<VideoPlayerScreen> with WidgetsBindin
|
||||
return context.getClientForServer(widget.metadata.serverId!);
|
||||
}
|
||||
|
||||
String? _buildThumbnailUrl(BuildContext context, Duration time) {
|
||||
final partId = _currentMediaInfo?.partId;
|
||||
if (partId == null || widget.isOffline) return null;
|
||||
final client = _getClientForMetadata(context);
|
||||
return '${client.config.baseUrl}/library/parts/$partId/indexes/sd/${time.inMilliseconds}'.withPlexToken(
|
||||
client.config.token,
|
||||
);
|
||||
}
|
||||
Uint8List? _getThumbnailData(Duration time) => _bifService?.getThumbnail(time);
|
||||
|
||||
final ValueNotifier<bool> _isBuffering = ValueNotifier<bool>(false); // Track if video is currently buffering
|
||||
final ValueNotifier<bool> _hasFirstFrame = ValueNotifier<bool>(false); // Track if first video frame has rendered
|
||||
@@ -318,7 +316,9 @@ class VideoPlayerScreenState extends State<VideoPlayerScreen> with WidgetsBindin
|
||||
case AppLifecycleState.hidden:
|
||||
// App is being hidden (user is switching away)
|
||||
// Pause video since we don't support background playback (mobile only)
|
||||
// Skip if entering PiP mode - video should keep playing
|
||||
if (PlatformDetector.isMobile(context)) {
|
||||
if (Platform.isAndroid && PipService().isPipActive.value) break;
|
||||
if (player != null && _isPlayerInitialized) {
|
||||
_wasPlayingBeforeInactive = player!.state.playing;
|
||||
if (_wasPlayingBeforeInactive) {
|
||||
@@ -329,6 +329,8 @@ class VideoPlayerScreenState extends State<VideoPlayerScreen> with WidgetsBindin
|
||||
}
|
||||
break;
|
||||
case AppLifecycleState.paused:
|
||||
// Skip if in PiP mode - video should keep playing
|
||||
if (Platform.isAndroid && PipService().isPipActive.value) break;
|
||||
// Clear media controls when app truly goes to background
|
||||
// (we don't support background playback)
|
||||
OsMediaControls.clear();
|
||||
@@ -397,6 +399,9 @@ class VideoPlayerScreenState extends State<VideoPlayerScreen> with WidgetsBindin
|
||||
// Load buffer size from settings
|
||||
final settingsService = await SettingsService.getInstance();
|
||||
_videoPlayerNavigationEnabled = settingsService.getVideoPlayerNavigationEnabled();
|
||||
if (Platform.isAndroid) {
|
||||
_autoPipEnabled = settingsService.getAutoPip();
|
||||
}
|
||||
final bufferSizeMB = settingsService.getBufferSize();
|
||||
final enableHardwareDecoding = settingsService.getEnableHardwareDecoding();
|
||||
final debugLoggingEnabled = settingsService.getEnableDebugLogging();
|
||||
@@ -406,6 +411,10 @@ class VideoPlayerScreenState extends State<VideoPlayerScreen> with WidgetsBindin
|
||||
player = Player(useExoPlayer: useExoPlayer);
|
||||
|
||||
await player!.setProperty('sub-ass', 'yes'); // Enable libass
|
||||
if (Platform.isAndroid && useExoPlayer) {
|
||||
final tunneledPlayback = settingsService.getTunneledPlayback();
|
||||
await player!.setProperty('tunneled-playback', tunneledPlayback ? 'yes' : 'no');
|
||||
}
|
||||
if (bufferSizeMB > 0) {
|
||||
final bufferSizeBytes = bufferSizeMB * 1024 * 1024;
|
||||
await player!.setProperty('demuxer-max-bytes', bufferSizeBytes.toString());
|
||||
@@ -426,6 +435,7 @@ class VideoPlayerScreenState extends State<VideoPlayerScreen> with WidgetsBindin
|
||||
'#${bgOpacity.toRadixString(16).padLeft(2, '0').toUpperCase()}$bgColor',
|
||||
);
|
||||
await player!.setProperty('sub-ass-override', 'no');
|
||||
await player!.setProperty('sub-ass-video-aspect-override', '1');
|
||||
await player!.setProperty('sub-pos', settingsService.getSubtitlePosition().toString());
|
||||
|
||||
// Platform-specific settings
|
||||
@@ -460,6 +470,11 @@ class VideoPlayerScreenState extends State<VideoPlayerScreen> with WidgetsBindin
|
||||
await player!.setProperty('sub-delay', offsetSeconds.toString());
|
||||
}
|
||||
|
||||
// Apply audio normalization (loudnorm filter)
|
||||
if (settingsService.getAudioNormalization()) {
|
||||
await player!.setProperty('af', 'loudnorm=I=-14:TP=-3:LRA=4');
|
||||
}
|
||||
|
||||
// Apply custom MPV config entries
|
||||
final customMpvConfig = settingsService.getEnabledMpvConfigEntries();
|
||||
for (final entry in customMpvConfig.entries) {
|
||||
@@ -556,6 +571,12 @@ class VideoPlayerScreenState extends State<VideoPlayerScreen> with WidgetsBindin
|
||||
|
||||
// Listen to position for completion detection (fallback for unreliable MPV events)
|
||||
_positionSubscription = player!.streams.position.listen((position) {
|
||||
// Fallback for cases where playbackRestart doesn't fire (observed on some
|
||||
// offline Android playback flows). Prevents a permanent loading spinner.
|
||||
if (!_hasFirstFrame.value && position.inMilliseconds > 0) {
|
||||
_hasFirstFrame.value = true;
|
||||
}
|
||||
|
||||
final duration = player!.state.duration;
|
||||
if (duration.inMilliseconds > 0 &&
|
||||
position.inMilliseconds >= duration.inMilliseconds - 1000 &&
|
||||
@@ -1026,17 +1047,21 @@ class VideoPlayerScreenState extends State<VideoPlayerScreen> with WidgetsBindin
|
||||
setState(() {
|
||||
_availableVersions = result.availableVersions.cast();
|
||||
_currentMediaInfo = result.mediaInfo;
|
||||
_hasThumbnails = false;
|
||||
_bifService?.dispose();
|
||||
_bifService = null;
|
||||
});
|
||||
|
||||
// Check whether any thumbnails exist by requesting the first one
|
||||
// Download and cache BIF thumbnail file
|
||||
if (_currentMediaInfo?.partId != null && !widget.isOffline) {
|
||||
final partId = _currentMediaInfo!.partId!;
|
||||
final client = _getClientForMetadata(context);
|
||||
client.checkThumbnailsAvailable(partId).then((available) {
|
||||
// Guard against media having changed while the probe was in flight
|
||||
final service = BifThumbnailService();
|
||||
service.load(client, partId).then((_) {
|
||||
// Guard against media having changed while the download was in flight
|
||||
if (mounted && _currentMediaInfo?.partId == partId) {
|
||||
setState(() => _hasThumbnails = available);
|
||||
setState(() => _bifService = service);
|
||||
} else {
|
||||
service.dispose();
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1058,6 +1083,16 @@ class VideoPlayerScreenState extends State<VideoPlayerScreen> with WidgetsBindin
|
||||
};
|
||||
_videoPIPManager!.isPipActive.addListener(_onPipStateChanged);
|
||||
|
||||
// Auto-PiP: set up callback for API 26-30 path and initial state
|
||||
if (Platform.isAndroid && _autoPipEnabled) {
|
||||
PipService.onAutoPipEntering = () {
|
||||
_videoFilterManager?.enterPipMode();
|
||||
};
|
||||
if (player!.state.playing) {
|
||||
_videoPIPManager!.updateAutoPipState(isPlaying: true);
|
||||
}
|
||||
}
|
||||
|
||||
// Shader Service (MPV only)
|
||||
_shaderService = ShaderService(player!);
|
||||
if (_shaderService!.isSupported) {
|
||||
@@ -1094,10 +1129,12 @@ class VideoPlayerScreenState extends State<VideoPlayerScreen> with WidgetsBindin
|
||||
}
|
||||
} on PlaybackException catch (e) {
|
||||
if (mounted) {
|
||||
_hasFirstFrame.value = true; // Hide spinner on error
|
||||
showErrorSnackBar(context, e.message);
|
||||
}
|
||||
} catch (e) {
|
||||
if (mounted) {
|
||||
_hasFirstFrame.value = true; // Hide spinner on error
|
||||
showErrorSnackBar(context, t.messages.errorLoading(error: e.toString()));
|
||||
}
|
||||
}
|
||||
@@ -1142,10 +1179,29 @@ class VideoPlayerScreenState extends State<VideoPlayerScreen> with WidgetsBindin
|
||||
|
||||
appLogger.d('Starting offline playback: $videoPath');
|
||||
|
||||
// Load cached media info so track selection (audio language) works offline
|
||||
PlexMediaInfo? mediaInfo;
|
||||
try {
|
||||
final serverId = widget.metadata.serverId;
|
||||
if (serverId != null) {
|
||||
final cached = await PlexApiCache.instance.get(serverId, '/library/metadata/${widget.metadata.ratingKey}');
|
||||
final metadataJson = PlexCacheParser.extractFirstMetadata(cached);
|
||||
if (metadataJson != null) {
|
||||
mediaInfo = PlexMediaInfo.fromMetadataJson(metadataJson);
|
||||
}
|
||||
appLogger.d(
|
||||
'Offline media info: cached=${cached != null}, hasMedia=${metadataJson?['Media'] != null}, '
|
||||
'audioTracks=${mediaInfo?.audioTracks.length ?? 0}, subtitleTracks=${mediaInfo?.subtitleTracks.length ?? 0}',
|
||||
);
|
||||
}
|
||||
} catch (e) {
|
||||
appLogger.d('Could not load cached media info for offline playback', error: e);
|
||||
}
|
||||
|
||||
return PlaybackInitializationResult(
|
||||
availableVersions: [],
|
||||
videoUrl: videoPath.contains('://') ? videoPath : 'file://$videoPath',
|
||||
mediaInfo: null,
|
||||
mediaInfo: mediaInfo,
|
||||
externalSubtitles: const [],
|
||||
isOffline: true,
|
||||
);
|
||||
@@ -1599,11 +1655,16 @@ class VideoPlayerScreenState extends State<VideoPlayerScreen> with WidgetsBindin
|
||||
_sendLiveTimeline('stopped');
|
||||
_stopLiveTimelineUpdates();
|
||||
|
||||
// Remove PiP state listener, clear callback, and dispose video filter manager
|
||||
// Remove PiP state listener, clear callbacks, disable auto-PiP, and dispose video filter manager
|
||||
_videoPIPManager?.isPipActive.removeListener(_onPipStateChanged);
|
||||
_videoPIPManager?.onBeforeEnterPip = null;
|
||||
_videoPIPManager?.disableAutoPip();
|
||||
PipService.onAutoPipEntering = null;
|
||||
_videoFilterManager?.dispose();
|
||||
|
||||
// Release cached BIF thumbnail data
|
||||
_bifService?.dispose();
|
||||
|
||||
// Mark sleep timer for restart if truly exiting (not episode transition)
|
||||
if (!_isReplacingWithVideo) {
|
||||
SleepTimerService().markNeedsRestart();
|
||||
@@ -1692,8 +1753,11 @@ class VideoPlayerScreenState extends State<VideoPlayerScreen> with WidgetsBindin
|
||||
/// descendant has focus, so internal movement between child controls
|
||||
/// does NOT trigger this.
|
||||
void _onScreenFocusChanged() {
|
||||
if (_reclaimingFocus) return;
|
||||
if (!_screenFocusNode.hasFocus && mounted && !_isExiting.value) {
|
||||
_reclaimingFocus = true;
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
_reclaimingFocus = false;
|
||||
if (mounted && !_isExiting.value && !_screenFocusNode.hasFocus) {
|
||||
_screenFocusNode.requestFocus();
|
||||
}
|
||||
@@ -1725,6 +1789,11 @@ class VideoPlayerScreenState extends State<VideoPlayerScreen> with WidgetsBindin
|
||||
} else {
|
||||
DiscordRPCService.instance.pausePlayback();
|
||||
}
|
||||
|
||||
// Update auto-PiP readiness on Android
|
||||
if (Platform.isAndroid && _autoPipEnabled) {
|
||||
_videoPIPManager?.updateAutoPipState(isPlaying: isPlaying);
|
||||
}
|
||||
}
|
||||
|
||||
void _onVideoCompleted(bool completed) async {
|
||||
@@ -2056,26 +2125,63 @@ class VideoPlayerScreenState extends State<VideoPlayerScreen> with WidgetsBindin
|
||||
}
|
||||
}
|
||||
|
||||
/// Wait briefly for profile settings to load in offline mode.
|
||||
/// This prevents default-track fallback when playback starts before
|
||||
/// UserProfileProvider finishes initialization.
|
||||
Future<void> _waitForProfileSettingsIfNeeded() async {
|
||||
if (!widget.isOffline || !mounted) return;
|
||||
|
||||
final provider = context.read<UserProfileProvider>();
|
||||
if (provider.profileSettings != null) return;
|
||||
|
||||
final completer = Completer<void>();
|
||||
late VoidCallback listener;
|
||||
listener = () {
|
||||
if (provider.profileSettings != null && !completer.isCompleted) {
|
||||
completer.complete();
|
||||
}
|
||||
};
|
||||
|
||||
provider.addListener(listener);
|
||||
try {
|
||||
await Future.any<void>([completer.future, Future.delayed(const Duration(seconds: 2))]);
|
||||
} finally {
|
||||
provider.removeListener(listener);
|
||||
}
|
||||
}
|
||||
|
||||
/// Apply track selection using the TrackSelectionService
|
||||
Future<void> _applyTrackSelection() async {
|
||||
if (!mounted || player == null) return;
|
||||
if (!mounted || player == null || _isApplyingTrackSelection) return;
|
||||
|
||||
final profileSettings = context.read<UserProfileProvider>().profileSettings;
|
||||
final settingsService = await SettingsService.getInstance();
|
||||
final trackService = TrackSelectionService(
|
||||
player: player!,
|
||||
profileSettings: profileSettings,
|
||||
metadata: widget.metadata,
|
||||
plexMediaInfo: _currentMediaInfo,
|
||||
);
|
||||
_isApplyingTrackSelection = true;
|
||||
try {
|
||||
await _waitForProfileSettingsIfNeeded();
|
||||
if (!mounted || player == null) return;
|
||||
|
||||
await trackService.selectAndApplyTracks(
|
||||
preferredAudioTrack: widget.preferredAudioTrack,
|
||||
preferredSubtitleTrack: widget.preferredSubtitleTrack,
|
||||
defaultPlaybackSpeed: settingsService.getDefaultPlaybackSpeed(),
|
||||
onAudioTrackChanged: _onAudioTrackChanged,
|
||||
onSubtitleTrackChanged: _onSubtitleTrackChanged,
|
||||
);
|
||||
final profileSettings = context.read<UserProfileProvider>().profileSettings;
|
||||
final settingsService = await SettingsService.getInstance();
|
||||
if (!mounted || player == null) return;
|
||||
|
||||
final trackService = TrackSelectionService(
|
||||
player: player!,
|
||||
profileSettings: profileSettings,
|
||||
metadata: widget.metadata,
|
||||
plexMediaInfo: _currentMediaInfo,
|
||||
);
|
||||
|
||||
await trackService.selectAndApplyTracks(
|
||||
preferredAudioTrack: widget.preferredAudioTrack,
|
||||
preferredSubtitleTrack: widget.preferredSubtitleTrack,
|
||||
defaultPlaybackSpeed: settingsService.getDefaultPlaybackSpeed(),
|
||||
onAudioTrackChanged: _onAudioTrackChanged,
|
||||
onSubtitleTrackChanged: _onSubtitleTrackChanged,
|
||||
);
|
||||
} catch (e) {
|
||||
appLogger.w('Failed to apply track selection', error: e);
|
||||
} finally {
|
||||
_isApplyingTrackSelection = false;
|
||||
}
|
||||
}
|
||||
|
||||
/// Rating key used for series/movie level language preferences.
|
||||
@@ -2505,9 +2611,7 @@ class VideoPlayerScreenState extends State<VideoPlayerScreen> with WidgetsBindin
|
||||
shaderService: _shaderService,
|
||||
// ignore: no-empty-block - setState triggers rebuild to reflect shader change
|
||||
onShaderChanged: () => setState(() {}),
|
||||
thumbnailUrlBuilder: _hasThumbnails && _currentMediaInfo?.partId != null
|
||||
? (Duration time) => _buildThumbnailUrl(context, time)!
|
||||
: null,
|
||||
thumbnailDataBuilder: _bifService?.isAvailable == true ? _getThumbnailData : null,
|
||||
isLive: widget.isLive,
|
||||
liveChannelName: _liveChannelName,
|
||||
isAmbientLightingEnabled: _ambientLightingService?.isEnabled ?? false,
|
||||
@@ -2857,7 +2961,7 @@ String _getHwdecValue(bool enabled) {
|
||||
if (Platform.isMacOS || Platform.isIOS) {
|
||||
return 'videotoolbox';
|
||||
} else if (Platform.isAndroid) {
|
||||
return 'auto-safe';
|
||||
return 'mediacodec,mediacodec-copy';
|
||||
} else {
|
||||
return 'auto'; // Windows, Linux
|
||||
}
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
import 'dart:isolate';
|
||||
import 'dart:typed_data';
|
||||
|
||||
import 'plex_client.dart';
|
||||
import '../utils/app_logger.dart';
|
||||
|
||||
/// A single BIF thumbnail entry: timestamp in milliseconds + JPEG bytes.
|
||||
typedef BifEntry = ({int timestampMs, Uint8List imageBytes});
|
||||
|
||||
/// Parse raw BIF file bytes into a list of thumbnail entries.
|
||||
///
|
||||
/// BIF format:
|
||||
/// - 0..7 : magic bytes (0x89 "BIF" 0x0D 0x0A 0x1A 0x0A)
|
||||
/// - 8..11 : version (uint32 LE)
|
||||
/// - 12..15 : image count (uint32 LE)
|
||||
/// - 16..19 : timestamp multiplier (uint32 LE, ms per unit; 0 = 1000)
|
||||
/// - 20..63 : reserved
|
||||
/// - 64.. : index table — (imageCount + 1) entries of 8 bytes each:
|
||||
/// [timestamp (uint32 LE), offset (uint32 LE)]
|
||||
/// The last entry is a sentinel (timestamp = 0xFFFFFFFF).
|
||||
///
|
||||
/// Top-level function so it can be passed to [Isolate.run].
|
||||
List<BifEntry> _parseBifBytes(Uint8List bytes) {
|
||||
if (bytes.length < 64) return [];
|
||||
|
||||
final data = ByteData.sublistView(bytes);
|
||||
|
||||
// Validate magic: 0x89 B I F 0x0D 0x0A 0x1A 0x0A
|
||||
const magic = [0x89, 0x42, 0x49, 0x46, 0x0D, 0x0A, 0x1A, 0x0A];
|
||||
for (var i = 0; i < magic.length; i++) {
|
||||
if (bytes[i] != magic[i]) return [];
|
||||
}
|
||||
|
||||
final imageCount = data.getUint32(12, Endian.little);
|
||||
var timestampMultiplier = data.getUint32(16, Endian.little);
|
||||
if (timestampMultiplier == 0) timestampMultiplier = 1000;
|
||||
|
||||
// Index table starts at byte 64; each entry is 8 bytes.
|
||||
// There are (imageCount + 1) entries (last is sentinel).
|
||||
final indexTableSize = (imageCount + 1) * 8;
|
||||
if (bytes.length < 64 + indexTableSize) return [];
|
||||
|
||||
final entries = <BifEntry>[];
|
||||
for (var i = 0; i < imageCount; i++) {
|
||||
final entryOffset = 64 + i * 8;
|
||||
final timestamp = data.getUint32(entryOffset, Endian.little);
|
||||
final imgOffset = data.getUint32(entryOffset + 4, Endian.little);
|
||||
|
||||
// Next entry's offset gives us the end of this image's data.
|
||||
final nextEntryOffset = 64 + (i + 1) * 8;
|
||||
final nextImgOffset = data.getUint32(nextEntryOffset + 4, Endian.little);
|
||||
|
||||
if (nextImgOffset <= imgOffset || nextImgOffset > bytes.length) continue;
|
||||
|
||||
entries.add((
|
||||
timestampMs: timestamp * timestampMultiplier,
|
||||
imageBytes: Uint8List.sublistView(bytes, imgOffset, nextImgOffset),
|
||||
));
|
||||
}
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
/// Caches a full BIF file in memory and serves thumbnails by timestamp.
|
||||
class BifThumbnailService {
|
||||
List<BifEntry>? _entries;
|
||||
|
||||
/// Download and parse the BIF file for [partId].
|
||||
/// Returns silently on failure (thumbnails simply won't be available).
|
||||
Future<void> load(PlexClient client, int partId) async {
|
||||
_entries = null;
|
||||
try {
|
||||
final bytes = await client.downloadBifFile(partId);
|
||||
if (bytes == null || bytes.isEmpty) return;
|
||||
_entries = await Isolate.run(() => _parseBifBytes(bytes));
|
||||
} catch (e) {
|
||||
appLogger.w('BIF download/parse failed', error: e);
|
||||
}
|
||||
}
|
||||
|
||||
/// Whether thumbnails have been loaded successfully.
|
||||
bool get isAvailable => _entries != null && _entries!.isNotEmpty;
|
||||
|
||||
/// Return the JPEG bytes for the thumbnail nearest to [time].
|
||||
/// Uses binary search for O(log n) lookup.
|
||||
Uint8List? getThumbnail(Duration time) {
|
||||
final entries = _entries;
|
||||
if (entries == null || entries.isEmpty) return null;
|
||||
|
||||
final ms = time.inMilliseconds;
|
||||
|
||||
// Binary search for the largest timestamp <= ms.
|
||||
var lo = 0;
|
||||
var hi = entries.length - 1;
|
||||
while (lo < hi) {
|
||||
final mid = (lo + hi + 1) ~/ 2; // bias right
|
||||
if (entries[mid].timestampMs <= ms) {
|
||||
lo = mid;
|
||||
} else {
|
||||
hi = mid - 1;
|
||||
}
|
||||
}
|
||||
|
||||
return entries[lo].imageBytes;
|
||||
}
|
||||
|
||||
/// Release cached data.
|
||||
void dispose() {
|
||||
_entries = null;
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@ import 'dart:math';
|
||||
import 'package:web_socket_channel/io.dart';
|
||||
|
||||
import '../../models/companion_remote/remote_command.dart';
|
||||
import '../../models/companion_remote/remote_command_type.dart';
|
||||
import '../../models/companion_remote/remote_session.dart';
|
||||
import '../../utils/app_logger.dart';
|
||||
|
||||
|
||||