Important: The Google+ API for Hangouts is no longer supported. Learn more

gapi.hangout.av.effects - Developer Channel

Provides ability to add sound effects and attach image overlays.

Classes

Events

Enums

Classes in gapi.hangout.av.effects

Class Description
class HandTrackingData(
  hands,
  hasHand
)
The array of features for detected hands.
hands : Array.<SingleHandData>
hasHand : boolean
Indicates whether there is a hand in the video feed.
class HandTrackingOverlay() Object used to control one instance of an image that tracks a hand and is laid over the video feed of the local participant. The image is visible to all participants. Create a HandTrackingOverlay using createHandTrackingOverlay or showHandTrackingOverlay.

Jump to instance methods

class ImageResource(
  onLoad
)
Object used to load an image file which can be overlaid on the video feed.
Create an ImageResource with createImageResource.

Jump to instance methods


onLoad : undefined
An event that fires when the resource loads.
class MetaEffect(
  onNotify
)
A class for creating and controlling gapi.hangout.av.effects.MetaEffect.SubEffects.

Jump to instance methods

Jump to instance event functions


onNotify : undefined
The event target for meta effect notify events.
class SingleHandData(
  center,
  confidence,
  height,
  type,
  width
)
The information of a single detected hand in a video feed. The information contains the hand type (left hand or right hand), the hand position in the video feed, the detection confidence and the size of video feed. The x-y origin is the center of the frame. "Left" and "right" are respect to how others view the video. Likewise, positive x is to the right as others view the hand. The width and height of the feed are equal to 1.0 unit. The height and width of hand are in 1.0 unit with respect to the feed's height and width.
center : {x: number, y: number}
confidence : number
height : number
type : number
width : HandType

HandTrackingOverlay Instance Methods in gapi.hangout.av.effects

Instance Method Returns Description & Parameter
dispose() undefined Disposes the overlay.
getImageResource() ImageResource Returns the ImageResource used to create this object.
getOffset() {x: number, y: number} Returns the offset of the image overlay from the feature. See setOffset for a description of the x and y values.
getOpacity() number Returns the opacity value of the image overlay. See setOpacity for a description of opacity value.
getRotation() number Returns the base rotation of an image in radians.
getScale() number Returns the scale in relation to the natural image size of the overlay. This does not include any scaling occurring because of the getScaleWithHand flag. Example: a scale of 2 would cause the image to be twice its natural size.
getScaleWithHand() boolean Returns true if the size of the image will scale with the size of the hand that is being tracked, false otherwise. *
getTrackingFeature() HandTrackingFeature Returns the feature of the hand that the image overlay is attached to.
isDisposed() boolean Returns true if the overlay has been disposed.
isVisible() boolean Returns true if the image overlay is currently visible in the local participant's video feed, false otherwise.
setOffset(
  value,
  opt_y
)
undefined Sets the offset of the image overlay from the feature of the hand being tracked. With an offset of (0,0), the overlay is centered on the feature.

The x offset ranges from -1 to 1, where 1 is the width of the video feed, and positive values move the overlay toward the right. The y offset also ranges from -1 to 1, where 1 is the height of the video feed, and postive values move the overlay toward the bottom.
value : number|{x: number, y: number}
Either a single number representing the x offset, or an object with the x, y offset.
opt_y : number
The y offset (this parameter is ignored if value is an object.)
setOpacity(
  value
)
undefined Sets the opacity value of the image overlay. The value ranges from 0.0 to 1.0, where 0.0 means the overlay image is fully transparent and 1.0 means the overlay image is opaque.
value : number
The overlay opacity value.
setRotation(
  rotation
)
undefined Sets the rotation for an image.
rotation : number
The angle of rotation for the image, in radians.
setScale(
  scale
)
undefined Sets the amount an image should be scaled.
scale : number
The amount an image should be scaled relative to it's normal size.
setScaleWithHand(
  shouldScale
)
undefined Sets whether an image should scale as the hand being tracked gets larger or smaller.
shouldScale : boolean
Whether the image should scale with the hand.
setTrackingFeature(
  feature
)
undefined Sets the hand feature that the image overlay is attached to.
feature : HandTrackingFeature
The feature to track.
setVisible(
  visible
)
undefined Sets the image overlay to be visible or not.
visible : boolean
Whether the overlay is visible.

