Unexpected disconnect event log4j

Hello,

I have the log4j system linked to a database, as you may know log4j records all events.

I am using wowza 3.6 VOD

When a user starts a video i get a record in the database with the connect and play event.

If a user stops or pauses the video i will get a stop/disconnect event.

The problem is when a user plays a video of a extended period of time (5min sometimes) i get a disconnect event even when the user is still playing the video.

I expect that i get the disconnect event when the user pauses or stops the video.

Does anyone have a solution to this?

Could it be that the user buffers the video so much that wowza thinks the user timeout-ed and sends a disconnect?

Sounds like RTMP playback. If a user is watching a video, the RTMP session has not disconnected yet. I would try some isolated tests. I suggest you take the database logging part out of it. Instead run Wowza in stand-alone (/bin/startup.bat) if you want to see logging in real-time.

Richard

I think I understand what you are seeing: with HLS streams to iOS devices there can be multiple sessions server-side for what is one playback session from the user’s point of view. If you need to tie them together for accounting purposes you can use this technique

Richard

Accounting for HLS and other HTTP stream types is not as fine as RTMP. A system like yours will have to work with what is available. The player is in control when it comes to creating these sessions, not Wowza. You might be able to use onHTTPSessionCreate and onHTTPSessionDestroy in some way to further manage sessions.

Richard

Sounds like RTMP playback. If a user is watching a video, the RTMP session has not disconnected yet. I would try some isolated tests. I suggest you take the database logging part out of it. Instead run Wowza in stand-alone (/bin/startup.bat) if you want to see logging in real-time.

Richard

Hello rrlanham,

We are using the m3u8 playlist.

We use the database (external) to limit the maximum amount of watchable videos at the same time for a single user in our application.

(a user is allowed to watch 2 videos at the same time, not limiting it to IP/device)

Our application is running on a other server then Wowza.

If you have a butter suggestion then checking the logs for user access i am happy to hear it.

I think I understand what you are seeing: with HLS streams to iOS devices there can be multiple sessions server-side for what is one playback session from the user’s point of view. If you need to tie them together for accounting purposes you can use this technique

Richard

That is the tricked i used yes.

I made a few modifications for my needs:

log4j.appender.SQ.layout.Fields=x-sname-query
log4j.appender.SQ.layout.EventExclude=comment,vhost-stop,vhost-start,server-start,server-stop
log4j.appender.SQ.sql=INSERT IGNORE INTO accesslog (SELECT NULL AS id, '%X{date} %X{time}}' AS DATETIME, '%X{x-event}' AS EVENT, SUBSTRING_INDEX(SUBSTRING_INDEX('%X{x-sname-query}', '&', 2),'&',1) AS userid, SUBSTRING_INDEX(SUBSTRING_INDEX('%X{x-sname-query}%', '&', -2),'&',1) AS sessionid, SUBSTRING_INDEX(SUBSTRING_INDEX('%X{x-sname-query}%', '&', -1),'&',2) AS videoid, '%X{c-ip}' AS ip FROM ( SELECT NULL AS dummy_column) AS dummy_table WHERE '%X{x-event}' = 'connect' OR '%X{x-event}' = 'disconnect' LIMIT 1 ) ON DUPLICATE KEY UPDATE EVENT = '%X{x-event}'

I send the userId, sessionId and videoId to Wowza, with that i filter out all the needed data.

Since wowza has a delay of 30seconds between connect and disconnect i group the users with the session_id so they can freely watch videos in the same browser without getting a notification that they hitted there limit.

I think that is why i am getting a early disconnect, one of the sessions of a IOS device disconnects and wowza updates that.

What happens when i just turn of the HLS?

Edit:

When i turn off HLS, the iPad stops playing the video :frowning: