Play Method

Description

Starts playing the audio stream.

Syntax
object.Play

ParameterDescription
This method has no parameters.

Return Value

This method does not return a value.

Remarks

The SetSocket method must be used to set the proper IP address and port before the Play method is called. For safe event-driven programming, it is recommended that the Stop method be used before the Play method is called to make sure that the player is properly initialized.

If the AutoDetectCodec method has been used to disable the automatic detection of a codec, SetCodec must be used to set the proper codec before the Play method is called. AutoDetectCodec is enabled by default, however calling SetCodec disables automatic codec detection. The client audio control codec format must match the server codec format for each IP address and port used. The NetShow Administrator application uses the default codec of IMA ADPCM, Mono, 8 KHz, and 4 bits per sample (17, 1, 8000, 4) when it is first installed, but then defaults to the last codec used for a session.

If the audio control is already playing and the Play method is called, the S_FALSE error will be returned.

Make sure that if you use SetSocket and SetCodec, the parameters match the parameters used in your NetShow Administrator application.

Select a socket that will not cause a conflict with other multicast streams being sent on the same socket. If two RTP audio streams are multicasting on the same socket at the same time, the receiver will receive both transmissions and the resulting audio reception will be garbled. Care must be taken in the assignment of multicast IP addresses and ports.

Example

The following code example shows how to use Play. The audio control object is called rtpaudio and a button has been created called BtnPlay. When the button is clicked, the specified NetShow RTP Audio player will start playing with the specified codec from a specific address and port. The codec is assumed to be one that can be autodetected.


Sub BtnPlay_OnClick
 call rtpaudio.Stop()
 call rtpaudio.SetSocket(239.240.100.1, 29102)
 call rtpaudio.Play()
End Sub

See Also

Stop, SetSocket, SetCodec

Return to the RTP Audio Control Reference.

© 1997 Microsoft Corporation. All rights reserved. Terms of Use.