I am working on playing a video in my application, and I am observing some strange results in doing so. Videos that I am trying to play are on server and I have to get them to run android's native videoplayer.
I have tested the results on several devices and it is found that video runs on devices having OS version greater than equal ton 2.3.3 but does not run on others, showing error (1, -1). Now my question is that either the later OS versions have some extra Video codecs and format support and that is because the video gets played on them or it's something else? Why so is this error on few devices not on all?
Devices on which Video Works fine in native videopalyer:
Samsung Google Nexus with OS 4.0.1
Samsung Galaxy S with OS 2.3.3
Devices on which does not get played:
HTC-Desire with OS 2.2
Samsung Galaxy S with OS 2.2
Any help about the issue is always appreciated.
This error may occur due to many reasons. Issue might lie videoplayer, as well source from where you are reading the video, Is video coming from HTTp server or RSTP server...any of these can be the reason. You'll have to check accordingly. In our case, we solved it by using Video View and also made changes to URL to get it played.
Related
I am recording audio for voice messages in the app using the following code.
MediaRecorder audioRecorder = new MediaRecorder();
audioRecorder.setAudioSource(MediaRecorder.AudioSource.VOICE_COMMUNICATION);
audioRecorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
audioRecorder.setAudioEncoder(MediaRecorder.AudioEncoder.HE_AAC);
audioRecorder.setOutputFile(audioRecordingFile);
audioRecorder.prepare();
audioRecorder.start();
Use of MediaRecorder.AudioSource.VOICE_COMMUNICATION instead of MediaRecorder.AudioSource.MIC) is very helpful in recording pre-processed clean audios.
But, recently I found some issues in which the recorded files are empty are being reported on a few devices which were recently updated to Android 10. It should be noted that not all Android 10 devices have these issues, only a few i.e Nokia 6.1 and Mi A2.
There is no error or exception but just empty audio output files.
If I use MediaRecorder.AudioSource.MIC) then the issue is not seen.
I found the following information related to Android 10 and VOICE_COMMUNICATION
The Android 10 release includes the following requirements for capture with VOICE_COMMUNICATION.
Based on this I checked the availability of AcousticEchoCanceler,AutomaticGainControl and NoiseSuppressor using the following code.
AcousticEchoCanceler.isAvailable()
AutomaticGainControl.isAvailable()
NoiseSuppressor.isAvailable()
And found the same result on Mi A2 and OnePlus 6 with Android 10. Both of the devices show AcousticEchoCanceler and NoiseSuppressor as available and AutomaticGainControl as not available.
Since the issue is not present on all Android devices, I don`t want to fall back on using MediaRecorder.AudioSource.MIC). At the same time, there is no error, exception or differentiating factor which tells me when to fall back on MediaRecorder.AudioSource.MIC).
UPDATE: The issue gets resolved when Google Assistant is turned off on Mi A2.
This might be the pointer : https://developer.android.com/guide/topics/media/sharing-audio-input
Any help regarding this is appreciated.
I ended up using MediaRecorder.AudioSource.VOICE_RECOGNITION instead of MediaRecorder.AudioSource.VOICE_COMMUNICATION on all android versions.
We ended up taking samples on 15+ different devices and found out that MediaRecorder.AudioSource.VOICE_RECOGNITION works best with the majority devices including high-end and mid-range phones.
As per my understanding, the original issue faced on few devices on some devices seems like implementation issues by the OEMs with respect to Android 10 and VOICE_COMMUNICATION https://source.android.com/devices/audio/implement-pre-processing
I have a videoview that displays content from the web.
When I play on the nexus 7 with Android 4.2 it works fine, but when I play it on the GS3 ir return an error 1004 IO Error.
Does anyone has any idea why is this happening?
If you need the code I will post it here.
Thanks
I had the same issue. I was trying to stream an Audio and play it in my application and I had the same error only on Samsung devices. I think they have modified the Android Media Player core and that caused some problem.
What I did for a solution is, I'm checking if the manufacturer of the device is Samsung and pop a dialog window saying that your device does not support streaming. And I download the audio and then play downloaded audio.
I needed an urgent solution and couldn't find a better solution.
Hope it helps.
I want to use OpenTok API for android.
I found example on github. and causes some exceptions like.
1.my video is not publishing.
2.I receive the stream but unable to get view.
3.pulisher.create(); cause exception.
Is this is only for jellybean os. how to implement it for lower version.
I am using it on my nexus s jellybean updated.
Any help will be thankful.
Here is OpenTok's Android repository. According to their readme, The supported devices are:
Nexus 4
Nexus 7
Nexus 10
Galaxy S3
Requirements for OS is Jelly Bean and up.
Live video streaming is CPU intensive, and lower end devices do not have the CPU capacity to handle multiple video processing for the streams in the session and not able to run OpenTok's SDK.
I'm using the Mediaplayer (android.media.MediaPlayer) to play mp3-files in an app I'm developing
It works flawlessly in emulators from and above android 2.3. I've also tried it on two devices (2.3 and 3.2) and it works great.
However, in an emulator with 2.1 the audio crackles.
And in an emulator with 2.2 the audio is chopped off before it's finished (plays everything but the last half or whole second).
Is this a know problem for 2.1 and 2.2? And does it only affect the emulator but not the actual devices (which I've not had a chance to test on)?
Most probably it is happening because that the codecs which the older emulator is using in your case is not decrompressing the audio fast enough (understandable, as it is an emulator). I have worked with MediaPlayer from 2.1,2.2 and learnt that it is best not to rely on an emulator's performance. Go for a real device.
is there anyway to update the media drivers separately from the rest of the OS?
I updated my X10 Mini Pro from 1.6 to 2.1 and the media player doesn't play any sound. BUT you can see the time counter running fast forward... This is really crazy! The same with video player, even youtube. You can see the videos in Fast Fwd, no sound whatsoever.
Any ideas? Thanks a lot!
I am using the code available here VideoView Example. This code runs properly on Android emulator 1.6 but not on 2.1.
In 2.1 it only plays the audio and not video. I have gone through several other threads where this issue has been mentioned. I will like to know whether this problem is limited to emulator only or the devices also have the same problem.
Regards
Sunil
Emulators will have great difficulty playing back video, due to speed. The emulator does not have hardware acceleration -- combine that with converting ARM opcodes to x86 on the fly, and the emulator cannot keep up. I have a quad-core 2.6GHz desktop, and I can only occasionally get the emulator to play back video.
IMHO, to work with video, you need a device.
Try it in real android device,because emulator can not play video