.toString().equals(event.getValue())) {
return;
}
session.setAttribute("eventValue",
event.getValue());
session.publishEvent(new ContentEvent(event
.getType(), event.getValue()));
}
});
}
else if (contentId != null && contentId.equalsIgnoreCase("crowd")) {
// Crowd Detector Filter
List<RelativePoint> points = new ArrayList<RelativePoint>();
points.add(new RelativePoint(0, 0));
points.add(new RelativePoint(1, 0));
points.add(new RelativePoint(1, 1));
points.add(new RelativePoint(0, 1));
RegionOfInterestConfig config = new RegionOfInterestConfig();
config.setFluidityLevelMin(10);
config.setFluidityLevelMed(35);
config.setFluidityLevelMax(65);
config.setFluidityNumFramesToEvent(5);
config.setOccupancyLevelMin(10);
config.setOccupancyLevelMed(35);
config.setOccupancyLevelMax(65);
config.setOccupancyNumFramesToEvent(5);
config.setSendOpticalFlowEvent(false);
List<RegionOfInterest> rois = newArrayList(new RegionOfInterest(
points, config, "Roi"));
CrowdDetectorFilter crowdDetector = mp.newCrowdDetectorFilter(
rois).build();
playerEndpoint.connect(crowdDetector);
crowdDetector.connect(httpEP);
}
else if (contentId != null && contentId.equalsIgnoreCase("plate")) {
// Plate Detector Filter
PlateDetectorFilter plateDetectorFilter = mp
.newPlateDetectorFilter().build();
playerEndpoint.connect(plateDetectorFilter);
plateDetectorFilter.connect(httpEP);
session.setAttribute("plateValue", "");
plateDetectorFilter
.addPlateDetectedListener(new MediaEventListener<PlateDetectedEvent>() {
@Override
public void onEvent(PlateDetectedEvent event) {
if (session.getAttribute("plateValue")
.toString().equals(event.getPlate())) {
return;
}
session.setAttribute("plateValue",
event.getPlate());
session.publishEvent(new ContentEvent(event
.getType(), event.getPlate()));
}
});
}
else if (contentId != null && contentId.equalsIgnoreCase("pointer")) {
// Pointer Detector Filter
PointerDetectorFilter pointerDetectorFilter = mp
.newPointerDetectorFilter().build();
pointerDetectorFilter
.addWindow(new PointerDetectorWindowMediaParam("goal",
50, 50, 150, 150));
pointerDetectorFilter
.addWindowInListener(new MediaEventListener<WindowInEvent>() {
@Override
public void onEvent(WindowInEvent event) {
session.publishEvent(new ContentEvent(event
.getType(), event.getWindowId()));
}
});
playerEndpoint.connect(pointerDetectorFilter);