Android application - Only audio running on HTML5 video - android

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

Related

Video playback issues in Air for Android

I am developing an advertisement application which plays multiple videos. I have faced a very strange problem: nor the simple Video nor the StageVideo are not visible when I run the app on target android device. Even FLVPlayback is not visible.
I can hear the audio but the only way to get the video is to press back button and then get back to app. In this case the video is displayed on the top of the rest display objects. This happens only on a target device which is a chinese sibo android tablet. It has android 4.1 on board. As I see a lot of people had the similar issue with different devices:
http://forums.adobe.com/message/5429125
but the solution they have mentioned there -adding true to the manifest xml doesn't fix my issue.
Adobe also advises to do it
http://forums.adobe.com/message/4914005
I am using adobe air 4.0 sdk and the air 4.0 runtime on the device. I have tried to change renderMode to CPU/Direct/Auto but it doesn change anything.
The other three android devices I have - toshiba thrive tablet(4.0.4)/ eken tablet(4.2.2)/ htc desire c smartphone(4.0.3) play all the video content just fine.
I guess the problem is re: their custom firmware(it auto hides all system bars..etc in order to make it work in 'kiosk' mode) but wanted to try all the variants before give up on this.
Any advice will be highly appreciated.
Thanks,
Max
After hours of scouring I did find a solution for AIR 4.6.0.
add backgroundAlpha to application node in the FLEX xml:
<s:Application backgroundAlpha="0.0" ... >
in the app.xml, change the namespace to highest version (3.7)
<application xmlns="http://ns.adobe.com/air/application/3.7">
and under the <android> node, add this
<containsVideo>false</containsVideo>
these are the references I found:
https://community.adobe.com/t5/flash-player/12-11-2012-air-3-5-runtime-and-sdk-update/td-p/4661723
https://help.adobe.com/en_US/air/build/WSfffb011ac560372f2fea1812938a6e463-8000.html#WS1B1ABBB6-F1D9-43f0-BC3E-0135F15FFAC4
No video when using spark VideoPlayer AS3
https://issues.apache.org/jira/browse/FLEX-33856
https://issues.apache.org/jira/browse/FLEX-33896
I have found a way how to force this unfriendly tablet to play the video in Adobe Air app by encoding it into FLV format and then embedding it into a swf via Flash pro. In this case I had to sync the app and video framerate(24fps). I have also set usingVideo flag to false in app descriptor.
Playback quality and performance are not very good but it's the only working method at the moment - I guess those can be improved by tweaking flv encoder params.
Update 4/3/2014
As the video playback embedded into swf was awful on the target device I have decided to download all the android versions of air runtimes starting from 3.1 and test normal video playback on these. Finally I have got the following results:
3.1.0.557 - NO
3.2 - YES
3.3.0.365 - YES
3.4.0.254 - NO
3.5.0.60 - NO
3.6.0.609 - NO
3.7.0.186 - NO
3.8.0.147 - NO
3.9.0.141 - NO
4.0 - NO
In the end I have found the solution - I have uninstalled all modern versions downloaded from google play and installed 3.3.0.365. I think my experience can be useful for those who develop AIR apps for android where target devices are noname low-end android tablets.
PS. I found another possibility to make video playing by using an swf embedded into an html page and displayed by StageWebView but this method has so much obstacles(FP security rules, ExternallInterface barriers) so it has no sense to implement it.

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.

Youtube iframe in jquery mobile + phonegap build

I'm using an iframe to embed a youtube video in an app for android/iOS developed using jQuery mobile and phonegap build.
Testing it on my browser works fine.
On my device (android) I see the video thumbnail, but when I click on it the screen goes black, I see the controls (play, forward and backward) and the video doesn't start.
On some other video I see the loading "circle" and after that the YT related videos.
I'm checking that the video is avaible for mobile
http://gdata.youtube.com/feeds/videos?alt=json&format=1,6&fields=entry[link/#rel='http://gdata.youtube.com/schemas/2007%23mobile']&max-result=10&category=Music&q="+mySong
Any help would be really appreciated.
This tutorial seems to work :
http://eisabainyo.net/weblog/2012/01/24/embed-a-youtube-video-iframe-in-phonegap-app/
Pay attention to this step:
Change/add the following values in PhoneGap.plist file of your app.
MediaPlaybackRequiresUserAction: NO
AllowInlineMediaPlayback: YES
OpenAllWhitelistURLsInWebView: YES
ExternalHosts
*.youtube.com
*.ytimg.com
The problem seemed to be related with the android version: on 4.0 the iframe/html5 version worked fine. The problem was on android 2.3.
I used a jqm plugin as a workaround in 2.3

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