Documentation
v0.5.0
iOSAndroidJavaScript

Video Querying Guide

VKVideoStore is Where it All Starts

To access all videos in the library, we have a class called VKVideoStore that allows you to query all your videos.

To access anything in the video store you must have a session in place by calling VKAccount.current.startSession().

You must ensure the connection state is VKAccountState.connected. This can be checked through VKAccount.current.accountState.

Making a Query

To make a query you use the VKVideoStore.shared.getVideos() call. There you will be returned a VKVideoPlaylist in the completion block.

Queries are made using tags and metadata. Here are some example queries.

Get all videos:

VKVideoStore.shared.getVideos(withTags: [], withMetadata: [:]) { (list : VKVideoPlaylist?, err : Error?) in
    if (err != nil) {
        // Handle error
    }
    else {
        // Video results is contained in 'list'
    }
}

Get videos with tags only:

VKVideoStore.shared.getVideos(withTags: ["birthday", "outdoor"], withMetadata: [:]) { (list : VKVideoPlaylist?, err : Error?) in
    if (err != nil) {
        // Handle error
    }
    else {
        // Video results is contained in 'list'
    }
}

Get videos with metadata only:

VKVideoStore.shared.getVideos(withTags: [], withMetadata: ["group" : "private", "selected" : "true"]) { (list : VKVideoPlaylist?, err : Error?) in
    if (err != nil) {
        // Handle error
    }
    else {
        // Video results is contained in 'list'
    }
}

Get videos with metadata and tags:

VKVideoStore.shared.getVideos(withTags: ["birthday", "outdoor"], withMetadata: ["group" : "private", "selected" : "true"]) { (list: VKVideoPlaylist?, err: Error?) in
    if (err != nil) {
        // Handle error
    }
    else {
        // Video results is contained in 'list'
    }
}

For more information about the framework, please head to the API Reference site.