'ExoPlayer PlayerView inflation taking time and causing significant frame drops

Inflation of com.google.android.exoplayer2.ui.PlayerView takes close to 25 to 30 ms on an average. And we are using in viewpager, so everytime user swipes the page, because of PlayerView inflation taking time, there is significant frame drops observed.

Is there any way this can optimised with some attributes / configuration (or) in any other way?

Edit : I am using texture_view as surface type, app:surface_type="texture_view"



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source