Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to avoid session timeout in Android

In my Android application am showing live video streaming using LibVLC library. To connect SSH server i have used jsch library.

When i run application, after session connection video runs properly. and when i minimize the app for 3-4 minutes, and resume again still video runs properly. But when i minimize the application for 10 or more minutes and on resume it shows session timeout message.

OnResume() I tried to create session and createPlayer() but still not working .

I have tried by changing session connect time.

Is there is any way to avoid session timeout for long period like 30 minutes.

//** AFTER EDIT**//

I checked after onResume() session is still connected, and error log says Connection reset by peer.

What does that mean? Is ssh tunnel is closed? If yes, how to check ssh tunnel status?

Error log:

08-09 10:52:15.268 6529-21339/com.compdigitec.libvlcandroidsample E/VLC: live555 demux: Failed to connect with rtsp://localhost:8554/video.ts 08-09 10:52:15.268 6529-21339/com.compdigitec.libvlcandroidsample D/VLC: core demux: no access_demux modules matched 08-09 10:52:15.268 6529-21339/com.compdigitec.libvlcandroidsample D/VLC: core input: creating access 'rtsp' location='localhost:8554/video.ts', path='(null)' 08-09 10:52:15.268 6529-21339/com.compdigitec.libvlcandroidsample D/VLC: core access: looking for access module matching "rtsp": 15 candidates 08-09 10:52:15.268 6529-21339/com.compdigitec.libvlcandroidsample D/VLC: core access: net: connecting to localhost port 8554 08-09 10:52:15.278 6529-21339/com.compdigitec.libvlcandroidsample D/VLC: core access: connection succeeded (socket = 36) 08-09 10:52:35.823 6529-21339/com.compdigitec.libvlcandroidsample E/VLC: core access: read error: Connection reset by peer 08-09 10:52:35.823 6529-21339/com.compdigitec.libvlcandroidsample D/VLC: access_realrtsp access: rtsp connected 08-09 10:52:35.823 6529-21339/com.compdigitec.libvlcandroidsample W/VLC: access_realrtsp access: only real/helix rtsp servers supported for now 08-09 10:52:35.823 6529-21339/com.compdigitec.libvlcandroidsample D/VLC: core access: no access modules matched 08-09 10:52:35.823 6529-21339/com.compdigitec.libvlcandroidsample E/VLC: core input: open of rtsp://localhost:8554/video.ts' failed 08-09 10:52:35.823 6529-21339/com.compdigitec.libvlcandroidsample E/VLC: core input: Your input can't be opened 08-09 10:52:35.823 6529-21339/com.compdigitec.libvlcandroidsample E/VLC: core input: VLC is unable to open the MRL 'rtsp://localhost:8554/video.ts'

like image 205
User_1191 Avatar asked Aug 05 '16 10:08

User_1191


People also ask

How do I stop a session timing out?

To prevent a session timeout, you must interact with the workbook. This might include navigation around the workbook, sorting, filtering, or any other activity that you do with the elements of the workbook. When the server detects user interaction with the workbook, it keeps the session active.

What causes session timeout?

Session timeout represents the event occuring when a user does not perform any action on a web site during an interval (defined by a web server). The event, on the server side, changes the status of the user session to 'invalid' (ie.

What is session idle timeout?

The session inactivity timeout setting represents the amount of time a user can be inactive before the user's session times out and closes. It only affects user browser sessions. You can set the values from 5 minutes to 60 minutes. This function has a default value of 30 minutes.

What is the normal session timeout?

Typical session timeouts are 15- to 45-minute durations depending on the sensitivity of the data that may be exposed.


1 Answers

The demux error you are getting is happening at a higher level in the stack. You need to first validate that the underlying SSH connection is still good. To do so, check and if necessary reconnect when your application resumes:

public void onResume() {
    if (!session.isConnected()) {
        reconnect(); // needs to create a new session, open a channel, etc.
    }
}

Once you have validated the SSH connection, you should be able to resume the stream via LibVLC. If however you still see an error at that point, you'll have to show the code that you use to open / resume the stream.

like image 105
Ben Damer Avatar answered Oct 18 '22 21:10

Ben Damer