.create();
contentSession.releaseOnTerminate(mp);
// Media Elements: WebRTC Endpoint, Filter
final WebRtcEndpoint webRtcEndpoint = mp.newWebRtcEndpoint().build();
final PointerDetectorFilter pointerDetectorFilter = mp
.newPointerDetectorFilter().build();
final FaceOverlayFilter faceOverlayFilter = mp.newFaceOverlayFilter()
.build();
PointerDetectorWindowMediaParam start = new PointerDetectorWindowMediaParam(
"start", 100, 100, 280, 380);
start.setImage("http://files.kurento.org/imgs/start.png");
pointerDetectorFilter.addWindow(start);
pointerDetectorFilter
.addWindowInListener(new MediaEventListener<WindowInEvent>() {
public void onEvent(WindowInEvent event) {
// Set overlay image
faceOverlayFilter.setOverlayedImage(
"http://files.kurento.org/imgs/mario-wings.png",
-0.35F, -1.2F, 1.6F, 1.6F);
}
});
// Connections
webRtcEndpoint.connect(pointerDetectorFilter);
pointerDetectorFilter.connect(faceOverlayFilter);
faceOverlayFilter.connect(webRtcEndpoint);
// Start content session
contentSession.start(webRtcEndpoint);
}