How to use the control as a source for streaming servers like SHOUTcast |
|
Audio DJ Studio can work as a source client for the following streaming servers.
• | SHOUTcast (versions 1 and 2), developed by Nullsoft, is a freeware server for streaming media. The most common use of SHOUTcast is for creating or listening to Internet audio broadcasts. SHOUTcast makes it possible to inexpensively set up an Internet broadcasting station, so hobbyists and large radio network owners alike can use it to set up their own broadcasting network for a fraction of the cost of a traditional AM broadcasting or FM radio station: Audio DJ Studio can work as a source client for SHOUTcast servers through the use of an external encoder: currently supported formats are: |
- MP3 through the Lame.exe external encoder
- AAC+ through the Fdkaac.exe external encoder
- Ogg Vorbis through the OggEnc.exe external encoder.
• | Icecast, developed and maintained by the Xiph.org Foundation, is an open-source server streaming media project and is very similar to the already mentioned SHOUTcast; also in this case, Audio DJ Studio can work as a source client for Icecast servers through the use of an external encoder: currently supported formats are: |
- MP3 through the Lame.exe external encoder
- AAC+ through the Fdkaac.exe external encoder
- Ogg Vorbis through the OggEnc.exe external encoder.
• | Windows Media Services (WMS) is a streaming media server, developed from Microsoft, that allows an administrator to generate streaming media through entities named "publishing points". Audio DJ Studio can work as a source client for WMS by leveraging Windows Media components, installed in Windows, that will act as an external encoder and send the audio stream in WMA (Windows Media Audio) format to a given publishing point. Related to WMA format, Audio DJ Studio can also send its audio output directly to a network port, allowing other clients to connect to the IP address and port combination of the PC running Audio DJ Studio in order to get audio data without the interaction of a server. |
If you take a look to the graph above, you will see that there are two ways to send an audio stream to a streaming server:
• | Through the output of a custom Stream Mixer |
• | Through the output of a player directly |
• | Through the output of a WASAPI loopback device (Windows Vista and later versions only) |
Below you will find information about the way to achieve both of them with SHOUTcast/Icecast servers or with WMS servers and, as a further information, how to stream in WMA format directly to the network.
• | Sending streaming media to SHOUTcast and Icecast servers |
• | Through a custom Stream Mixer: in this case the stream mixer will send mixed streams to the external encoder and then to the server; for this purpose you need to create the casting session through a call to the CastingCreateFromStreamMixer method. For further information about the use of custom Stream Mixers refer to the tutorial How to use custom Stream Mixers. |
• | Through a player directly: in this case the player will send the previously loaded sound (for example through the LoadSound method) to the external encoder and then to the server; for this purpose you need to create the casting session through a call to the CastingCreateFromPlayer method. With this method you can only cast sound files and not Internet streams so it won't be possible casting sounds loaded through the LoadInternetStream method; in order to cast streams loaded from an Internet server you will have to rely upon a custom stream mixer and upon the CastingCreateFromStreamMixer method described above. |
• | Through the output of a WASAPI loopback device (Windows Vista and later versions only): in this case any sound being played through a render audio endpoint device, also by external applications like Windows Media Player, is sent to the external encoder and then to the server; for this purpose you need to create the casting session through a call to the CastingCreateFromWasapiLoopback method. For further details about the use of WASAPI see the WASAPIMan class and the How to manage audio flow through WASAPI tutorial. |
All of the mentioned methods, if successful, will return a unique identifier that will be used in order to take further actions on the casting session; the connection to the server is established through a call to the CastingStart method and interrupted through a call to the CastingStop method. While a casting session is connected to the server, you can set the title of the casting session through the CastingSetTitle method and to obtain statistics, in XML format, about the casting session through the CastingGetXmlStatistics method.
When dealing with a SHOUTcast version 2 server it's also possible sending metadata to the server through the usage of the CastingSendMetaData and CastingSendMetaDataString methods.
The container application can be maintained up-to-date about the casting session through a dedicated set of events:
• | If the casting session has been initiated by a custom Stream Mixer, the call to the CastingStart method will generate the CastingStreamMixerStart event while the call to the CastingStop method will generate the CastingStreamMixerStop event. |
• | If the casting session has been initiated by one of the available players, the call to the CastingStart method will generate the CastingPlayerStart event while the call to the CastingStop method or the completion of the transmission of the loaded file will generate the CastingPlayerDone event. During the transmission of the loaded file the container application can be informed about its advancement through the CastingPlayerPerc event. |
• | If the casting session has been initiated by a WASAPI loopback device, the call to the CastingStart method will generate the CastingWasapiLoopbackStart event while the call to the CastingStop method will generate the CastingWasapiLoopbackStop event. |
You can know if a casting session is active through the CastingIsActive method.
• | Sending streaming media to WMS servers |
• | Through a custom Stream Mixer: in this case the stream mixer will send mixed streams to the external encoder and then to the server; for this purpose you need to create the casting session through a call to CastingWmaPubPointOpenForStreamMixer method for WMS servers. For further information about the use of custom Stream Mixers refer to the tutorial How to use custom Stream Mixers. |
• | Through a player directly: in this case the player will send the previously loaded sound (for example through the LoadSound method) to the external encoder and then to the server; for this purpose you need to create the casting session through a call to the CastingWmaPubPointOpenForPlayer method for WMS servers. With this method you can only cast sound files and not Internet streams so it won't be possible casting sounds loaded through the LoadInternetStream method. |
• | Through the output of a WASAPI loopback device (Windows Vista and later versions only): in this case any sound being played through a render audio endpoint device, also by external applications like Windows Media Player, is sent to the external encoder and then to the server; for this purpose you need to create the casting session through a call to the CastingWmaPubPointOpenFromWasapiLoopback method for WMS servers. For further details about the use of WASAPI see the WASAPIMan class and the How to manage audio flow through WASAPI tutorial. |
All of the mentioned methods, if successful, will return a unique identifier that will be used in order to take further actions on the casting session; when called, you will need passing them the "bitrate" used to stream audio: you can enumerate available bitrates through the WmaBitrateCount and WmaBitrateGet methods. The connection to the server is established through a call to the CastingStart method and interrupted through a call to the CastingStop method.
The container application can be maintained up-to-date about the casting session through a dedicated set of events:
• | If the casting session has been initiated by a custom Stream Mixer, the call to the CastingStart method will generate the CastingStreamMixerStart event while the call to the CastingStop method will generate the CastingStreamMixerStop event. |
• | If the casting session has been initiated by one of the available players, the call to the CastingStart method will generate the CastingPlayerStart event while the call to the CastingStop method or the completion of the transmission of the loaded file will generate the CastingPlayerDone event. During the transmission of the loaded file the container application can be informed about its advancement through the CastingPlayerPerc event. |
• | If the casting session has been initiated by a WASAPI loopback device, the call to the CastingStart method will generate the CastingWasapiLoopbackStart event while the call to the CastingStop method will generate the CastingWasapiLoopbackStop event. |
While a casting session is active and connected to the server, you can set WMA tags through the CastingWmaSetTag method. You can know if a casting session is active through the CastingIsActive method.
• | Streaming in WMA format to the network |
• | Through a custom Stream Mixer: in this case the stream mixer will send mixed streams to the external encoder and then to a given network port; for this purpose you need to create the casting session through a call to CastingWmaNetworkOpenForStreamMixer method. For further information about the use of custom Stream Mixers refer to the tutorial How to use custom Stream Mixers. |
• | Through a player directly: in this case the player will send the previously loaded sound (for example through the LoadSound method) to the external encoder and then to a given network port; for this purpose you need to create the casting session through a call to the CastingWmaNetworkOpenForPlayer method. With this method you can only cast sound files and not Internet streams so it won't be possible casting sounds loaded through the LoadInternetStream method; in order to cast streams loaded from an Internet server you will have to rely upon a custom stream mixer and upon the CastingWmaNetworkOpenForStreamMixer method described above. |
• | Through the output of a WASAPI loopback device (Windows Vista and later versions only): in this case any sound being played through a render audio endpoint device, also by external applications like Windows Media Player, is sent to the external encoder and then to a given network port; for this purpose you need to create the casting session through a call to CastingWmaNetworkOpenFromWasapiLoopback method. For further details about the use of WASAPI see the WASAPIMan class and the How to manage audio flow through WASAPI tutorial. |
All of the mentioned methods, if successful, will return a unique identifier that will be used in order to take further actions on the casting session; when called, you will need passing them the "bitrate" used to stream audio: you can enumerate available bitrates through the WmaBitrateCount and WmaBitrateGet methods. The connection to the server is established through a call to the CastingStart method and interrupted through a call to the CastingStop method.
The container application can be maintained up-to-date about the casting session through a dedicated set of events:
• | If the casting session has been initiated by a custom Stream Mixer, the call to the CastingStart method will generate the CastingStreamMixerStart event while the call to the CastingStop method will generate the CastingStreamMixerStop event. |
• | If the casting session has been initiated by one of the available players, the call to the CastingStart method will generate the CastingPlayerStart event while the call to the CastingStop method or the completion of the transmission of the loaded file will generate the CastingPlayerDone event. During the transmission of the loaded file the container application can be informed about its advancement through the CastingPlayerPerc event. |
• | If the casting session has been initiated by a WASAPI loopback device, the call to the CastingStart method will generate the CastingWasapiLoopbackStart event while the call to the CastingStop method will generate the CastingWasapiLoopbackStop event. |
While a casting session is connected to the server, you can set WMA tags through the CastingWmaSetTag method and to get some information, like the number of connected clients and the network port used for streaming, through the CastingWmaGetInfo method. You can enumerate IP addresses, connected to your casting session, through the CastingWmaConnectedIPGetCount and CastingWmaConnectedIPGetDesc methods.
While a casting session is active and connected to the server, you can set WMA tags through the CastingWmaSetTag method. You can know if a casting session is active through the CastingIsActive method. Each time a client is connected/disconnected, the container application receives a WmaNetworkClientConnect event with a flag that specifies if there was a connection or disconnection and with the IP address of the client machine originating the request.
IMPORTANT NOTICE ABOUT FIREWALL PRESENCE
If the computer that is hosting the server, or the computer that is hosting the container application, has an active firewall or is behind a router, there are settings that must be configured in order to allow data communication. Refer to your firewall and/or router documentation in order to know which settings must be changed.
|
Samples of casting in C# and VB.NET can be found inside the following samples installed with the product's setup package:
- Casting
- CastMixedStreams
- CastWasapiLoopback
- StreamMixer (requires the installation of Audio Sound Suite)
- WasapiStreamMixer (requires the installation of Audio Sound Suite)