Cara Fix Error Code VB “Too many arguments to ‘Public Overridable Function Insert?

Cara Fix Error Code VB “Too many arguments to ‘Public Overridable Function Insert(body As Google.Apis.YouTube.v3.Data.Video, part As String) As Google.Apis.YouTube.v3.VideosResource.InsertRequest‘”

Ini Fungsi yang error”

Private Async Function ExecuteUploadProcess() As Task

Const minimumChunkSize As Integer = 256 * 1024 ' .25MB (256K)

Const HalfMBChunkSize As Integer = minimumChunkSize * 2 ' .5MB (512K)

Dim objYouTubeService As YouTubeService = Nothing

Dim bOK As Boolean = False

Dim strWhichUpload As String = "UploadAsync"


objYouTubeService = New YouTubeService(New BaseClientService.Initializer() With { _

.HttpClientInitializer = OAUth2Credential, _

.GZipEnabled = True, _

.ApplicationName = Assembly.GetExecutingAssembly().GetName().Name})


' Default Timeout is 1 minute 40 seconds.

' The following changes it to 3 minutes. Some developers use as much as 10 minutes for the timeout.

objYouTubeService.HttpClient.Timeout = TimeSpan.FromMinutes(HTTP_CLIENT_TIMEOUT_MINUTES)

bOK = True

AddToLog("objYouTubeService initialized")

Catch ex As Exception

AddToLog(String.Concat("YouTubeService error: ", ex.Message))

End Try
If bOK Then

Dim objVideo As Video = New Video()

With objVideo

.Snippet = New VideoSnippet With _

{.Title = txtTitle.Text, _

.Description = txtDescription.Text, _

.Tags = txtKeywords.Text.Split(CChar(",")), _

.CategoryId = DirectCast(cmbCategory.SelectedItem, CategoryClass).ID}

.Status = New Google.Apis.YouTube.v3.Data.VideoStatus With _

{.Embeddable = True, _

.PrivacyStatus = cmbPrivacyStatus.SelectedItem.ToString} 'Note: PrivacyStatus must be all lowercase

.RecordingDetails = New VideoRecordingDetails With _

{.Location = New GeoPoint With {.Latitude = My.Settings.Latitude, .Longitude = My.Settings.Longitude, .Altitude = 0}, _

.LocationDescription = My.Settings.LocationDescription, _

.RecordingDate = CDate(txtDateRecorded.Text)}

End With

Dim strFilePath As String = txtFilename.Text

lngFileLength = New FileInfo(strFilePath).Length

AddToLog("objVideo initialized")

objExponentialBackoff = New ExponentialBackOff

dblProgressPercent = 0.0

bResumeUpload = False


Using objFileStream As FileStream = New FileStream(strFilePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)
AddToLog("FileStream opened")

videoInsertRequest = objYouTubeService.Videos.Insert(objVideo, "snippet,status,recordingDetails", objFileStream, "video/*")

AddToLog("VideosInsertRequest initialized")
videoInsertRequest.ChunkSize = HalfMBChunkSize ' .5MB

AddToLog("ChunkSize initialized")
AddHandler videoInsertRequest.ResponseReceived, AddressOf videosInsertRequest_ResponseReceived

AddHandler videoInsertRequest.ProgressChanged, AddressOf videosInsertRequest_ProgressChanged

' The following line is only required if your application will support resuming upon a program restart

AddHandler videoInsertRequest.UploadSessionData, AddressOf VideoInsertRequest_UploadSessionData

AddToLog("Event Handlers initialized")
CancellationToken = New System.Threading.CancellationToken

intResumeRetries = 0

AddToLog("Begin: UploadAsync")


' Check if previous upload program was terminated and, if so, prompt to resume prior upload

Dim uploadUri As Uri = GetSessionRestartUri()

If uploadUri = Nothing Then

Await VideoInsertRequest.UploadAsync(CancellationToken)


AddToLog("Restarting prior upload session.")

Await VideoInsertRequest.ResumeAsync(uploadUri, CancellationToken)

End If


' Error handling is done in videosInsertRequest_ProgressChanged() Event

End Try

AddToLog("End: UploadAsync")


Dim bAResumeAsyncWasLaunched As Boolean


Thread.Sleep(3000) ' Allow time for ProgressChanged() Event to execute and to allow time for server or network issue to resolve

bAResumeAsyncWasLaunched = False


If bResumeUpload Then

' Try a ResumeAsync

intResumeRetries += 1

Thread.Sleep(objExponentialBackoff.GetNextBackOff(intResumeRetries).Milliseconds) ' This is not really needed!

strWhichUpload = "ResumeAsync"

AddToLog("Begin: ResumeAsync")

bResumeUpload = False

bAResumeAsyncWasLaunched = True


Await videoInsertRequest.ResumeAsync(CancellationToken)


' Error handling is done in videosInsertRequest_ProgressChanged() Event

End Try

AddToLog("End: ResumeAsync")



bAResumeAsyncWasLaunched = False

End If


' Either it was successful or it failed and is not resumeable



Loop While bAResumeAsyncWasLaunched AndAlso IsResumable() ' True when a .ResumeAsync method has been called



Catch ex As Exception

MsgBox(ex.Message, MsgBoxStyle.Critical, "Close File")

End Try

End Using

Catch ex As Exception

AddToLog(String.Concat(strWhichUpload, " error: ", ex.Message))

End Try

End If

End Function

Dan Yang muncul error di line 89

videoInsertRequest = objYouTubeService.Videos.Insert(objVideo, "snippet,status,recordingDetails", objFileStream, "video/*")

objFileStream, "video/*" "

Tolong di bantu dong 🙂

SMP Ditanyakan on 3 September 2016 pada Proggraming.
Tambah Komentar
1 Jawaban

Kalau dari errornya itu karena ada parameter yang lebih yang dimasuikkan ke fungsi Videos.Insert dari APInya YoutubeService, coba cek di web resminya gan cara gunakan API dari youtube.

Megister Terjawab on 5 September 2016

Iya gan,tapi saya ingin coba modif,,kira2 yang over yang mana…?
kasih petunjuknya 🙂

on 6 September 2016.
Tambah Komentar
  • Jawaban Anda

    Dengan memposting jawaban, anda setuju dengan Kebijakan Privasi dan ketentuan layanan.