HTML5 game on Android - Audio and Video problems - android

I have searched high and low for several days for this problem and I just can't figure it out, hopefully someone else has solved this.
The problem is simple, I have created a web-based game using mainly createjs, preloadjs, and soundjs. The plan was to load the content inside a UIWebView on iOS and WebView on Android to create the two apps.
The problem occurs on Android 4.4 and lower. Neither the videos or the sounds are playing. I'm starting with the simplest scenario; I have an image on a web page, attached a preloaded sound to play onclick;
init:
createjs.Sound.registerSound("sounds/sound_must_be_on.mp3", "soundOn");
$('.btn.sound').click(soundMustBeOn);
onclick listener:
function soundMustBeOn() {
createjs.Sound.setMute(false);
createjs.Sound.setVolume(1);
createjs.Sound.play("soundOn");
}
This works perfect on all modern desktop browsers, iOS and Android 5.x and higher. But on Android 4.4 (on a WebView) it just crashes. What have I missed? I have tried Cordova, Phonegap, SoundJS CordovaAudioPlugin, file:// paths, resources outside the android_asset folder, and plenty of other things. My quess is that I have used Phonegap totally wrong, I could really use a "for dummies" example.

Solved it.
I did what I didn't want to do, but I guess it had to be done. I encapsulated my entire web application within Cordova/Phonegap, downloaded and added the CordovaAudioPlugin.js file from SoundJS and simply registered the plugin as others have already done (also updated the file path)
createjs.Sound.registerPlugins([createjs.CordovaAudioPlugin]);
createjs.Sound.registerSound("/android_asset/www/sounds/sound_must_be_on.mp3", "soundOn");

Related

Webrtc video call on android

I´ve set up a clone of this repo, and got it up and running at heroku:
https://github.com/dondido/webrtc-video-room
.. after trying about 15 others that I had various problems with. It works great under Windows in chrome and firefox, but when trying to access it with a webview on android in the app I´m developing (in B4A), I see only a grey screen. I do however manage to succesfully use https://appr.tc which is a very similar demo from google in the webview, so something should be amended in the android code. I think it relates to navigator.mediaDevices.getUserMedia, but I really don´t know what needs to be changed for this to function. I´ve been sitting and comparing the git repo for mentioned appr.tc but can´t nail the part that I have to amend. I am aware that I can just clone the appr.tc repo instead, but this one also needs GAE, which I want to avoid.
Any help?
Thanks!

Is it possible to power an android webview with FireFox for android opensource code?

I created an android webview for my website all was going fine only for me to notice that filechooser was not opening in android versions less than 5.0... After struggling for days, and trying so many things like solutions to SO questions 28600165 and 23568792 many other bunch of stuff online... nothing worked out(I bet you all of them are a waste of time). I later found it's a bug in older android versions and there's no real workaround like in this github issue No workaround for filechooser bug for 4.4.1 and 4.4.2 ... But I am able to upload files on all android versions using FireFox for android even Chrome... How come the HTML input type file works with FireFox webviews despite the bug in these particular versions of android... Is it possible for me to power my webviews with FireFox code since it's opensource if yes how easy is that and how effective will it be.... I will also appreciate guidelines on how to go about this, with an example if possible . thanks in advance.

How to upload multiple files on Android using the multiple property?

I got a,
<input type="file" multiple accept="image/*" />
and I want my android users to be able to upload multiple files at a time. Users using nexus-5 report being unable to upload multiple files at a time. I also tried adding capture="camera" to the input but this only auto open the camera and only associate one picture at a time again. This works everywhere except on Android.
Is there anything I am missing?
I've hit the same brick wall. I've tried a number of mobile browsers and can't find any that work.
I found this link that tells you that none of the Android browsers support this:
http://caniuse.com/#feat=input-file-multiple
From extensive searching, I've seen information that suggests that Chromium supports this (but no beta yet) and it should make it into Chrome for Android but no indication of time-frame.
This seems to have changed since my last answer. If you now look at:
http://caniuse.com/#feat=input-file-multiple
You'll now see that Chrome 42 (or better) for Android does now support multiple file upload provided you're running Android 5.0 or better. That's quite a limitation but at least it's an improvement. As Android 5 (Lollipop) gains market share (18.1% in August 2015) this become more practical.
Here's one trick. Hit your normal <input type='file' multiple> button. File picker appears: do a long press on a file to select it, then select other files.
On the top bar an "Open" appears, select it and then multiple files are added to the files collection.
Kudos to Simon#atp for this.
However, not all available file pickers may work.
As of 12/20/2017, the new Chrome browser is allowing multiple file selection. Just select your files and click "Open" in the upper right hand corner.
You could work around this limitation by using javascript, canvas and blobs.
See https://github.com/josefrichter/resize/blob/master/public/preprocess.js for some example code to get you started.
I have a similar problem. And I tested the latest chrome and FireFox, both not working.
But the QQ browser which is using X5 core is seems to be the only browser works as I expected. So My solution would be using a App shell to encapsulate the X5 SDK.
I found a solution from GoNative(https://gonative.io/) link. As per our requirement we have to check and enter our URL. And they will send Android code link and DEMO apk over mail. In this file using we can upload multiple files in our web view. If we have to publish the app we have to purchase that thing. I tried to understand the multi file upload code. But couldn't find any thing help full. If any one crack that thing please tell us.

Is There Any Way to Get a File Select To Work in Webview on Android 4.4?

I hope someone can answer this because I have searched everywhere. As we all know, Android 4.4's Chromium Webview does not support the FileChooser API as previous versions had. With that said, how can I make an input with type="file" open the file selector in webview and have it work on 4.4 as well as earlier versions? My apps absolutely hinge on users being able to upload photos to their profiles.
Thank you.
Only a complex native solution or apply pressure on Google by posting on this bug:
https://code.google.com/p/android/issues/detail?id=62220
Cordova has a plugin which you might use as a basis for a solution - https://github.com/cdibened/filechooser. This retrieves the filename which you could then feed to a file uploader.

Link to and play mp4 video in phonegap app on android

Im starting to loose my mind her.
Im building a VERY simple app.
All it needs to do, is show some information, an play some videos.
Everything works just great on iOS. I simply link to the video like this <span></span><img src="img/vidImg_afbryder.png" />, and it starts playing.
But on Android, its a totally deferent story. When i straigt-up link to the video like the ios version, nothing happens.
When i use this https://github.com/macdonst/VideoPlayer, and my link looks like this
<span></span><img src="img/vidImg_afbryder.png" />, nothing happens.
All the videos ar contained locally in the app, as it needs to work offline.
Im building the app with HTML/CSS/JS in webstorm and then compiling it on build.phonegap.com/
Im not using x-code or anythin, just stright-up HTML/CSS/JS. i do have the config.xml file
Ive tried searching like a mad man, but still no luck. Can someone help me, or point me in the right direction.
P.S. This is my first app, and therefor my first encounter with phonegap.
If you use any one plugin, you have to use a specific one for Android and one for iOS. After this, you need to compile using xcode or eclipse, for example. To use the plugin you mentioned, have a look on http://www.adobe.com/devnet/html5/articles/getting-started-with-phonegap-in-eclipse-for-android.html

Categories

Resources