Tencent / Tencent/libpag

Android端特定PAG文件在4.5.x版本播放抖动

Open
#3,689 0 comments 0 reactions 1 assignee View on GitHub

@CodeJhF is already working on this.

Since Aug 25, 2026.

Dominant language
HTML
Stars
5.8k
Forks
531
Avg merge
8d 55m
Merged PRs (30d)
17

Description

【版本信息】

libpag:4.5.84

【平台信息】

Android 原生

【预期的表现】

能够播放正常

【实际的情况】

  1. 在4.5.x版本使用PAGView播放特效会抖动,使用PAGImageView播放特效会跳帧
  2. 在4.4.35版本播放正常

【Demo及附件】

3118272043758928896.pag.zip

https://github.com/user-attachments/assets/559643ae-f734-47d7-995f-134740e59da0

`
class PAGTestActivity : AppCompatActivity() {

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    val root = LinearLayout(this).apply {
        orientation = LinearLayout.VERTICAL
        layoutParams = ViewGroup.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT,
        )
    }
    setContentView(root)

    val playerContainer = FrameLayout(this)
    root.addView(
        playerContainer,
        LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT,
            0,
            1f,
        )
    )

    val playerLayoutParams = FrameLayout.LayoutParams(
        ViewGroup.LayoutParams.MATCH_PARENT,
        ViewGroup.LayoutParams.MATCH_PARENT,
    )
    val pagView = PAGView(this).apply {
        visibility = View.INVISIBLE
        playerContainer.addView(this, playerLayoutParams)
    }
    val pagImageView = PAGImageView(this).apply {
        visibility = View.INVISIBLE
        playerContainer.addView(this, playerLayoutParams)
    }

    val controls = LinearLayout(this).apply {
        orientation = LinearLayout.HORIZONTAL
    }
    root.addView(
        controls,
        LinearLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.WRAP_CONTENT,
        )
    )
    controls.addView(Button(this).apply {
        text = "播放 PAGView"
        setOnClickListener {
            pagImageView.pause()
            pagImageView.visibility = View.INVISIBLE
            pagView.visibility = View.VISIBLE
            pagView.setRepeatCount(0)
            pagView.setPath(PAG_ASSET_PATH)
            pagView.play()
        }
    }, LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1f))
    controls.addView(Button(this).apply {
        text = "播放 PAGImageView"
        setOnClickListener {
            pagView.pause()
            pagView.visibility = View.INVISIBLE
            pagImageView.visibility = View.VISIBLE
            pagImageView.setRepeatCount(0)
            pagImageView.setPath(PAG_ASSET_PATH)
            pagImageView.play()
        }
    }, LinearLayout.LayoutParams(0, ViewGroup.LayoutParams.WRAP_CONTENT, 1f))
}

companion object {
    private const val PAG_ASSET_PATH = "assets://pag/3118272043758928896.pag"
}

}

`

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.