Copyright © 2005-2023 MultiMedia Soft

Youtube.VideoSearchByIDDownloadStreamToFile method

Previous pageReturn to chapter overviewNext page

Remarks

 

Starts a download session of the requested stream, belonging to a video found through the latest search performed by the Youtube.VideoSearchByID method, and stores the remote file into a local file.

 

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.

 

The download can be stopped by the user through a call to the Youtube.VideoSearchByIDDownloadStop method.

 

For details about management of Youtube connections refer to How to enumerate and download video/audio clips from Youtube tutorial.

For further details about methods related to Youtube searches refer to the YoutubeMan class.

 

 

Syntax

 

[Visual Basic]

Public Function VideoSearchByIDDownloadStreamToFile (

nType as enumYoutubeStreamType,

nIndex as Int32,

strDestinationPath as String,

strDestinationFilename as String,

ByRef nDownloadUniqueId as Int32

) as enumErrorCodes


 

[C#]

public enumErrorCodes VideoSearchByIDDownloadStreamToFile (

enumYoutubeStreamType nType,

int nIndex,

string strDestinationPath,

string strDestinationFilename,

ref Int32 nDownloadUniqueId

);


 

[C++]

public: enumErrorCodes VideoSearchByIDDownloadStreamToFile (

enumYoutubeStreamType nType,

int nIndex,

string strDestinationPath,

string strDestinationFilename,

Int32 __gc *nDownloadUniqueId

);


 

 

Parameter

Description

 

 

nType

Type of stream.

Supported values are the following:

Mnemonic Value

Value

Meaning

YOUTUBE_STREAM_TYPE_MUXED

0

Muxed stream (Video + Audio)

YOUTUBE_STREAM_TYPE_VIDEO_ONLY

1

Video only stream

YOUTUBE_STREAM_TYPE_AUDIO_ONLY

2

Audio only stream

nIndex

Zero-based index of the stream. The maximum number of available streams can be obtained through the Youtube.VideoSearchByIDStreamCountGet method.

strDestinationPath

String containing the path on the local system where the downloaded file will be stored: the path must not contain the filename which is specified inside the strDestinationFilename parameter.

strDestinationFilename

Filename assigned to the destination file..

nDownloadUniqueId

Reference that, after returning from the method call, will contain the unique identifier of the download session: this identifier may be passed to the Youtube.VideoSearchByIDDownloadStop method when the download session must be stopped by the user.

 

 

Return value

 

Value

Meaning

 

 

Negative value

An error occurred, check the LastError property value in order to get the error code

enumErrorCodes.ERR_NOERROR (0)

The method call was successful