Copyright © 2005-2008 MultiMedia Soft 
Return to Table of contents  
 
How to play Internet streams 
 
There are two main types of Internet stream: 
 
  • Broadcasting streams 
  • Sound files available on a web site 
  •  
    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 start buffering sound data and will fire the DownloadBuffering event with its nState parameter set to STREAMING_BUFFERING
    Once there will be enough data to play, the control will fire the StreamLoaded event allowing the container application to start the playback session through a call to the PlaySound method. 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: 
  • instruct the control to retrieve the tag contents through a call to the ReadSoundInfo method 
  • verify the effective availability of the tags and the number of strings composing the tag through a call to the IsTagAvailable method 
  • retrieve each of the various strings composing the tag through a call to the GetTagString method. 
  •  
     
    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: 
  • The remote server will not send metadata so the control will never fire the MetaTagChanged event 
  • Differently from streams, that can be created in real-time, sound files have a limited size: this means that, at a certain extent, the download of the file will be completed: the control will in this case fire a DownloadComplete method allowing the container application to gain access to tags like ID3V1 which, for MP3 files, are stored on the file's bottom. 
  •  
     
    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 
     
     
     
     
     
     
     
     
     
     
     
     
    Copyright © 2005-2008 MultiMedia Soft 
    Return to Table of contents