fix: 修复视频播放黑屏和图片残留问题
- 从 stopVideo() 中移除 clearSurface() 调用,避免与 MediaPlayer 冲突 - 在 drawBitmapSync() 中绘制图片前先用黑色填充 Canvas - 这样既避免了视频黑屏,又消除了视频画面残留 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8ebbb4a2d4
commit
0b730596b3
1 file changed
+3
-2
@@ -586,6 +586,9 @@ public class AutoWallpaperService extends WallpaperService {
|
||||
try {
|
||||
canvas = holder.lockCanvas();
|
||||
if (canvas != null) {
|
||||
// 清除 Canvas,避免视频画面残留
|
||||
canvas.drawColor(Color.BLACK);
|
||||
// Draw a color first
|
||||
// Calculate scale to cover the entire screen
|
||||
float scaleX = (float) width / bitmap.getWidth();
|
||||
float scaleY = (float) height / bitmap.getHeight();
|
||||
@@ -845,8 +848,6 @@ public class AutoWallpaperService extends WallpaperService {
|
||||
if (isPlayingVideo) {
|
||||
videoPlayer.release();
|
||||
isPlayingVideo = false;
|
||||
// 清除视频画面,避免保留最后帧
|
||||
clearSurface();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user