google / google/ExoPlayer

SurfaceView vs. TextureView in a scrolling container on N+ devices

Open
#7,414 0 comments 0 reactions 1 assignee Assigned to @icbaker View on GitHub
bug needs triage
Dominant language
Java
Stars
21.9k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

### [REQUIRED] Issue description
According to the [documentation](https://exoplayer.dev/ui-components.html#choosing-a-surface-type), if the application is running on a N+ device, playback in a SurfaceView should work just as well as TextureView in an scrolling container.

> SurfaceView rendering wasn’t properly synchronized with view animations until Android N. On earlier releases this could result in unwanted effects when a SurfaceView was placed into scrolling container, or when it was subjected to animation. Such effects included the view’s contents appearing to lag slightly behind where it should be displayed, and the **view turning black when subjected to animation.** To achieve smooth animation or scrolling of video prior to Android N, it’s therefore necessary to use TextureView rather than SurfaceView.

My issue is, in my project this doesn't seems to be true. SurfaceView turns black even on Pie.

I'm showing an imageview on top of the playerview, when the player is ready, i hide the image so the playerview is visible.

PlayerView using TextureView as surface_type:
https://gfycat.com/wellwornacclaimedbluetonguelizard

PlayerView using SurfaceView as surface_type:
https://gfycat.com/damagedagitatedichthyostega

This issue is present on my Nvidia Shield TV too, even tho that is a way faster device, so the "black screen" is just a quick flash.

### [REQUIRED] Reproduction steps
If it's needed i can provide an sample application, but obviously that will take some work on my part.

### [REQUIRED] A full bug report captured from the device
[bugreport-BRAVIA_ATV3_4K_EU-OPR2.170623.027.S25-2020-05-22-13-41-49.zip](https://github.com/google/ExoPlayer/files/4667890/bugreport-BRAVIA_ATV3_4K_EU-OPR2.170623.027.S25-2020-05-22-13-41-49.zip)
[demo_videos.zip](https://github.com/google/ExoPlayer/files/4667891/demo_videos.zip)

### [REQUIRED] Version of ExoPlayer being used
2.11.0

### [REQUIRED] Device(s) and version(s) of Android being used
Sony Bravia, running 8.0.0
Nvidia Shield TV 2019 running 9

using Leanback framework (AndroidX)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.