VLC on Android streaming - android

I am using Wowza stream content to an Android device using VLC.
When the connection between the Android device running VLC is lost, the screen freezes as expected, and the video is restored with the connection is restored. However, the second time the connection is lost, VLC stops the stream, and I would need to select the stream path for it to begin playing again.
I set the cache to 25 seconds, but see nothing on number of attempts, or time to wait before giving up on the stream. The ideal behaviour is to always wait until the connection is resorted without intervention, even if the time between attempts grows the longer the network connection is lost.
Where can I set VLC on android to always wait for a stream, and never give up?

This is a known issue .you experience a deadlock in libvlc. that happens when you try to play and stop nearly simultaneously or something like that. the problem is that the input thread does not finish.this is due to race
conditions after calls to vlc_object_alive().
this patch can help you :
https://github.com/rom1v/vlc-udp-deadlock/

Related

Why does Android Bluetooth stop receiving bytes after a few minutes?

I'm having trouble maintaining a Bluetooth connection (from Android to a device I'm developing) for longer than a few minutes.
The scenario is:
Device is paired successfully.
Device transmits to Android for somewhere between 1-7 minutes (varies by device or possibly Android version).
Android stops receiving bytes although device is still transmitting.
So: why does Android BT stop receiving?
This is very similar to the issue/observation described in bboydflo's answer to this question:
Application using bluetooth SPP profile not working after update from Android 4.2 to Android 4.3
Some more background:
The BT device I'm working with continually emits measurement packets containing ~200 characters, once per second. I am certain that the device-side is still transmitting when the issue occurs.
This sympom happens in my app on two Android devices: an Android 5.0.1 Acer tablet, and an Android 7.1.1 Moto Play X
I've tested with an app called Serial Bluetooth Terminal. This app does not experience the same issue; the connection is stable for as long as I've tested. Therefore, this issue is probably caused by something in my application code.
I've seen various responses to Android BT questions directing the user to use asynchronous streams rather than polling for received bytes. This seems to be a red herring; if you feel that the threading model is causing a probelm in this case, please clearly describe why switching to async would resolve this issue.
I would like to pre-emptively address reasons that this question may be closed:
This is not a duplicate. There are other questions on SO about BT connections dropping (i.e. Real-time Bluetooth SPP data streaming on Android only works for 5 seconds) but this is not the same issue. I have already added a keep-alive outgoing char transmitted every 1s, and my issue remains.
I'm not asking about an issue specific to my application; at least one other user on SO has encountered this problem.
I've reviewed the Android Bluetooth documentation in detail, and I can't see any obvious reason for this to happen.
I'm not asking for an opinion; I'm asking for an objective answer as to why the bytes stop being received.
Ok, I have a partial answer for this one. First, a bit more background:
I was running the BT stream polling on a thread which executed a runnable every 2s
The buffer being used to read the stream was 1024 elements long
I had a suspicious that this might be some background buffer running out of space. So, I changed the 2s to 500ms and the 1024-length to 10024. Now, I've had about 20 minutes of connectivity without any trouble (and still going).
It would be nice to find the smoking gun for this. I initially thought that stream.Available() would be sufficient to tell if a buffer was getting filled up, but in this scenario, stream.Available() is actually returning 0 when the Android device stops receiving. So I'm not really sure which queue to check to prove that this issue is related to a buffer becoming filled.

Using developer voice commands result in a network timeout error and hangs voice control

Since last Tuesday our project team have had some issues with the google glass device. We are working on an app that is using custom developer voice commands to launch and navigate through contextual voice menus within the app.
Our app has worked fine before, but now all of the sudden, developer commands won't work anymore. We have followed all instructions on how to setup the AndroidManifest.xml correctly for glass, and also how voice menu items should use the strings.xml. What's also interesting to note is that the problem seem to be unrelated to our app in particular. None of the apps we have tested so far with custom voice commands work.
The voice control hanging issue seems to be related to an inability for the device to connect to a remote (google?) server. Whenever we are connected through a wifi network and start our app, any voice menu with custom voice strings seem to hang. After about 30 seconds we see that logcat is printing the following: 824-1002/? I/ProtoRequestDispatcher﹕ Request failed due to network error [message=Read timed out].After the timeout it sometimes tries to connect again to receive the very same error, or it goes back to the "ok, glass" menu. Sometimes (but not always) the voice control hangs without returning or trying to reconnect. Our last resort in this case have been to restart the device.
When we are not connected to any network we receive no timeout and the voice control doesn't hang. Any custom voice commands don't work here however. Pre-built voice commands that are present on the device work offline.
Another note is that some of the in-built voice commands won't work either, such as "Plus One" and "Dismiss Event". Like custom developer commands whenever we try to use these it gets stuck trying to connect to the remote server and timeouts. Without a network connection, these don't work either. A guess is that these also need to be downloaded once.
We have tried a variety of apps with custom voice commands. We have also tried to reset the glass device to factory settings, and created a new google profile. Switching to other wifi networks have so far not helped either.
Is there anyone else that have received this server timeout issue or that have any ideas of a solution to the problem? We're aware that developer commands require a network connection the first time they're used in order to receive a some sort of template to use when decoding it upon speech. We seem to get stuck before this stage though, and are very unsure how to proceed.

