Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

DynamicRangeCompressor settings are not restored automatically on video playback (only applied when opening dialog)

Đang mở
#3,237 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

  • #1 của @SamoTech — đã đóng, không merge

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
63/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
android, kotlin
Lĩnh vực
mobile

Hướng nghiên cứu

Start in app/src/main/java/com/lagradost/cloudstream3/ui/player/FullScreenPlayer.kt and trace when the player and compressor become available relative to restoreCompressorSettings(). Then read DynamicRangeCompressor.kt and the player load or initialization path to identify a restoration point after the compressor is created. Done means saved settings, including enabled state, are active when a new video starts without opening the dialog.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Steps to reproduce
  1. Enable the Dynamic Range Compressor setting in CloudStream Player Settings.
  2. Play any video in the player and turn ON the compressor in the compressor dialog (or apply a preset).
  3. Close the player or play another episode/video.
  4. Listen to the audio during playback: the compressor is NOT active (dialogues are quiet, volume spikes are untamed).
  5. Tap the screen to reveal player controls and tap the Compressor button (playerCompressorBtt) to open the compressor dialog.
  6. The exact instant the dialog opens, the compressor immediately kicks in and the audio becomes compressed / boosted.
Expected behavior

When DynamicRangeCompressor has been enabled by the user, newly played videos should automatically restore and activate the compressor settings upon playback initialization without requiring the user to tap the screen and open the compressor dialog manually.

Actual behavior

Every newly started video plays with DynamicRangeCompressor.enabled = false. It is only switched to enabled = true when the user manually taps the compressor button to open showCompressorDialog().

Cloudstream version and commit hash

Pre-release / master branch (Commit 4e2516d / PR #3117)

Android version

Android 12+ (All versions, TV and Phone)

Logcat
N/A (Functional lifecycle timing issue in player initialization)
Other details
Root Cause Analysis

In app/src/main/java/com/lagradost/cloudstream3/ui/player/FullScreenPlayer.kt:

restoreCompressorSettings() is only called in two locations:

  1. In onBindingCreated():
playerBinding?.apply {
    playerSpeedBtt.isVisible = playBackSpeedEnabled
    playerCompressorBtt.isVisible = playBackCompressorEnabled
    if (playBackCompressorEnabled) {
        restoreCompressorSettings()
    }
    ...
  1. In showCompressorDialog():
private fun showCompressorDialog() {
    val act = activity ?: return
    val compressor = (player as? CS3IPlayer)?.compressor ?: return

    // Always restore — CS3IPlayer is recreated between videos
    restoreCompressorSettings()
    ...

Inside restoreCompressorSettings():

protected fun restoreCompressorSettings() {
    val c = (player as? CS3IPlayer)?.compressor ?: return
    c.enabled     = getKey(COMPRESSOR_ENABLED_KEY)   ?: false
    c.threshold   = getKey(COMPRESSOR_THRESHOLD_KEY) ?: -24f
    c.ratio       = getKey(COMPRESSOR_RATIO_KEY)     ?: 8f
    c.attackMs    = getKey(COMPRESSOR_ATTACK_KEY)    ?: 5f
    c.releaseMs   = getKey(COMPRESSOR_RELEASE_KEY)   ?: 400f
    c.makeupGain  = getKey(COMPRESSOR_MAKEUP_KEY)    ?: 12f
}

The Bug:
When onBindingCreated() runs, the media stream has not yet started loading and ExoPlayer has not yet built its renderers. Therefore, (player as? CS3IPlayer)?.compressor is still null.
As a result, val c = (player as? CS3IPlayer)?.compressor ?: return immediately returns without doing anything.

Later, when CS3IPlayer.load() executes and builds ExoPlayer, a new instance of DynamicRangeCompressor is created. In DynamicRangeCompressor.kt:

@Volatile var enabled: Boolean = false

The compressor is initialized with enabled = false. Because restoreCompressorSettings() is never called again after load(), the compressor remains OFF throughout playback.

When the user manually taps the compressor button while the video is playing, showCompressorDialog() is invoked. At that point, compressor is no longer null, so restoreCompressorSettings() finally runs and turns c.enabled = true.

Suggested Fix

Call restoreCompressorSettings() once the player / renderers are actually initialized (e.g. inside CS3IPlayer.load() after creating DynamicRangeCompressor, or on Player.Listener.onPlaybackStateChanged / onRenderedFirstFrame in FullScreenPlayer).

Alternatively, pass the initial enabled state and saved values from DataStore directly into DynamicRangeCompressor's constructor or factory when CS3IPlayer creates it in setRenderersFactory.

Acknowledgements
  • I am sure my issue is related to the app and NOT some extension.
  • I have searched the existing issues and this is a new ticket, NOT a duplicate or related to another open issue.
  • I have written a short but informative title.
  • I have updated the app to pre-release version Latest.
  • I will fill out all of the requested information in this form.
Ngôn ngữ chính
Kotlin
Star
11k
Fork
1.1k
Merge trung bình
3 ngày 3 giờ
Pull request đã merge (30 ngày)
15

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của recloudstream/cloudstream

Tất cả issue của recloudstream/cloudstream

Issue tương tự

Thêm issue về Kotlin

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.