• Integration of Roku with Vimeo to enable Vimeo video hosting.

    Roku application often uses video hosting in order to give an easy management of videos provided with the various features that Vimeo provide to integrate videos with Roku application.

    Vimeo services come with various plans depending upon the features like the amount of data permitted every year, a number of users permitted to use the account etc , required by the user to host his videos.

    Here we will discuss look at the code required to integrate your application with Vimeo account.

    1. After successfully choosing a plan, our step is to create an app that will provide us with the necessary credentials to be used within the code. The link for creating an app in Vimeo is:

    2. Completing the details for the app, the credential that is required is "Access Token".

    3. This token will be required to call the APIs of the Vimeo to get the JSON data of the videos.

    4. The videos will be saved in the form of albums in Vimeo account. Now the API to get the JSON of the albums' data is "". Following is the implementation of the code.

    sub showChannelSGScreen()
     mainUrl = ""
     urlOfAllAlbum = mainUrl + "/albums"
        jsonValue = getDataFromUrl(urlOfAllAlbum.trim())
        list = []
        for each albumItem in
                albumName =
                eachVideoUrl = mainUrl + albumItem.metadata.connections.videos.uri
                jsonOfEachVideo = getDataFromUrl(eachVideoUrl.trim())
                videosItem = []
                for each videoData in
                    item = {}
                    item.EpisodeNumber = Right(videoData.uri, 9)
                    item.title =
                    item.description = videoData.description
                    item.SDPosterUrl =[0].link
                    item.HDPosterUrl =[3].link
                    ' here a medium size picture taken , we can choose from 7 different sizes
                    if videoData.duration <> invalid
                        item.Length = videoData.duration
                        item.Length = 120
                    end if
                    item.hdBackgroundImageUrl =
                    if item <> invalid then
                        ? "error in pushin item in videosItem"
                    end if
                end for
                list.push({ Title: albumName
                ContentList: videosItem })
        end for 
    end sub
    function getDataFromUrl(url as String) as Object
        request = CreateObject("roUrlTransfer")
        port = CreateObject("roMessagePort")
        request.addHeader("Authorization", "bearer f11832710cff860ae2dfwfw32dssn9223dss")
        if (request.AsyncGetToString())
            while (true)
                msg = Wait(0, port)
                if (Type(msg) = "roUrlEvent")
                    code = msg.GetResponseCode()
                    if (code = 200)
                        ' playlist = CreateObject("roArray", 10, true)
                        jsonValue = ParseJson(msg.GetString())
                        return jsonValue
                        ? "code is other than 200"
                    end if
                else if (event = invalid)
                    ? "REQUEST CANCELLED"
                end if
            end while
        end if
        return invalid
    end function 

    5. Then this data can be inserted into a content node in order to show them into any grid screen. 6. For example, a grid screen could be of a type where we can show consecutive images with various details like description, poster etc as retrieved above. In this way, we can integrate videos on the Vimeo account.

    Hope this will help !!

Tags: roku