fix(android): auto buffer size to prevent OOM

This commit is contained in:
edde746
2026-02-23 05:42:04 +01:00
parent 6916b386eb
commit 26ff55e005
25 changed files with 123 additions and 28 deletions
@@ -344,6 +344,8 @@ class ExoPlayerCore(private val activity: Activity) : Player.Listener {
setTargetBufferBytes(bufferSizeBytes)
setPrioritizeTimeOverSizeThresholds(false)
Log.d(TAG, "Buffer byte limit set to ${bufferSizeBytes / 1024 / 1024}MB")
} else {
Log.d(TAG, "Buffer in auto mode (time-based thresholds)")
}
}.build()
@@ -1,6 +1,8 @@
package com.edde746.plezy.exoplayer
import android.app.Activity
import android.app.ActivityManager
import android.content.Context
import android.net.Uri
import android.util.Log
import com.edde746.plezy.mpv.MpvPlayerCore
@@ -119,6 +121,10 @@ class ExoPlayerPlugin : FlutterPlugin, MethodChannel.MethodCallHandler,
)
"getStats" -> handleGetStats(result)
"getPlayerType" -> result.success(if (usingMpvFallback) "mpv" else "exoplayer")
"getHeapSize" -> {
val am = activity?.getSystemService(Context.ACTIVITY_SERVICE) as? ActivityManager
result.success(am?.largeMemoryClass ?: 0)
}
"setSubtitleStyle" -> handleSetSubtitleStyle(call, result)
"observeProperty" -> handleObserveProperty(call, result)
else -> result.notImplemented()