Copyright © 2001-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 will fire the following sequence of events:

- the DownloaderSessionStarted event

- a sequence of DownloaderSessionProgress events informing about the download advancement in percentage

- the DownloaderSessionCompleted event

 

In case the connection to the remote server or the access to the remote file should fail, the DownloaderSessionFailed would be invoked.

 

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 Youtube object section.

 

 

Syntax

 

[Visual Basic]

control.Youtube.VideoSearchByIDDownloadStreamToFile (

nType as enumYoutubeStreamType,

nIndex as Integer,

strDestinationPath as String,

strDestinationFilename as String,

ByRef nDownloadUniqueId as Long

) as Long


 

[C++]

long control.Youtube.VideoSearchByIDDownloadStreamToFile (

short nType,

short nIndex,

LPCTSTR strDestinationPath,

LPCTSTR strDestinationFilename,

long *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