One videoview blocked by another videoview

前端 未结 1 1891
不知归路
不知归路 2021-01-07 05:40

My activity layout is shown below. Basically I have a listview menu on the left and two videoviews that I switch between depending on which menu item the user clicks.

<
相关标签:
1条回答
  • 2021-01-07 06:15

    VideoViews are SurfaceViews. They work by effectively popping a window through to the hardware framebuffer. But there is only one such hardware framebuffer that you are trying to show in both SurfaceViews, as well as write to with both MediaPlayers. Thus, there are numerous rendering errors that can occurs when trying to juggle multiple SurfaceViews, and such errors will not be consistent between different devices.

    The simplest answer is don't do it. Isolate each VideoView into separate Activities, or reconstruct your layout so that you can share a single video view.

    The next simplest answer is don't do it simultaneously. When switching between two video views, remove one (completely remove it from the View hierarchy) before activating another. Maybe use an ImageView placeholder in between to keep the UI relative consistent as the use makes such a switch.

    0 讨论(0)
提交回复
热议问题