This new API will let you detect the participant’s face and overlay your own image on it. Images can be attached to different parts of the face (nose, eyes, upper lip, etc.) and will track that point as the face moves. The image will rotate as the face rotates, and scale to the size of the face.
The following code snippet will give you a sense of how simple it is to detect the nose tip of a participant and overlay a custom image. See the API documentation for more details.
// Load the image file
var imageResource = gapi.hangout.av.effects.createImageResource(
'http://your image file');
// Create the overlay
var overlay = imageResource.createFaceTrackingOverlay({
trackingFeature: gapi.hangout.av.effects.FaceTrackingFeature.NOSE_TIP,
scaleWithFace: true,
rotateWithFace: true
});
overlay.setVisible(true);
We are also adding an API that lets developers add their own sound to the hangouts. Here is a snippet.
// Load an audio file var audioResource = gapi.hangout.av.effects.createAudioResource( 'http://your audio file'); // Play the sound var sound = audioResource.play();
Give it a try and add some fun and interesting elements to your hangouts apps. Follow the conversation on Google+. #seasonforshipping.
No comments:
Post a Comment