Copyright © 2005-2023 MultiMedia Soft

Downloader.SessionStartToPlayer method

Previous pageReturn to chapter overviewNext page

Remarks

 

Starts a download session of a remote media file pointed by a URL and, once the download is completed, automatically loads it into the given player.

 

A successful call to this method allows the container application the be notified about the advancement through the CallbackForDownloaderEvents delegate which is invoked with the nEvent parameter set to one of the following values:

 

- the EV_DOWNLOADER_SESSION_STARTED event reports that the downloading session is started

- the EV_DOWNLOADER_SESSION_PROGRESS event informs about the download advancement expressed in percentage

- the EV_DOWNLOADER_SESSION_COMPLETED event reports that the downloading session is completed successfully

 

In case the connection to the remote server or the access to the remote file should fail, the CallbackForDownloaderEvents delegate is invoked with the nEvent parameter set to EV_DOWNLOADER_SESSION_FAILED.

 

In case the remote file should be of an unsupported format and the automatic loading should fail, the CallbackForDownloaderEvents delegate is invoked with the nEvent parameter set to EV_DOWNLOADER_INVALID_FILE.

 

In case the connection should be stopped by the user through a call to the Downloader.SessionStop method, the CallbackForDownloaderEvents delegate is invoked with the nEvent parameter set to EV_DOWNLOADER_SESSION_STOPPED.

 

For details about management of download sessions from HTTP and FTP servers, refer to the How to manage download sessions tutorial.

 

 

Syntax

 

[Visual Basic]

Public Function SessionStartToPlayer (

strURL as String,

strUsername as String,

strPassword as String,

nMediaType as enumMediaTypes,

strDecryptionKey as String,

bDisableCache as Boolean

) as Int32


 

[C#]

public Int32 SessionStartToPlayer (

string strURL,

string strUsername,

string strPassword,

enumMediaTypes nMediaType,

string strDecryptionKey,

bool bDisableCache

);


 

[C++]

public: Int32 SessionStartToPlayer(

string strURL,

string strUsername,

string strPassword,

enumMediaTypes nMediaType,

string strDecryptionKey,

bool bDisableCache

);


 

 

Parameter

Description

 

 

strURL

String containing the URL pointing to the remote media file to download. Accepted Internet protocols for the passed URL must be of type HTTPS, HTTP or FTP.

strUsername

String containing the username for accessing the server. Leave the string empty if the directory containing the remote file is not username protected.

strPassword

String containing the password for accessing the server. Leave the string empty if the directory containing the remote file is not password protected.

nMediaType

Media type.

Supported values are the following:

Mnemonic constant

Value

Meaning

MEDIA_TYPE_AUDIO

0

The requested media is an audio file.

Accepted audio formats are the same supported by the LoadSound method.

In case the remote file should have been encrypted through the CryptSound™ application, the decryption key can be specified through the strDecryptionKey parameter below.

MEDIA_TYPE_VIDEO

1

The requested media is a video file.

Once the download session is completed the behaviour is the same as invoking the VideoPlayer.Load method.

strDecryptionKey

String containing the decryption key for audio encrypted files.

If the audio file is not encrypted leave this string empty.

This parameter is ignored when the nMediaType parameter is set to MEDIA_TYPE_VIDEO.

bDisableCache

Flag for determining if the usage of the Internet cache must be disabled or not.

Supported values are the following:

Mnemonic constant

Meaning

false

If the file to download is already inside the Internet cache, allows taking the cached file.

true

Never use an eventual cached file, always take it from the remote server.

 

 

Return value

 

Value

Meaning

 

 

Value >= 0

The method call was successful and the returned value is the unique identifier of the download session.

Negative value

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

In case the error code should be ERR_DOWNLOADER_REMOTE_FILE_FAILURE or ERR_DOWNLOADER_LOCAL_FILE_FAILURE the Downloader.LastFileExceptionGet method would provide the nature of the error which may assume one of the following values:

Value

Meaning

1

An unspecified error occurred.

2

The file could not be located.

3

All or part of the path is invalid.

4

The permitted number of open files was exceeded.

5

The file could not be accessed.

6

There was an attempt to use an invalid file handle.

7

The current working directory cannot be removed.

8

There are no more directory entries.

9

There was an error trying to set the file pointer.

10

There was a hardware error.

11

SHARE.EXE was not loaded, or a shared region was locked.

12

There was an attempt to lock a region that was already locked.

13

The disk is full.

14

The end of file was reached.