// connect elements
playerendpoint.connect(crowdDetector);
crowdDetector.connect(webRtcEndpoint);
playerendpoint.play();
contentSession.publishEvent(new ContentEvent("startConn",
"startConn"));
// addEventListener to crowddetector
crowdDetector
.addCrowdDetectorDirectionListener(new MediaEventListener<CrowdDetectorDirectionEvent>() {
@Override
public void onEvent(
CrowdDetectorDirectionEvent event) {
String eventText = "Direction event detect in ROI "
+ event.getRoiID()
+ "with direction "
+ event.getDirectionAngle();
contentSession.publishEvent(new ContentEvent(
event.getType(), eventText));
}
});
crowdDetector
.addCrowdDetectorFluidityListener(new MediaEventListener<CrowdDetectorFluidityEvent>() {
@Override
public void onEvent(CrowdDetectorFluidityEvent event) {
String eventText = "Fluidity event detect in ROI "
+ event.getRoiID()
+ ". Fluidity level = "
+ event.getFluidityLevel()
+ " and fluidity percentage = "
+ event.getFluidityPercentage();
contentSession.publishEvent(new ContentEvent(
event.getType(), eventText));
}
});
crowdDetector
.addCrowdDetectorOccupancyListener(new MediaEventListener<CrowdDetectorOccupancyEvent>() {
@Override
public void onEvent(
CrowdDetectorOccupancyEvent event) {
String eventText = "Occupancy event detect in ROI "
+ event.getRoiID()
+ ". Occupancy level = "
+ event.getOccupancyLevel()
+ " and occupancy percentage = "
+ event.getOccupancyPercentage();
contentSession.publishEvent(new ContentEvent(
event.getType(), eventText));
}
});
}
}