Suggestions

close search

Add Messaging, Voice, and Authentication to your apps with Vonage Communications APIs

Visit the Vonage API Developer Portal

Audio Fallback — Windows

Use the OpenTok audio fallback API to dynamically prioritize audio in response to network quality.

For conceptual information, see the audio fallback overview.

This topic includes the following sections:

Enabling and disabling audio-only fallback

To enable publisher audio fallback, set the Publisher.Builder.PublisherAudioFallback property when creating a Publisher object.

To enable and disable subscriber audio fallback (for all subscribers to the stream), call the Publisher.Builder.SubscriberAudioFallback property when creating a Publisher object. Subscriber audio fallback is only supported in routed sessions (sessions that use the OpenTok Media Router). Subscriber audio fallback is enabled by default (in routed sessions) for streams with a camera video source.


// Enable publisher audio fallback
Publisher = new Publisher.Builder(context)
{
  PublisherAudioFallback = true
}.Build();

// Enable publisher audio fallback and disable subscriber audio fallback
Publisher = new Publisher.Builder(context)
{
  PublisherAudioFallback = true,
  SubscriberAudioFallback = false
}.Build();

// Enable subscriber audio fallback and disable publisher audio fallback
Publisher = new Publisher.Builder(context)
{
  PublisherAudioFallback = false,
  SubscriberAudioFallback = true
}.Build();

Publisher audio fallback events

When publisher audio fallback is enabled, the Publisher object dispatches audio fallback-related events:

For example the following code handles the related events (so that you can provide your own user interface notifications):


publisher.VideoDisableWarning += (object sender) =>
{
  // Custom action — for example, add custom UI notification
}

publisher.VideoDisableWarningLifted += (object sender) =>
{
  // Custom action — for example, remove custom UI notification
}

publisher.VideoDisabled += (object sender, VideoEventArgs e) =>
{
  // Custom action — for example, add custom UI notification
}

publisher.VideoEnabled += (object sender, VideoEventArgs e) =>
{
  // Custom action — for example, remove custom UI notification
}

Subscriber audio fallback events

When subscriber audio fallback is enabled, the Subscriber object dispatches subscriber audio fallback-related events:

For example the following code handles the related events (so that you can provide your own user interface notifications):


subscriber.VideoDisableWarning += (object sender) =>
{
  // Custom action — for example, add custom UI notification
}

subscriber.VideoDisableWarningLifted += (object sender) =>
{
  // Custom action — for example, remove custom UI notification
}

subscriber.VideoDisabled += (object sender, VideoEventArgs e) =>
{
  // Custom action — for example, add custom UI notification
}

subscriber.VideoEnabled += (object sender, VideoEventArgs e) =>
{
  // Custom action — for example, remove custom UI notification
}