3

I have started experiencing a strange case about 2-3 months ago. I have an application that streams videos from azure media services and it was all working fine. I am using EXO Player to play videos with progressive download mode. Azure provides a progressiove download link to videos inside the blob storage with media services.

Then i have realized the streaming became ridiculously slow inside the app. I am opening the same link in Chrom inside my Android Phone (Samsung Note 8) and it loads fine. I am opening the same streaming link on desktop browser and it loads fine too. Only strange thing is it loads excruciatingly slow inside the app.

I am suspecting that it could be an issue with newer android versions like 8 or 9. Because i used to use Samsung Note 2 and it was streaming fine there. I have seen similar performence issues in these questions too but none of them are related to streaming services not have an answer.

Why Azure table storage data loading slow in my Android app?

Azure web api call slow on phone but works well on android emulator

How to speed up cloud service running in windows azure?

Windows Azure Active Directory slow authentication on mobile devices

Any idea would be appreciated.

UPDATE

Streaming services is not the problem because the same streaming link also works fine inside the IOS app. Only trouble is inside the android app.

UPDATE 2

I have converted the player to ExoPlayer and the result is still the same. I have written a small app and opened exactly the same video link and it has loaded just fine on my phone. Only and literally only problem is inside my own app. I open it in demo app, it loads fine. I switch to my original app, it loads slow and sometimes does not even start. I have tried every solution i can ever think of :(

Numan Karaaslan
  • 1,365
  • 1
  • 17
  • 25

1 Answers1

0

Well Android web views are slow. I am facing the same issues from generations. But it depends on particular fields. Here are few code snippets which you can try. Or modify it according to your use case.

WebView mWebView = new WebView(this);

WebSettings settings = mWebView.getSettings();

Enable javascript and other modes

settings.setJavaScriptEnabled(true);
settings.setLoadWithOverviewMode(true);
settings.setUseWideViewPort(true);

Well, I don't thik you need it. But if needed by someone else.

settings.setSupportZoom(false);
settings.setBuiltInZoomControls(false);

Set algorithm type in webview. settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);

Try to change cache options like, Disable the cache if you have problems with your content settings.setCacheMode(WebSettings.LOAD_NO_CACHE);

Try to use DOM storage settings.setDomStorageEnabled(true);

Well this are optional, but it helps in my case

mWebView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
mWebView.setScrollbarFadingEnabled(true);

Here are some more. If you want to set acceleration type in webview then

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    // chromium, enable hardware acceleration
    mWebView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
} else {
    // if you are using older android version, disable hardware acceleration
    mWebView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
}

Well you can also use android:hardwareAccelerated="true" or "false" in your manifest. For me false did the trick. You can see the proof reading of it here.

Ranjan
  • 1,326
  • 18
  • 38
  • thanks for the advice. but i am not using webwievs. Right now i am usin EXOPlayer to play videos. I cannot modify it :/ I will try hardware acceleration but i think the problem is related to video streaming method from Azure. It is actually progressive download. But i don't know which step can be the cause :( I will update my question with additional info too. – Numan Karaaslan Apr 29 '20 at 19:59