Search code examples
javawowzahttp-live-streaming

Wowza - onHTTPCupertinoStreamingSessionCreate called multiple times


I'm trying to limit streams per user, and my idea was to store info does user stream video or not into database. Then when session is created I would check database and approve/reject stream.

My problem is that onHTTPCupertinoStreamingSessionCreate is fired multiple times. I have no idea why or how it's even possible. This is my logic in short:

public void onHTTPCupertinoStreamingSessionCreate(HTTPStreamerSessionCupertino httpSession) {   
    if( alreadyStreaming( userID ) ){
        httpSession.rejectSession();
        return;
    }
    else{
        setStreamActiveInDB( userID, true);
    }
}

public void onHTTPCupertinoStreamingSessionDestroy(HTTPStreamerSessionCupertino httpSession) {  
    setStreamActiveInDB( userID, false );
}

Any idea on how to check why is this event firing multiple times, or another idea how to limit number of streams per user?


Solution

  • I have also faced this issue and one particular scenario was that the HTTP streaming link was in a mobile browser. The user clicks on the link, the browser does not know the content type, so it connects which causes a new HTTP session and thus a call to onHTTPCupertinoStreamingSessionCreate. Then the browser gets the response and understands that this is a video, so it launches a player. The player asks for the manifest, that is a second HTTP session. I have seen that a third session is launched when the player starts loading the video chunks. Then the first 2 sessions die eventually, and the third one survives. I had to do various tricks to connect these sessions and account them as one session. I hope this gives you an idea why this happens. So a new HTTP session is not equal to a new connected player in general.