How to keep WIFI alive while application is streaming audio in the background in Android?

I have a streaming audio application on Android which uses AudioTrack and track.write().
After somewhile, audio was stoppping. I couldn't find the problem. After that, I saw that Admob also receives an exception:
java.net.ConnectException: failed to connect to googleads.g.doubleclick.net:.. connect failed: EHOSTUNREACH (No route to host)
After seeing this line in the logs, I thought that there is an instability related to device's wi-fi connection. (I use Galaxy S3 4.1.2)
Since I use the same connection on my desktop, I can say that internet has no problems (i can stream the same audio on desktop).
This does not occur in the same time period. It happens randomly between 10 secs to 10 minutes.
What can be the reason and can I prevent this by telling operating system to not close the connection? (I am already using it in a Foreground process)
Updates:
I tried the following lock but the problem continues.
private static WifiLock wifiLock = ((WifiManager) AppMain.getInstance().getSystemService(Context.WIFI_SERVICE))
.createWifiLock(WifiManager.WIFI_MODE_FULL_HIGH_PERF, "plywilock");
I set this inside my MyPlayerInSameProcessService where I release it onDestroy() of service. Code gets audio data c++ with jni and feeds AudioTrack at java side.
If I disable Wi-Fi, it workds perfectly and smoothly without any interruption on 3G.
In the same Wi-Fi network, if I use another application with the same url I use in my application, that application works smoothly. So, probably it's me, not the Wi-Fi quality.

Is it possible to share audio input (Microphone) stream in Android?

I am writing an application that runs as a background service recording and analyzing audio recorded from the microphone. When my app is running I can't use other apps that use the microphone (e.g. phone, voice recording, etc...).
My question is - Is there a way to share the microphone stream in Android? Maybe by using the NDK? If not, is it possible to receive an indication (e.g. a BroadcastIntent) that another app is requiring the microphone?
Simple Answer would be "NO" , This is just because Audio Recording Method is synchronized. So Two or more resources can not attempt it simantenously. Doing so might sometime force close the applicatio.
I know this is old, but you may be able to kill/reactivate the microphone connection every few minutes to simulate a shared microphone resource. This is an untested hack...
Essentially:
Set a timer to disconnect from the mic every few minutes
  Hopefully, if another app is trying to collect mic data, it can
  while blocking other apps from collecting at the same time
Attempt to reconnect and test for data
  if the other app has the mic and is blocking data then you can
  try to reconnect at some time in the future.
I haven't tested this but I need a solution too so I'll post code if it works.
Recording audio/video, while other applications are running , is possible. I've done it in Sony Xperia Z1, continuously recorded videos and calls with a downloaded screen recorder. However, I do believe that this was a glitch of some sort, as it stopped being able to record after some time (about 2 months)and started showing an error which says that the microphone is being used by another application...
Yes, with Android 10 you can.
Before Android 10 the input audio stream could only be captured by one app at a time

Android phone shutting off while using mediarecorder and cannot get logs

Im using the media recorder in a service. The media recorder will work fine for short calls, but when the call is about 5 min the phone will shut off and restart itself. Im not sure how to get the logs because i cant test the media recorder in the emulator and also whenever im debugging with usb connected to the phone it wont shut off. It only shuts off when its completely disconnected.
Ive tried to get the logs but when the phone shuts off the only logs i can receive when it comes back on is the logs for the phone starting up. Can anyone offer any insight or assistance in either getting the logs or even sharing any similar experiences or fixes with the media recorder.
Also I have an LG Optimus T with 2.2
you can try using an app called "alogcat" and set it to record logs every few seconds to an SDcard.

Categories

Resources