Not able to handle the callbcks for http streams

We want to restrict the stream url access for multiple users in the same time.

We tried with md5 generation of URL and provided expiry of the url for 2 hrs

In the mean time, if i copy the url from wowza logs and play , it is playing for multiple users

there is no restriction

Then we are implementing in the following way

To achieve this

we created mysql db with one table to track all these

when the user connects then we are validating whether the record is in db or not

If yes , we will check the status

if status is 0 we will not allow the user to watch the stream

if status is 1 then we will allow the user to watch the stream. then In play event updating the status to 0 .

If not

we will insert the new record with status 0 and allowing user to watch the stream

Once User stops playing the video. then updating them to 1.

To handle this for RTSP i am able to handle the events call backs by using IMediaStreamActionNotify3 interface.

But for HTTP, I am not able to find any event call backs to perform the above validation like looking for connect,play and stop events.

Please any one suggest me on this.this is very urgent

Appreciate the response

For the initial http session creation, you can leverage the following event handler:

onHTTPSessionCreate(IHTTPStreamerSession httpSession) 

Thereafter, each subsequent request could be handled using the following:

public void onHTTPStreamerRequest(IHTTPStreamerSession httpSession, IHTTPStreamerRequestContext reqContext)

The above event is called for every streamer request. You won’t be able to determine a stop event here but you can handle that when the session is timed out.

Thanks,

Matt

Hi Matt,

Is there any way i can identify if the request is coming from the same device forthe second session.

I am using following logic.

public void onHTTPSessionCreate(IHTTPStreamerSession httpSession) { getLogger().info(

“AptvAuth: onHTTPSessionCreate sessionID :”

  • httpSession.getSessionId());

getLogger().info(

“AptvAuth: onHTTPSessionCreate streamName :”);

if (this.key == null) {

loadKey(httpSession);

}

if (this.key == null) {

this.key = “12345678”;

}

// if(!isRequestExist){

// isRequestExist=true;

getLogger().info(“AptvAuth: onHTTPSessionCreate isRequestExist” +isRequestExist);

if (!isRequestExist) {

try {

Set keyset = httpSession.getHTTPHeaderNames();

Iterator itr =keyset.iterator();

while(itr.hasNext())

{

String key= itr.next().toString();

String value=httpSession.getHTTPHeader(key);

getLogger().info(

“AptvAuth: KEY ::”+key);

getLogger().info(

“AptvAuth: VALUE ::”+value);

}

isRequestExist = true;

// Thread.sleep(1000);

if (!validate(httpSession)) {

isRequestValid = false;

httpSession.rejectSession();

getLogger()

.info(

“AptvAuth: onHTTPSessionCreate in Validating the request”);

} else {

GetConnection.updateRecordToTable(getMd5(), getLogger(), 0);

isRequestValid = true;

httpSession.acceptSession();

}

} catch (SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

// catch (InterruptedException e) {

// // TODO Auto-generated catch block

// e.printStackTrace();

// }

else {

try {

Thread.sleep(1000);

if (!validate(httpSession)) {

isRequestValid = false;

httpSession.rejectSession();

getLogger()

.info(

“AptvAuth: onHTTPSessionCreate in Validating the request”);

} else {

GetConnection.updateRecordToTable(getMd5(), getLogger(), 0);

isRequestValid = true;

httpSession.acceptSession();

}

} catch (SQLException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (InterruptedException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

can you please suggest me on this.

Regards

Arun