Copyright © 2005-2023 MultiMedia Soft

Youtube.VideoSearchByIDDownloadStreamToPlayer 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, once the download is completed, automatically loads it into the given player.

 

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 YoutubeMan class.

 

 

Syntax

 

[Visual Basic]

Public Function VideoSearchByIDDownloadStreamToPlayer (

nPlayerIndex as Int16,

nMediaType as enumMediaTypes,

nType as enumYoutubeStreamType,

nIndex as Int32,

ByRef nDownloadUniqueId as Int32

) as enumErrorCodes


 

[C#]

public enumErrorCodes VideoSearchByIDDownloadStreamToPlayer (

Int16 nPlayerIndex,

enumMediaTypes nMediaType,

enumYoutubeStreamType nType,

int nIndex,

ref Int32 nDownloadUniqueId

);


 

[C++]

public: enumErrorCodes VideoSearchByIDDownloadStreamToPlayer (

Int16 nPlayerIndex,

enumMediaTypes nMediaType,

enumYoutubeStreamType nType,

int nIndex,

Int32 __gc  *nDownloadUniqueId

);


 

 

Parameter

Description

 

 

nPlayerIndex

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

nMediaType

Media type.

Supported values are the following:

Mnemonic constant

Value

Meaning

MEDIA_TYPE_AUDIO

0

The requested media is an audio file.

MEDIA_TYPE_VIDEO

1

The requested media is a video file.

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.

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