halilozercan / BetterVideoPlayer

Video playback on Android, made better in Kotlin, wrapping around the stock MediaPlayer API.
287 stars 95 forks source link

Player lags when swiping up/down to change volume #60

Open UGhari opened 6 years ago

UGhari commented 6 years ago

I enable swipe gestures on the player as follows:

        player = findViewById(R.id.player);
        player.setCallback(this);
        player.enableSwipeGestures(getWindow());
        player.setLoadingStyle(2);
        player.getToolbar().inflateMenu(R.menu.player);
        player.getToolbar().setOnMenuItemClickListener((item) -> {
           ...
        }
            return false;
        });

Heres the XML for the player:

<com.halilibo.bettervideoplayer.BetterVideoPlayer xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/player" android:layout_width="match_parent" android:layout_height="match_parent" app:bvp_autoPlay="true" />

Problem:

When swiping up/down to change volume (the video is still playing) the frame rate on the video drops significantly to roughly 10fps. As soon as you stop swiping/ release finger it goes back to normal smooth fps.

Any idea why this is happening? If so could you tell me why please? if its a fix in the code and you dont have time to implement it if you give me a high level overview as to why its happening and where in the code then ill be more than happy to help fix it with Pull Request