Menu
Amazon AppStream
Developer Guide

This documentation is for an older version of Amazon AppStream. For information about the latest version, see the Amazon AppStream 2.0 Developer Guide.

Streaming Audio to a Client

There are two ways your application can transmit audio to clients:

  • Explicitly send audio frames to the client—Explicitly sending audio frame-by-frame is best for situations in which you need tight integration between the video and audio frames, for example, if you are streaming speech synchronized with video of a person talking. To do so, call the XStxServerSetAudioSource function of the XStxServer object and set an audio source, you can then explicitly stream audio frames to the client by implementing the XStxIAudioSourceFcnGetFrame function of the XStxIAudioSource interface.

  • Automatically capture system audio and send that to the client —This is the easiest way to stream audio and works best in cases where you do not need tight integration between audio and video, for example if you are streaming background music during a puzzle game. To automatically stream audio, do not set an audio source by calling the XStxServerSetAudioSource function. When no audio source is set, the XStxServer object automatically captures system audio and streams that to the client.

Audio Timestamps

Timestamps are important for keeping the audio and video frames in synchronization. If your application uses automatic streaming of the system audio, the XStxServer object timestamps the audio frames using a built-in timestamp manager. You can also have the XStxServer object automatically timestamp your video frames by setting the willProvideTimestamps parameter to false when you call the XStxServerSetVideoSource function to set the video source of your application.

If you want to set the timestamps explicitly for your video frames and your application is using the automatic streaming of system audio, you can do so by having your application call the XStxServerGetTimestampUs function. This function returns the current mono timestamp from the XStxServer object, in microseconds.

On this page: