iOS Question Porting Class Youtube from B4A to B4i

Discussion in 'iOS Questions' started by MarcoRome, Jan 13, 2018.

  1. MarcoRome

    MarcoRome Expert Licensed User

    I would like to make available the Youtube V3 class of the existing library currently in B4a (Library YouTube V3) in order to have a compatible class (B4X) for B4A / B4i.
    The class works perfectly in the B4A environment but in B4i I have the following error:

    The code is:

    Code:
    'Class module
    Private Sub Class_Globals
     
       ....
         
        
    Type SearchVideo( _
           publishedAt(
    100As String, title(100As String, description(100As String, _
          urlpicture(
    100As String, urldefaultpicture(100As String, urlmediumpicture(100As String, idVideo(100As String, totalResults As Int, TotalChannel As Int, _
          nextpage(
    100As String, prevpage(100As String )

    ......

        
    Private SVideo As SearchVideo
     
    End Sub

    Public Sub SearchVideo(maxresult As Int, search As String, order As String, regionCode As String, videoDuration As String, Module As Object, EventName As String )
      
        
    Dim su As StringUtils
        search = su.EncodeUrl(search, 
    "UTF8")
      
        SVideo.Initialize  
    '<----- THE ERROR IS HERE
        If order = "" Then
            order = 
    "relevance"
        
    End If
        
    If videoDuration = "" Then
            videoDuration = 
    "any"
        
    End If
        
    If regionCode = "" Then
            
    Dim job1 As HttpJob
            job1.Initialize(
    "searchvideo1", Me)
            job1.Download(
    "https://www.googleapis.com/youtube/v3/search?part=id,snippet&order="& order &"&maxResults="& maxresult &"&videoDuration="& videoDuration &"&q="& search &"&key=" & keyvalue)
        
    Else
            
    Dim job1 As HttpJob
            job1.Initialize(
    "searchvideo1", Me)
            job1.Download(
    "https://www.googleapis.com/youtube/v3/search?part=id,snippet&order="& order &"&maxResults="& maxresult &"&videoDuration="& videoDuration &"&regionCode="& regionCode &"&q="& search &"&key=" & keyvalue)
        
    End If
    '    Dim job1 As HttpJob
        '    job1.Initialize("search", Me)
    '    job1.Download("https://www.googleapis.com/youtube/v3/search?part=id,snippet&maxResults="& maxresult &"&q="& search &"&key=" & keyvalue)
        'job1.GetRequest.SetHeader("Accept", "application/json")
        MN = Module
        EN = EventName
    End Sub
    upload_2018-1-13_9-47-59.png

    Simply when i initialize
    Any help ?
    Thank you
    Marco
     
  2. narek adonts

    narek adonts Well-Known Member Licensed User

    Try to change the sub name or the type name.

    And I dont think that you are obligated ti initialize a type
     
    MarcoRome likes this.
  3. MarcoRome

    MarcoRome Expert Licensed User

    No, unfortunately the result does not change
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    Can you upload the project?
     
  5. MarcoRome

    MarcoRome Expert Licensed User

    Done
     
  6. MarcoRome

    MarcoRome Expert Licensed User

    if i send this address support@b4x.com back to me.
    Is it right ?
     
  7. MarcoRome

    MarcoRome Expert Licensed User

  8. Erel

    Erel Administrator Staff Member Licensed User

    The error happens because of the 'description' field in the custom types. It conflicts with the built-in description method. All objects include this method. I will add a compiler check for this.
     
    MarcoRome likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice