No sound on Android when streaming audio in AIR - android

I'm working on an app to stream audio from shoutcast. The streaming goes well on my computer and when debugging it with an Android-configuration.
But when I deploy it to an APK-file and run it on a Samsung Galaxy S, the streaming doesn't work.
My code for streaming the audio:
var urlRequest:URLRequest = new URLRequest("http://.../;");
var soundContext:SoundLoaderContext = new SoundLoaderContext(2000, true);
soundChannel = new SoundChannel();
sound = new Sound(urlRequest, soundContext);
soundChannel = sound.play();
I've also tried an addEventListener(Event.COMPLETE), it seems my app doesn't get there when running on a Samsung Galaxy.

Pls check internet enabled descripted files.
http://help.adobe.com/en_US/air/build/WSfffb011ac560372f-5d0f4f25128cc9cd0cb-7ffc.html
Reffer Also
http://cookbooks.adobe.com/post_Playing_mp3_files_on_Flex_Mobile-19106.html

Related

AudioPlaybackCaptureConfiguration not working in Android BOX (Using HDMI)

I am using google Audio Playback Capture API in ANDROID API Level 29 and its working fine on Android mobile devices i get easily internal audio from the devices but when i test it on the Android TV Box , Basically this app is TV box app where i have to capture internal audio. My Android TV Box connected with HDMI cable but i didn't receive any sound i am using Attributes : USAGE_MEDIA,USAGE_UNKNOWN and USAGE_GAME
they are all working fine in mobile app but not when i run on Android Box. I have done everything from my side now i just need help regarding getting audio from HDMI.
Thanks
val config = AudioPlaybackCaptureConfiguration.Builder(AudioCaptureService.mediaProjection!!)
.addMatchingUsage(AudioAttributes.USAGE_MEDIA)
.addMatchingUsage(AudioAttributes.USAGE_UNKNOWN)
.addMatchingUsage(AudioAttributes.USAGE_GAME)
.build()
val audioFormat = AudioFormat.Builder()
.setEncoding(AudioFormat.ENCODING_PCM_16BIT)
.setSampleRate(buffer.sampleRate)
.setChannelMask(AudioFormat.CHANNEL_IN_MONO)
.build()
val record = AudioRecord.Builder()
.setAudioFormat(audioFormat)
.setAudioPlaybackCaptureConfig(config)
.setBufferSizeInBytes(buffer.size)
.build()

AudioContext audio stuttering in Android Chrome

I'm using AudioContext in an ionic app to stream raw PCM audio data to a backend, the resulting audio is has a lot of stutters if the client is google chrome on android. All other android browsers work fine (tried firefox, edge and samsung browser) also all desktop browsers work fine including google chrome.
startRecording() {
navigator.mediaDevices
.getUserMedia({
audio: {
echoCancellation: true,
},
})
.then((s) => {
this.stream = s;
this.record();
this.startRecordingStream(this.stream);
});
startRecordingStream(s) {
let audioContext = new AudioContext();
this.scriptProcessor = audioContext.createScriptProcessor(2048, 2, 1);
let input = audioContext.createMediaStreamSource(s);
input.connect(this.scriptProcessor);
this.scriptProcessor.connect(audioContext.destination);
this.scriptProcessor.addEventListener("audioprocess", this.streamAudioData);
}
I tried logging the buffer on the client side, it has zeros scattered all over it in a periodic manner.
I have also tested this example https://mozdevs.github.io/MediaRecorder-examples/filter-and-record-live-audio.html on my device, it uses audioContext and it seems to suffer from the same audio stutter on google chrome on android.
Is there any walkarounds to this?

Audio Stream Input blocks get dropped?

I'm trying to send audio through AudioStream from android device to Vlc media player, Vlc catches audio stream but drops all the blocks.
Follwing is a block of code. Is there a problem with codec?Vlc Screenshot
AudioManager audiomanager =(AudioManager) getSystemService(Context.AUDIO_SERVICE);
audiomanager.setMode(AudioManager.MODE_IN_COMMUNICATION);
audioGroup = new AudioGroup();
audioGroup.setMode(AudioGroup.MODE_NORMAL);
localip= getLocalAddress().toString();
audioStream = new AudioStream(getLocalAddress());
locolport.append(String.valueOf(audioStream.getLocalPort()));
audioStream.setCodec(AudioCodec.PCMU);
audioStream.setMode(RtpStream.MODE_NORMAL);
audioStream.associate(remoteIP, 22222);
audioStream.join(audioGroup);
Actually the problem was with permissions of android device, I was requiring permissions in manifest file but in android version Marshmallow or higher I had to request permissions on run time at least once(if granted).

Some time silent recording with Audio Record

I am using Audio Record to record voice using android phone. It is working most of the time but some time on my moto g phone it records silent data. When I replay it I do not hear any thing. When I checked the
audio file it was there in the storage I played using media play from pc it was playing with out any voice .
my code:
int mSampleRate = 8000;
int mBufferSize = AudioRecord.getMinBufferSize(mSampleRate,AudioFormat.CHANNEL_CONFIGURATION_MONO,AudioFormat.ENCODING_PCM_16BIT);
byte bData[] = new byte[mBufferSize];
ByteArrayOutputStream encodedStream = new ByteArrayOutputStream( );
while (mIsRecording) {
mRecorder.read(bData, 0, mBufferSize);
encode(bData,encodedStream);
}
Any help will be highly appreciated
Thanks for the help guys . Its was my mistake. I was using the audio recorder through JNI too and I was not releasing the audio record that's why whenever I tried to use audio record from java (Android SDK) it was not capturing any voice . Hope this will help to some one else .

Streaming m3u8 HLS Audio on Android

i've found problems trying to reproduce m3u8 HLS audio streaming on Android. Right now i can reproduce video in m3u8 HLS link with:
Intent i = new Intent(Intent.ACTION_VIEW);
i.setDataAndType(Uri.parse(contentURL),"video/mp4");
startActivityForResult(i,0)
I've already tried this method:
number 1:
Intent i = new Intent(Intent.ACTION_VIEW);
i.setDataAndType(Uri.parse(contentURL),"video/mp4");
startActivityForResult(i,0)
number 2:
Intent i = new Intent(Intent.ACTION_VIEW);
i.setDataAndType(Uri.parse(contentURL),"audio/mp3");
startActivityForResult(i,0)
number 3:
MediaPlayer mediaPlayer = MediaPlayer.create(this, Uri.parse("http:\\testexample.m3u8"));
mediaPlayer.start();
In case 3 the error on log like "mediaserver Died", in case 1 and 2 simply the phone gallery said "can't reproduce video" or "can't reproduce this kind of file".
Last but not the least, if i send the http m3u8 link with an email at a Nexus 4 with Android 4.3, it open the link with chrome, then ask to open phone galleryplayer, and reproduce it. The same thing done with da SII with cyanogenmod and android 4.2.1 said, as before, "cannot reproduce video".
Put your code In try-catch block.
Set onPreparedListenet() and prepareAsync(), then on the onPrepared() callback start playback.

Categories

Resources