Suggestions

close search

VideoEnabledChangedEvent

Properties Methods 

Defines the event object for the videoDisabled and videoEnabled events dispatched by the Subscriber.

Properties

Name Type Description
cancelable Boolean Whether the event has a default behavior that is cancelable (true) or not (false). You can cancel the default behavior by calling the preventDefault() method of the event object in the callback function. (See preventDefault().)
reason String The reason the video was disabled or enabled. This can be set to one of the following values:
  • "publishVideo" — The publisher started or stopped publishing video, by calling publishVideo(true) or publishVideo(false).
  • "quality" — The OpenTok Media Router starts or stops sending video to the subscriber based on stream quality changes. This feature of the OpenTok Media Router has a subscriber drop the video stream when connectivity degrades. (The subscriber continues to receive the audio stream, if there is one.)

    If connectivity improves to support video again, the Subscriber object dispatches a videoEnabled event, and the Subscriber resumes receiving video.

    By default, the Subscriber displays a video disabled indicator when a videoDisabled event with this reason is dispatched and removes the indicator when the videoEnabled event with this reason is dispatched. You can control the display of this icon by calling the setStyle() method of the Subscriber, setting the videoDisabledDisplayMode property(or you can set the style when calling the Session.subscribe() method, setting the style property of the properties parameter).

    This feature is only available in sessions that use the OpenTok Media Router (sessions with the media mode set to routed), not in sessions with the media mode set to relayed.

  • "subscribeToVideo" — The subscriber started or stopped subscribing to video, by calling subscribeToVideo(true) or subscribeToVideo(false).
target Object The object that dispatched the event.
type String The type of event: "videoDisabled" or "videoEnabled".
See:

Methods

Name Description
isDefaultPrevented() → {Boolean} Whether the default event behavior has been prevented via a call to preventDefault() (true) or not (false).
preventDefault() Prevents the default behavior associated with the event from taking place.

isDefaultPrevented() → {Boolean}

Whether the default event behavior has been prevented via a call to preventDefault() (true) or not (false). See preventDefault().
Returns:

preventDefault()

Prevents the default behavior associated with the event from taking place.

To see whether an event has a default behavior, check the cancelable property of the event object.

Call the preventDefault() method in the callback function for the event.

The following events have default behaviors: