Copyright © 2005-2018 MultiMedia Soft

LoadInternetStream method

Previous pageReturn to chapter overviewNext page

Remarks

 

Loads a song from the Internet or from a Shoutcast/Icecast server.

 

This method will try to open the Internet stream using different audio format decoders until the compatible one is found: accepted stream formats are: MP1, MP2, MP3, MP4 (***), AIFF, AAC, AC3, FLAC, WAV, OGG Vorbis, WMA (*),  ASF (**), WMV (**), OPUS and HLS (HTTP Live Streaming).

In case you should already know the exact audio format of the Internet stream, you may select the proper one through the LoadInternetStreamEx method, allowing a faster availability of audio data to play.

 

MOD formats are not accepted: if you want to play MOD music downloaded from the Internet, you should download the MOD file into local memory (for example using the Microsoft WININET API) and then use the LoadSoundFromMemory method.

 

A successful call to this method invokes the CallbackForPlayersEvents delegate with the nEvent parameter set to EV_DOWNLOAD_BUFFERING.

 

In case you should be downloading a single file (not a radio stream), once the download completes the CallbackForPlayersEvents delegate is invoked with the nEvent parameter set to EV_DOWNLOAD_COMPLETE: if for example you need to retrieve the ID3V1 tag of a downloaded MP3 file, information available only on the latest bytes of the file, you could use this event to trigger the availability of the needed Tag.

 

Once the downloaded stream or file has enough playable data, the CallbackForPlayersEvents delegate is invoked with the nEvent parameter set to EV_STREAM_LOADED.

 

Default settings related to Internet connections can be retrieved and modified through the InternetSettingsGet and InternetSettingsSet methods.

 

For further details about Internet streams support see the How to play Internet streams and radio stations section.

 

 

Syntax

 

[Visual Basic]

Public Function LoadInternetStream (

nPlayerIndex as Int16,

strURL as String

) as enumErrorCodes


 

[C#]

public enumErrorCodes LoadInternetStream (

Int16 nPlayerIndex,

string strURL

);


 

[C++]

public: enumErrorCodes LoadInternetStream (

Int16 nPlayerIndex,

string strURL

);


 

 

Parameter

Description

 

 

nPlayerIndex

Number representing the zero-based index of the player that will load the sound

strURL

String containing the URL of the stream to load. Accepted URLs begin with "http://", "ftp://" or "mms://".

Passing an empty string will cause to cancel any previous call to the LoadInternetStream method.

 

 

Return value

 

Value

Meaning

 

 

enumErrorCodes.NOERROR (0)

The song file has been loaded successfully.

Negative value

An error occurred: see the LastError property for further error details or for a list of the possible error values.

 

 

(*) Requires Microsoft Windows Media Format modules already installed on the target PC

(**) Performs sound tracks only (no video): requires Microsoft Windows Media Format modules already installed on the target PC

(***) Performs sound tracks only (no video)

The Windows Media Format modules can be installed using the redistribution setup package (wmfdist.exe) provided by Microsoft. Details about the integration of these modules inside your own setup package can be found on the following link of the official Microsoft web site (note that in the future this link could change due to the Microsoft site maintenance).