ImageResource Instance Methods in gapi.hangout.av.effects

Instance Method Returns Description & Parameter
createHandTrackingOverlay(
  opt_params
)
HandTrackingOverlay Creates a new instance of a hand tracking overlay with this image.
opt_params : {trackingFeature: gapi.hangout.av.effects.HandTrackingFeature, offset: {x: number, y: number}, rotation: number, scale: number, scaleWithHand: boolean}
The options for the newly created image overlay.
showHandTrackingOverlay(
  opt_params
)
HandTrackingOverlay Creates a new instance of a hand tracking overlay with this image and displays it.
opt_params : {trackingFeature: gapi.hangout.av.effects.HandTrackingFeature, offset: {x: number, y: number}, rotation: number, scale: number, scaleWithHand: boolean}
The options for the newly created image overlay.

Event Functions in gapi.hangout.av.effects

Event Function Description
gapi.hangout.av.effects.onHandTrackingDataChanged
onHandTrackingDataChanged.add(
  callback
)
Adds a callback to be called whenever the hand tracking data for the local participant changes. The argument to the callback is the current hand tracking data for the local participant.
callback : function(HandTrackingData)
The callback to add.
onHandTrackingDataChanged.remove(
  callback
)
Removes a callback previously added by onHandTrackingDataChanged.add
callback : function(HandTrackingData)
The callback to remove.

Enums in gapi.hangout.av.effects

Enum Description
HandTrackingFeature Identifiers for the features that can be tracked by a gapi.hangout.av.effects.HandTrackingOverlay.
HAND_CENTER
HandType Identifiers for left or right hand types. "Left" and "right" are from how others view the hand.
LEFT
RIGHT

MetaEffect Instance Methods in gapi.hangout.av.effects

Instance Method Returns Description & Parameter
clearEffects() undefined Removes all sub effects from the plugin.
createSubEffect(
  id,
  properties
)
SubEffect Creates a sub effect and adds it to this meta effect.
id : string
The effect id.
properties : Object
The configuration properties for the effect.
dispose() undefined Disposes the meta effect instance.
getEffectDescriptions() undefined Requests a meta effect notification callback containing a list of the available effects.
initEffects(
  subEffects
)
undefined Initializes or modifies the array of sub effects.
subEffects : Array.<SubEffect>
The sub effects to init or modify in the plugin.
isEnabled() boolean Returns true if the meta effect is enabled.
pipelineEffects(
  subEffects
)
undefined Enables the specified array of sub effects and disables all other effects. Effects will be processed in the order of the last pipeline message.
subEffects : Array.<SubEffect>
The sub effects to set as the pipeline in the plugin.
removeEffects(
  subEffects
)
undefined Removes the array of sub effects.
subEffects : Array.<SubEffect>
The sub effects to remove from the plugin.
setEnabled(
  enabled
)
undefined Sets whether the meta effect is enabled.
enabled : boolean
True if the meta effect should be enabled.

Instance Event Functions in gapi.hangout.av.effects.MetaEffect

Event Function Description
onNotify.add(
  callback
)
Adds a callback to be called when a MetaEffectNotify is sent from the effects plugin. The parameter to the callback is a gapi.hangout.av.effects.MetaEffect.MetaEffectNotify.
callback : function(MetaEffectNotify)
The callback to add.
onNotify.remove(
  callback
)
Removes a callback previously added by gapi.hangout.av.effects.MetaEffect.prototype.onNotify.add.
callback : function(MetaEffectNotify)
The callback to remove.

Send feedback about...

Google+ Hangouts API
Google+ Hangouts API