HTML5 audio blob would not play on Android - android

I'm serving an audio file (WAV file that contains a short uncompressed PCM) from my GAE app using BlobStore.
On a click event, I set audio.src and call audio.play().
Now here is the weird part:
When working locally - it plays well on both IOS and Android.
After deploying to GAE, it plays well on IOS - but not on Android!
No error is shown - it just plays nothing.
As far as I can tell from GAE logs, the audio file is served in all cases.
In case of Android I can see a requests from "Player/LG Player 1.0 for Android 4.4.2 (stagefright alternative)".
Any idea what's going on, or how to debug this?
Update
Tried playing files from Google Cloud Storage, according to Stuart Langley's suggestion.
In that case, Android plays well, and IOS doesn't (intermittently. Sometimes gives an error).
So a workaround that works for me is storing the file on Cloud Storage, and also calling createGsBlobKey in order to serve it as a blob.
On the client side I check whether it's Android (navigator.userAgent.match(/Android/i)). In case of Android I set audio.src to the Cloud Storage file, and in case of IOS I set it to my servlet which serves the file using BlobstoreService.serve with the blob key I got from createGsBlobKey.
This is a cumbersome workaround and I didn't check other mobile OSs to see what works for each, so if anyone has a better solution please let me know.

Most likely this is due to the chunked response when serving a blob.
Here is an issue tracker item about audio files not playing correctly in some browsers.
Here is a test web site I put together while back that illustrates the problem.
As for workarounds - You can put the file on cloud storage and then play it from there, as long as you're not concerned about people hotlinking the file.

Related

Unknown android app using my mp3 files without my permission

I have found an app on play store using my absolute path of mp3 files to his/her app to stream my mp3 files. I think he/she created a script which crawling my website and getting mp3 files with title of the songs or albums and then creating his/her database and then creating a web service which generates json. So he/she can use it in app. I have tried to prevent hotlinking of mp3 files from my .htaccess from my server but i think this trick is only working for websites not working for android applications. Please tell me how to stop mp3 files from third parties android apps or any other platforms except my own app. I have my own app on android so i don't need to stop that too. Thanks
Waiting for solution from experts :)
tahir issue is very simple. when some one wants to access your mp3 file ask app secret key in web service call . for sure now you will authenticate service no spams calls

stream video on device bytewise to videoview - Android

I want to play encrypted video files present on my device after decrypting them. I want to pre-process the data-stream and parallel play it using videoview like streaming video from Internet.
Is there any way I could buffer the processed data to videoview like a network stream ?
I think you are saying that you want to decrypt the video in one process and then pass the decrypted 'clear stream' video to another process to play it?
If the video is DRM protected, then your use case is very unlikely to be supported by any of the leading DRM solutions - they go to great lengths to ensure the clear stream video is not accessible by an application on the device (for obvious reasons).
If you are using or a simple encryption with the encryption key available to your application then you should be able to do this.
Update
Answering BMvit's question in the comment - one way is to follow these steps:
Stream the encrypted file from the server as usual, 'chunk by chunk'
On your Android device, read from the stream and decrypt each chunk as it is received
Using a localhost http server on your Android device, now 'serve' the decrypted chunks to the MediaPlayer (the media player should be set up to use a URL pointing at your localhost http server)
I am guessing this is the most likely the approach that the libMedia library uses, although I have never seen the source so I could not say for sure: http://libeasy.alwaysdata.net
It is worth being aware that this is tricky (which is probably why LibMedia is not free).

Choose which audio file format to use between Android and IOS?

In my app,I want to make sure user can record his sound and sent to other user to listen to it.
In android platform I choose .amr ,it's not too big and easy to record.
Then I realized I should make sure my ios user can chat with my android user,but .amr seems not support in ios(after v4.3).
So is there a certain audio file format that can use between android and ios platform?
Or I have to let my Server to do the Transcoding job?
Both android and iOS should be able to handle mp3 files.
You can encode to mp3 on the device using various open source projects (could be a combination of steps).
I would personally go for a server-side encoding/conversion, because too many things can go wrong (especially on all the various Android versions and devices)
At last we use amr. Ios client do the decode job.

Phonegap Android App - Display Store MP3 Media

I've been following this blog to help me make a simple music player function with an Android app (http://simonmacdonald.blogspot.com/2011/05/using-media-class-in-phonegap.html).
All works well - but I would like some way to extract a list of all music media stored on the phone so the user can click a file and play it. Does anyone know if this is possible via phone gap? I'd need to access track name/artist etc and a link to the track.
Cheers
Paul
Prognosis is not good.... PhoneGap does not have an API for accessing the media library. So, you would have to fall back to the File API to locate music files, and then... you would have to read the binary data in the actual files to extract out the track/artist metadata. Ouch. Seems pretty impractical.
[EDIT]
By the way, PhoneGap is not the only game in town. Appcelerator seems to solve the same problem, and apparently has a richer API, which includes
access to media metadata

How to play local video files in a browser

Am looking for the way to play video inside my android browser locally. There may be two or more video's in a local page (like facebook contains video's).
Can anyone please help me out..
Without actually reading about the specifics of the Android built in browser I would safely say, you can't. Well, if you run a local html file it might work, but if you intend to have an external page from which you can play local videos it shouldn't work. I say shouldn't because in the early days of browsers some of them actually did give you access to the local file system. Javascript for example could use file://, something I used myself for image previewing before upload. But this was a major security concern and all modern browsers prevent this.
The difference is if you run a local file or a file on your own local web server. Since then, your local file system is actually part of the web servers file system and the web server can serve your local files.

Categories

Resources