Remarks
Loads a song from the Internet or from a Shoutcast/Icecast server.
Accepted stream formats are: MP1, MP2, MP3, MP4 (***), AIFF, AAC, AC3, FLAC, WAV, OGG Vorbis, WMA (*), ASF (**), WMV (**), OPUS and HLS (HTTP Live Streaming).
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 will fire the DownloadBuffering event.
In case you should be downloading a single file (not a radio stream), once the download completes the DownloadComplete event will be fired: 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 control will fire the StreamLoaded event.
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]
control.LoadInternetStreamEx (
nPlayer as Integer,
strURL as String,
nFormat as enumFileTypes,
nOffsetInSizePerc as Long
) as enumErrorCodes
|
|
[C++]
short control.LoadInternetStreamEx (
short nPlayer,
LPCTSTR strURL,
short nFormat,
long nOffsetInSizePerc
);
|
|
Parameter
|
Description
|
|
|
nPlayer
|
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 or LoadInternetStreamEx methods.
|
nFormat
|
Type of audio format to try first, allowing a faster creation of the Internet stream when the audio format produced by the server is known in advance.
In case the URL should produce a different audio format, the control will in any case try against other supported audio formats.
This parameter is ignored when set to -1.
Supported values are the following:
Mnemonic constant
|
Value
|
Format
|
|
|
|
SOUNDTYPE_MP3
|
0
|
MP3
|
SOUNDTYPE_MP2
|
2
|
MP2
|
SOUNDTYPE_MP1
|
3
|
MP1
|
SOUNDTYPE_OGG
|
4
|
OGG Vorbis
|
SOUNDTYPE_WMA
|
5
|
Windows Media Audio
|
SOUNDTYPE_AIFF
|
13
|
AIFF
|
SOUNDTYPE_FLAC
|
14
|
FLAC
|
SOUNDTYPE_AAC
|
15
|
AAC
|
SOUNDTYPE_MP4
|
16
|
MP4
|
SOUNDTYPE_AC3
|
17
|
AC3
|
SOUNDTYPE_WV
|
19
|
WavPack
|
SOUNDTYPE_OPUS
|
36
|
Opus
|
SOUNDTYPE_HLS
|
37
|
HLS (HTTP Live Streaming)
|
|
nOffsetInSizePerc
|
Offset to start downloading from expressed in percentage of the original file size.
When the URL doesn't point to a continuous flow of audio data generated by Shoutcast/Icecast servers, as in the case of Internet radios, but points to an audio file having a defined size, this parameter allows discarding a certain amount of data at the beginning of the file itself and starting buffering audio data at a later position.
In case of compressed files like MP3, the percentage is related to the compressed file and not to the uncompressed and decoded audio data.
This parameter is ignored when set to 0.
|
Return value
Value
|
Meaning
|
|
|
enumErrorCodes.NOERROR (0)
|
The method call was successful.
|
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).
|