Azure streaming is slow only inside Android app - android

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 :(

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.

Related

WebGL in Android WebView

I know this has been asked before but those questions are pretty old now.
I have a "game" that I developed some time ago with WebGL and I want to bring it to Android with a simple WebView.
The problem now is, that it won't really respond to the user input in the WebView (Chrome works just fine. Android 7.1.1) . I guess that's because of WebGL.
So now, as the crosswalk-project has ended a while ago I am searching for an alternative to run WebGL in my application. Or somehow just run my "game" in an Android App.
Do you have any idea of how I could bring it to work?
From 5.0 Android comes with Android System WebView which is being updated and we might call it the Native WebView. WebGL should work there although some of WebGL extensions and WebGL 2 (stats) might not.
The key to make your game work as an application is following.
First you must identify what WebGL version, WebGL extensions, WebGL or Shader capabilities and other HTML5 functionality your game (and the game engine you use) requires.
Then you must find a WebView that supports that functionality. You can simply do that by opening webpages https://html5test.com/ and http://webglreport.com/ with the WebView you want on your Android device. IMPORTANT! If you for example open the webpage with installed Chrome browser, it doesn't guarantee the Native WebView is used! So it is better to write a small custom application to make sure you are testing the WebView you want to use for the game.
In the end you will probably end up with compiling your game in application with custom WebView which will add an additional size to your game.
Other useful informations
Android versions < 5.0 has a Native WebView that doesn't come with updates so it doesn't support WebGL and this will not change. But the Chrome browser (or other installed browsers) is likely to support WebGL there, because it comes with custom WebView.
Samsung really messed up. I mean it, they are customizing Android OS a lot including some black magic with WebViews => Native WebView doesn't work there properly, so custom WebView in your application is must.
We (GAMEE) are using the Native WebView and XWalkView for Samsung and Android < 5.0 and WebGL games are working just fine right now.

Android application - Only audio running on HTML5 video

Right now, I'm developing mobile application - Simple Web browser with Android Studio 2.3 (Android SDK API 15).
I'm using WebView to display web pages. All renders properly except videos (on YouTube or other platform with HTML5 videos). I can only hear audio but the screen of the video is black and that's it. I tried different solutions:
I enabled hardware acceleration on in Manifest file:
android:hardwareAccelerated="true"
Also I set this for my Main Activity java file. Brow is my variable for WebView.
brow.setWebChromeClient(new WebChromeClient());
brow.getSettings().setAllowFileAccess(true);
brow.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
And still with no luck. You can see my problem on the screenshot. So I'm waiting for working solution! If you need more info, type comment below! Thanks!
Screenshot of the problem

YouTube player API does not work with IE10 and Android?

Good time passed since the relevant posts - 2 years. I wonder if the mistake is on my part - I am using this tutorial
https://developers.google.com/youtube/iframe_api_reference?csw=1
"Getting started section".
I very enjoy the player itself which works perfectly on Firefox 23.0.1 and Chrome 29.0.1547.62 m, but it freezes in IE10 and on my Android Galaxy Nexus phone 4.3.
In IE10 it seems to freeze on the player state change. I've also tried Firefox app on my phone and again it works while native browser freezes on the same player state change.
I've checked the spec and it seems HTML5 player is supported by both IE past 8 and Android.
Could anyone enlighten me please whether the mistake is on my part or something is fundamentally wrong with IE and my Android phone native browser?
I have same problem. When I open same page with Android Chrome, video is loading successfully. But Built-in android browser and also Lumia's browser(IE) can't load video.
That's a strange situation that video can be load at Youtube player's demo page(https://developers.google.com/youtube/youtube_player_demo) on Android's native browser.

Android WebView VS Phone Browser

I've experienced a LOT of strange behaviours with using WebView in Android and I'm wondering why there are so many diffrences between the WebView and the Browserinstalled on each phone?
As an example, I've developed some applications that had to display HTML content, which contained either jquery-mobile, flash,javascript, YouTube embedded and so on. So I had a lot of problems with displaying this pages inside WebViews. Either they wouldn't get displayed at all, just blank, either the videos won't play and so on. And the strange thing is that they work properly if opened in the Browser installed on the phone. I had JavaScript enabled, I tried diffrent WebSettings, I had set the WebChromeClient and WebViewClient looking for javascript errors... but nothing worked.
So I got to the conclusion that the WebView component is completely different from the Browser application installed on the phones. I'm thinking that every manufacturer makes their own Browser to support as many as possible pages, and the WebView remains the standard one, included in the Android SDK.
Am I right? Or there is another reasons/explanation for this?
Thanks.
EDIT: Everything that #ondoteam has suggested was enabled and set at the time being. I no longer have the references to that websites, which anyway were internal.
This article outlines your speculation about stock browser differences between manufacturers, that absolutely is true: 5 reality checks every team needs before working on Android webkit
...which does cause trouble and mysterious/difficult to diagnose/solve problems.
As far as your issues with your WebView implementation:
Version of jquery-mobile may be an issue jquery-mobile loaded into an android WebView if you are using jquery.mobile-1.0.1.min.js you may want to try the uncompressed jquery.mobile-1.0.1.js
And Flash :-/ Good luck:
Screen blinking when using a webview with flash
Flash in WebView not working on Android 3.2
Flash video not displaying in WebView for Android 3.0.1
For loading SWF:
Load an SWF into a WebView
loading flash files (.swf) webview in android
Good luck with that, seems like a lot of variables with devices, Android versions, etc. And will take persistence with trial/error.
The stock browser and WebView differs .Using all the tweaks like
WebView browser;
browser.clearFormData();
browser.clearHistory();
browser.clearCache(true);
browser.getSettings().setAppCacheEnabled(true);
browser.getSettings().setDatabaseEnabled(true);
browser.getSettings().setDomStorageEnabled(true);
browser.setWebChromeClient(new WebChromeClient());
still it does not load high resolution images properly which is being loaded perfectly well by the android browser.
Only part of the image can be visible on the webview screen which appears fully on normal android browser.
This behavior is observed with latest Android 4X SDK as well.
Which means android default browser significantly tweaks the webkit/webview code to show any url
WebView by default is restricted. You should call setWebChromeClient and family to have a decent browsing experience. In addition, don't forget setJavaScriptEnabled() and other similar stuff. Sorry for my brevity... I think that you don't need examples.
http://developer.android.com/reference/android/webkit/WebView.html
have you checked this question : jquery-mobile loaded into an android WebView
it might be that you're using the wrong libraries. Just check in any case.

WebView won't play embedded flash video

I am testing on a Xoom device, running OS 3.2. The project is built (in Eclipse) using the 3.1 library.
I have the latest version of flash installed, and embedded flash plays fine in my tablet's browser.
If I create an activity like this:
WebView browser = (WebView) findViewById(R.id.browserView);
browser .getSettings().setJavaScriptEnabled(true);
browser .getSettings().setPluginsEnabled(true);
browser .loadUrl("http://m.kongregate.com/games/Jiggmin/the-game-of-disorientation-mobile");
Then I hear the sound playing for the flash, but it shows up as a white box.
Similarly, any other page with embedded flash has the same problem. I've also tried making a string containing static HTML content, and loading that into the browser... but it has the same problem.
I've read every solution I could find online, from setting the view to invisible until the onPageFinish event is called, to extending the WebView class, and paining over it. I've tried reflection, to call hidden properties on the WebView's settings for enabling flash, etc. Nothing works.
Please help!
Thanks,
Mat
You can find my answer here :
Try to build your application with the latest android Api ( http://developer.android.com/guide/practices/optimizing-for-3.0.html#Upgrading ),
and activate hardware acceleration (same link, just a little below) on
your activity that need to display flash.

Categories

Resources