feat: glass effect toggle, media refresh timing fix, page transition perf
This commit is contained in:
@@ -68,6 +68,19 @@ class MediaSessionSource(context: Context) {
|
||||
callback = null
|
||||
}
|
||||
|
||||
// 主动拉取当前会话并回调(不重新注册监听),供 H5 页面就绪后刷新媒体卡
|
||||
// Actively pull the current session and notify (without re-registering), for
|
||||
// refreshing the media card once the H5 page is ready
|
||||
fun refresh() {
|
||||
val cb = callback ?: return
|
||||
try {
|
||||
val current = msm.getActiveSessions(listenerComponent).firstOrNull()
|
||||
notifyMedia(current, cb)
|
||||
} catch (e: SecurityException) {
|
||||
Log.w(TAG, "refresh: no notification access: ${e.message}")
|
||||
}
|
||||
}
|
||||
|
||||
// 从 controller 提取 metadata + playbackState 构造 MediaInfo 并回调
|
||||
// Build MediaInfo from the controller's metadata + playbackState and invoke the callback
|
||||
private fun notifyMedia(controller: MediaController?, cb: (MediaInfo?) -> Unit) {
|
||||
|
||||
Reference in New Issue
Block a user