|
How to play Internet streams |
![]() ![]()
|
There are two main types of Internet stream:
These streams cannot be loaded through the LoadSound method: for this purpose you must use the LoadInternetStream method which gives the possibility to pass a URL in place of a pathname. Let's see how to manage these different streams.
Broadcasting streams
Internet radio is a broadcasting service which transmits one or more sound streams via the Internet: for this kind of streams, the control will connect to the remote server and will fire the following sequence of events:
Immediately after starting playback, the control will fire again the DownloadBuffering event with its nState parameter set to STREAMING_PLAYING: note that, during the playback session, the control will continue buffering data from the Internet: if for any reason, for example for a slow connection, the download should stall, the control will notify the container application firing again the DownloadBuffering event with the nState parameter set to STREAMING_BUFFERING: when there will be again enough data to play, the control will automatically resume playback notifying the container application through the DownloadBuffering event with the nState parameter set to STREAMING_PLAYING.
After a stall situation, the Internet stream provider could also close the connection: in this case the control will fire the ServerClosed event.
During playback, the server will usually send information about the radio station and about the song in playback: the control has the capability to notify in real-time the availability of this information, usually called "tags", and to retrieve the various strings composing the same tag: for this purpose the control will fire the MetaTagChanged event: at this point the container application will have the possibility to perform the following sequence of tasks:
Sound files available on a web site
Loading a sound file from a web site is very similar to loading a broadcast stream with the following differences:
A sample of access to Internet streams in Visual C# and Visual Basic.NET can be found inside the following sample installed with the product's setup package: - InternetRadio
|