My LogCat contains the following line multiple times:
08-01 09:15:03.101: ERROR/AudioPolicyManagerBase(95): unknown stream type
Is this an actual error in my app or something to ignore?
Are you using AndEngine or any 2d-3d engine? If so, there's the answer. They usually internally set the audio stream as STREAM_MUSIC.
If you are using a Media object, are you releasing it?
Are you streaming any audio extension that the standard Android music player cannot play?
Anyway put some code and tell us what your application is intended to do so we can provide a better answer :)
Related
I want to build an android app that records a voice and play reversed version of that.
I searched everywhere and there is these links:
First: that describes without any code that makes me confusing!
Second: with no answers until now!
Third: is a working code for swift
Forth: a working way in java. Not android!
Fifth: I'm not sure it is thr solution.
Sixth: I compiled it and changed it but it stops suddenly in recording.
Seventh: For swift there is AVFoundation.
Eighth: Not working.
Help me!!
You must record audio as raw with AudioRecord instead of MediaRecorder which uses encoder to compress and change the output. When you recorded PCM file, you can add 44Byte Header to it, to be converted to Wav format and be playable in devices.
If you want reverse it, should use a loop to read Bytes of it (if use PCM16 must use 2Byte) and after that add header and play it.
Good Luck.
I am trying to reproduce MPEG DASH, HLS and HSS(HTTP SmoothStreaming) streams by using modified sample applications provided by Google, but for now, only DASH is working.
I use:
https://github.com/googlecast/cast-custom-receiver
and
https://github.com/googlecast/CastVideos-android
As i see here https://developers.google.com/cast/docs/player?hl=en all protocols (HSS, HLS, DASH) should work without problems.
When i try to stream HSS and HLS i get this in Sample Media Receiver HUD:
Media Element State: "Error" (or "Abort")
.
.
.
Host State: "Fatal Error: code = 1"
Does anyone know what that error represents?
Also, sometimes i get this "Fatal Error: code = 0".
//UPDATE
I get this error when i try to cast HSS:
[2648.568s] [cast.receiver.MediaManager] Load metadata error cast_receiver.js:19
and the link is :
http://video3.smoothhd.com/ondemand/Turner_Sports_PGA.ism/Manifest
//UPDATE
HLS is working now. Problem is solved by setting CORS headers.
I don't know what HSS is and we don't mention HSS as a supported protocol either, nor we claim we support "all" protocols. We have listed the supported protocols/variations in the link that you have mentioned.
Problem was with codecs... I used streams encoded with VP1 video and WMAP audio codecs, so there were many errors. That is the reason for getting all those LOAD METADATA ERRORs.
And for CORS, you can use this: https://github.com/TOMODOcom/TOMODOkorz
Works like a charm :)
I play an mp3 file from url with android MediaPlayer class.
(everything works fine)
I want to amplify the sound, make it sound louder.
I don't mean just raise the device volume but to actually amplify the sound.
even in cost of loosing some quality.
(I want it to be done in code and not with 3rd party software) maybe with some kind of java library.
MediaPlayer doesn't have a out-of-the-box method for this. Doing what you try to do really goes in the direction of audio-manipulation. This means, that you should get the byte stream and modify it for your needs. E.g. read the MP3 specification and try to rise the amplitude.
A better approach would be to edit your current mp3 files with a professional desktop editing program and play the files just the usual way.
As per my understanding, this may not be directly allowed in MediaPlayer and you may need some mp3- manipulation algorithm or library to do this. I am looking into this, but you can use the following as a starting point:
Audio Effect
Looks like you're not supposed to directly use, that but one of its subclasses:
Equalizer
Virtualizer
BassBoost
PresetVerb
EnvironmentalReverb
Maybe it will help you, but I'm not exactly sure how to implement it. Will look into it.
I am working on an Android application which is supposed to play videos over HTTP on Android devices. Before we setup a server to host the video files just wanted a few things clarified:
As per the developer documentation, Android supports .mp4 and .3gp container formats for video. If we use H.263(video) - AAC LC (Audio) audio-video codec used for our media files will we be able to play the video by passing the URL to MediaPlayer class?
I did a little experiment and passed URL of one of the video files(.mp4) to the MediaPlayer class and got the following error:
Command PLAYER_INIT completed with an
error or info
PVMFErrContentInvalidForProgressivePlayback
From the docs, I came to know that for progressive playback, the video's index (e.g moov atom) should be at the start of the file.
Questions:
1. How do we make our videos Android-ready?
2. What are the different considerations that we need to make?
Please help.
Thanks.
You can actually achieve this using a pure Java implementation of ISO BMF ( MP4 ) container used JCodec ( http://jcodec.org ). For this use the following code:
MovieBox movie = MP4Util.createRefMovie(new File("bad.mp4"));
new Flattern().flattern(movie, new File("good.mp4"));
The side effect of 'Flattern' is creating a web optimized movie file that has it's header BEFORE the data.
You can also use similar functionality from command line:
java -cp jcodec-0.1.3-uberjar.jar org.jcodec.movtool.WebOptimize <movie>
The JCodec library can be downloaded from a project website.
I cross posted this question on Android-developers google group. Mark answered it there. Thanks Mark!
See this thread
Strangely I find no support for Midi in Android.
The only thing that comes close is the Jetplayer, but this only takes a existing .jet file.
I want to dynamically generate a midi file with some intervals and play it.
I even thought about just manually creating a .jet file with a tone and then transposing it with the jet player, but it limits the transposing to -12, +12. Which is not so good for me.
There also is a ToneGenerator on Android, but it's limited to predefined tones with no way to transpose.
Does someone know how to achieve midi generation and playback on Android?
Perhaps this Pragmatic Programmer thread might be of interest.
I currently settled for the dynamic generation of midi files that then are fed to the MediaPlayer. It's quite easy to build a simple midi file generator and the MediaPlayer works correctly with it.
I do have opened a feature request for direct streaming access to the synthesizer. If you are interested in streaming midi, please rate, star, comment there.
Better late than never, but there's a bare-bones Java MIDI library on Google Code here: http://code.google.com/p/android-midi-lib/
That can handle MIDI file generation and you can use MediaPlayer to play it back supposedly.