Documentation
v0.5.0
iOSAndroidJavaScript
Objective-C
Swift

Classes

VKAccount
Expand all / Collapse all

This class provides access to the account.

Static Properties

currentVKAccountVKAccount
Current app reference. Use it to manage VKit session and observe VKit state.

Properties

appSecretTokenStringNSString
The App secret token is assigned to you by V.
authTokenStringNSString
The Auth token that is assigned to you by V.
secureModeEnabledBoolBOOL
Allows client to start session using appSecretToken. Be careful only for testing purposes.
appIDStringNSString
The application id that is assigned to you by V.
accountStateVKAccountState
This describes the current account state of the session. A VKNotificationConstants.AccountStateChanged is sent when state are changed.
errorNSErrorNSError
This is the error that may have occured while trying to start a session. This is not nil if accountState == .Disconnected

Methods

func startSession- (void)startSession
Starts the session. You could check on the state of session via accountState. Ensure devToken and appID are filled.
Copy
public typealias VKAccountCompletionBlock = (accountState: VKAccountState, err: NSError?) -> Void
- (void)startSession:(void (^ _Nullable)(enum VKAccountState accountState, NSError * _Nullable err))completion
Arguments
completion

VKAccountCompletionBlock(^)(enum VKAccountState accountState, NSError * _Nullable err) *required

Account completions block
func stopSession- (void)stopSession
Stops the session. You could check on the state of the session via accountState.
Copy
public func stopSession()
- (void)stopSession

VKVideoStore
Expand all / Collapse all

This is a video store class that contains all your repository of videos. Use this class to query and delete videos. Do not make an instance as everything in this class are class properties and class methods.

Static Properties

sharedVKVideoStoreVKVideoStore
Video store shared instance.

Methods

class func getVideos- (void)getVideos
Starts the session. You could check on the state of session via accountState. Ensure devToken and appID are filled.
Copy
public func getVideos(withTags tags: Set, withMetadata metadata: [String : String], completion: VKPlaylistRequestBlock)
- (void)getVideosWithTags:(NSSet * _Nonnull)tags withMetadata:(NSDictionary * _Nonnull)metadata withOrder:(BOOL)order completion:(void (^)(VKVideoPlaylist *, NSError *))completion
Arguments
tags

SetNSSet *required

This is a set of string tags to search for. Must not be nil but could be empty.
metadata

[String : String]NSDictionary *required

This is a set of string tags to search for. Must not be nil but could be empty.
order

BoolBOOL *required

This is a bool value indicates the order of sorting videos in playlist. Default - true.
completion

VKPlaylistRequestBlock(^)(VKVideoPlaylist * _Nullable, NSError * _Nullable) *required

This is the completion block to be called when the playlist is returned. If the call was successful then a VKVideoPlaylist is returned. Else nil is returned with an error included.
class func removeVideo- (void)removeVideo
Video to remove from the store.
Copy
public func removeVideo(video: VKVideoObject)
- (void)removeVideo:(VKVideoObject * _Nonnull)video
Arguments
video

VKVideoObject *required

The video object that you wish to remove.

VKVideoPlaylist
Expand all / Collapse all

This class represents a playlist of videos.

Properties

tagsSetNSSet
The tags that defines this playlist
metadata[String : String]NSDictionary
The metadata that defines this playlist.
countIntNSInteger
The total number of videos that's in this playlist. This property can be observed through KVO.

Methods

func itemAtIndex- (void)itemAtIndex
Gets the video object at index
Copy
public func itemAtIndex(index: Int, completion: VKVideoItemCompletionBlock)
- (void)itemAtIndex:(NSInteger)index completion:(void (^ _Nonnull)(VKVideoObject * _Nullable item))completion
Arguments
index

IntNSInteger *required

The index item to request.
completion

VKVideoItemCompletionBlock(^)(VKVideoObject * _Nullable item) *required

the completion block to be called when the call is returned. If item exists then item will not be nil. Else item is nil.
func sync- (void)sync
Sync server changes of playlist to client.
Copy
public func sync(completion: @escaping (_ success: Bool) -> Void)
- (void)syncWithCompletion: (void (^)(BOOL))completion
Arguments
completion

(_ success: Bool) -> Void(^)(BOOL success) *required

the completion block to be called sync finished, passed success to param.

VKVideoObject
Expand all / Collapse all

This class represents a playlist of videos.

Properties

tagsSetNSSet
The tags that describes this video.
metadata[String : String]NSDictionary
The metadata that describes this video.
shareURLNSURL
The shareable url of this video.
videoIDStringNSString
The unique ID identifying this video.
locationCLLocation
The geolocation to which this video was taken.
creationDateNSDate
The creation date of this video.
modifyDateNSDate
The modified date of this video.
titleStringNSString
The title of this video.
videoDescriptionStringNSString
The description of this video.
thumbnailImageURLNSURL
The thumbnail image URL for this video.
durationNSTimeInterval
The length of this video in seconds.

Views

VKPlayerViewController
Expand all / Collapse all

Standard player view controller to which you play videos from V.

Properties

delegateVKPlayerViewProtocol
TThe delegate for which the player would call.
showControlsBoolBOOL
Enable the showing of controls. Default value is true to show controls.
currentPlaylistVKVideoPlaylist
Indicates the current playlist of the player. This property is read only and can be observed via KVO.
currentVideoVKVideoObject
Indicates the current state of the player. This property is read only and can be observed via KVO.
currentIndexIntNSInteger
Indicates the current state of the player. This property is read only and can be observed via KVO.
playStateVKPlayState
Indicates the current state of the player. This property is read only and can be observed via KVO.
currentPositionNSTimeInterval
Indicates the current time position of the player. This property is read only and can be observed via KVO.
durationNSTimeInterval
The duration of the current playing item. If there's no item to be played the value is 0.
aspectModeVKAspectMode
The current aspect mode the player is in.

Methods

func playVideo- (void)playVideo
Play the video object.
Copy
public func playVideo(video: VKVideoObject)
- (void)playVideo:(VKVideoObject * _Nonnull)video
Arguments
video

VKVideoObject *required

The video object to be played.
func playVideo- (void)playVideo
Play the video playlist object.
Copy
open func playVideo(_ playlist: VKVideoPlaylist, index: Int)
- (void)playVideo:(VKVideoPlaylist * _Nonnull)playlist index:(NSInteger)index;
Arguments
playlist

VKVideoPlaylist *required

The playlist object that you want to play.
index

IntNSInteger *required

The index position that you would want to play withing the playlist.
func play- (void)play
Play the current item.
Copy
public func play()
- (void)play
func pause- (void)pause
Pause the current item.
Copy
public func pause()
- (void)pause
func seekToPosition- (void)seekToPosition
Move the current play position to a different time position.
Copy
public func seekToPosition(time: NSTimeInterval)
- (void)seekToPosition:(NSTimeInterval)time
Arguments
time

NSTimeInterval *required

The time position to move to.

VKRecorderViewController
Expand all / Collapse all

Recorder view controller that provides a facility to record video to be stored on V.
It works in 2 ways, with standart HUD (set showHUD to true(default value), the easiest way to utilize recorder) and with capture view only(set showHUD to false, advanced recording, you can add custom controls as you wish).
You can set showHUD property only and only if recordState is ready.
Preview feature is not available in case of hud is hidden, but you can implement it on your side.
Subscribe VKNotificationConstants.VideoIsRecordered notification, it contains local recordered video files, you can use it to built your preview control.
Finally make sure that either recorder.confirmRecordnig() or recorder.cancelRecordnig() is called when you don't need video file anymore.
Recorder support scanning qr data which should be instance of [String : Any] class. QR code should contains tags, metadata, title, appId keys. QR code scanning feature could be disabled by setting property qrScanningEnabled to false.
QR code tags key represents tags of newly created video object. See property tags. Type - [String].
QR code metadata key represents metadata of newly created video object. See property metadata. Type - [String : String].
QR code title key represents title can be seen at the upper part of recorder. See property recorderTitle. Attention, it doesn't affect recorderd video object. Type - String.
QR code appId key indicates app videos should relate to. If value of appId differs from VKAccount.appID that QR code will be ignored. Type - String.

Properties

delegateVKRecorderViewProtocol
The delegate to be called by the recorder.
captureTypeVKCaptureType
Indicates the capture device that it will record from.
currentVideoObjectVKVideoObject
The video object of the recording.
metadata[String : String]
Metadata of newly created video.
tags[String]
Tags of newly created video.
recorderTitleString
Recorder title. Could be changed by scanning QR, `title` key. KVO observable.
showHUDBool
Indicates whether standart UI will be shown or not. Can be set only when recordState == .ready.
zoomFactorFloat
Current device zoom factor.
qrScanningEnabledBool
Indicates should recorder support scanning QR code.
torchEnabledBool
Indicates whether torch is enabled now.
torchAvailableBool
Indicates whether torch can is enabled now. KVO observable.
recordStateVKRecordState
The current state of the of the recorder.
recordCaptureRatioVKRecordCaptureRatio
The current aspect mode the player is in.

Methods

func startRecording- (void)startRecording
Start recording video or continues if paused.
Copy
public func startRecording()
- (void)startRecording
func completeRecording- (void)completeRecording
Complete the recording. Can only be called after recordState becomes is `recording`.
Copy
public func completeRecording()
- (void)completeRecording
func confirmRecordnig- (void)confirmRecordnig
Confirms recording, publishes it. After `confirmRecordnig` is called, video becomes available to other users. Should be called after `finishRecording` is called and before new recording had been started.
Copy
public func confirmRecordnig()
- (void)confirmRecordnig
func pauseRecording- (void)pauseRecording
Pause the current recording. Can only be called after recordState becomes is `recording`.
Copy
public func pauseRecording()
- (void)pauseRecording

Protocols

VKPlayerViewProtocol
Expand all / Collapse all

A set of delegate to be called from VKPlayerViewController

Methods

func vkPlayerViewControllerDidFinish- (void)vkPlayerViewControllerDidFinish
Play the video object.
Copy
optional func vkPlayerViewControllerDidFinish(_ player: VKPlayerViewController)
- (void)vkPlayerViewControllerDidFinish:(VKPlayerViewController * _Nonnull)player
Arguments
player

VKPlayerViewController *required

Called when the player has finished playing the video.
func vkPlayerViewControllerBuffering- (void)vkPlayerViewControllerBuffering
Called when the player is buffering.
Copy
optional func vkPlayerViewControllerBuffering(_ player: VKPlayerViewController, buffering: Bool)
- (void)vkPlayerViewControllerBuffering:(VKPlayerViewController * _Nonnull)player buffering:(BOOL)buffering
Arguments
player

VKPlayerViewController *required

Called when the player has finished playing the video.
buffering

BoolBOOL *required

If the value is true then the player is buffering. However, when the player finishes buffering the delegate is called again with the value being false.
func vkPlayerViewControllerReadyToPlay- (void)vkPlayerViewControllerReadyToPlay
Play the video object.
Copy
optional func vkPlayerViewControllerReadyToPlay(_ player: VKPlayerViewController)
- (void)vkPlayerViewControllerReadyToPlay:(VKPlayerViewController * _Nonnull)player
Arguments
player

VKPlayerViewController *required

Called when the player has finished playing the video.
func vkPlayerViewControllerFailedToPlay- (void)vkPlayerViewControllerFailedToPlay
Called when player tried to play an item but fails.
Copy
optional func vkPlayerViewControllerFailedToPlay(_ player: VKPlayerViewController)
- (void)vkPlayerViewControllerFailedToPlay:(VKPlayerViewController * _Nonnull)player
Arguments
player

VKPlayerViewController *required

Called when the player has finished playing the video.

VKRecorderViewProtocol
Expand all / Collapse all

Delegate protocol for VKRecorderViewController to call.

Methods

func vkRecorderViewFinishedRecording- (void)vkRecorderViewFinishedRecording
Called when the recorder is finished recording.
Copy
optional func vkRecorderViewFinishedRecording(_ recorder: VKRecorderViewController, video: VKVideoObject))
- (void)vkRecorderViewFinishedRecording:(VKRecorderViewController * _Nonnull)recorder video:(VKVideoObject *)video
Arguments
recorder

VKRecorderViewController *required

The recorder which called this method.
func vkRecorderViewCanceled- (void)vkRecorderViewCanceled
Called when recorder view canceled the recording.
Copy
optional func vkRecorderViewCanceled(_ recorder: VKRecorderViewController)
- (void)vkRecorderViewCanceled:(VKRecorderViewController * _Nonnull)recorder
Arguments
recorder

VKRecorderViewController *required

The recorder which called this method.
func vkRecorderViewError- (void)vkRecorderViewError
Called when recorder encounters an error.
Copy
optional func vkRecorderViewError(_ recorder: VKRecorderViewController, withError error: NSError)
- (void)vkRecorderViewError:(VKRecorderViewController * _Nonnull)recorder withError:(NSError * _Nonnull)error
Arguments
recorder

VKRecorderViewController *required

The recorder which called this method.
error

NSError *required

The error produced from the recorder.

Enums

VKAccountState
Expand all / Collapse all

Current account state.

Values

connectedVKAccountStateConnected
The session has started.
connectingVKAccountStateConnecting
Connecting to server
disconnectedVKAccountStateDisconnected
Session has stopped
errorVKAccountStateError
There was an error trying to connect to server. You should check VKAccount.error to see the description of the error

VKPlayState
Expand all / Collapse all

Indicates the differnt play state.

Values

unknownVKPlayStateUnknown
This is an unknown undefined state.
pauseVKPlayStatePause
Pause state.
playingVKPlayStatePlaying
Playing state.

VKAspectMode
Expand all / Collapse all

Indicates the different aspect mode.

Values

resizeAspectVKAspectModeResizeAspect
The aspect ratio is respected and the entire frame could be seen.
resizeAspectFillVKAspectModeResizeAspectFill
The aspect ratio is respected but the frame would fill the entire view.
resizeVKAspectModeResize
The aspect ratio is not respected but the entire frame would fill the view.

VKCaptureType
Expand all / Collapse all

Indicates the cature device.

Values

frontVKCaptureTypeFront
The front camera.
backVKCaptureTypeBack
The back camera.
audioOnlyVKCaptureTypeAudioOnly
Audio only.

VKRecordState
Expand all / Collapse all

Indicate the current state of the recorder.

Values

readyVKRecordStateReady
Ready to record.
recordingVKRecordStateRecording
Recording video.
previewingVKRecordStatePreviewing
Preview mode of what was recorded.

VKRecordCaptureRatio
Expand all / Collapse all

The frame capture ratio.

Values

squareVKRecordCaptureRatioSquare
Square ratio.
widescreenVKRecordCaptureRatioWidescreen
Wide 16:9 format.

Constants

Notifications
Expand all / Collapse all

Notifications that comes from VKit

Values

VKNotificationConstants.AccountStateChangedVKNotificationConstants.AccountStateChanged
The account state has changed.
VKNotificationConstants.VideoIsUploadedVKNotificationConstants.VideoIsUploaded
Video is uploaded.
VKNotificationConstants.VideoIsConfirmedVKNotificationConstants.VideoIsConfirmed
Video is confirmed.
VKNotificationConstants.PlaylistUpdatedVKNotificationConstants.PlaylistUpdated
Playlist has been changed.
VKNotificationConstants.NotificationArrivedVKNotificationConstants.NotificationArrived
Notification arrived.
VKNotificationConstants.PlayerUpdatedVKNotificationConstants.PlayerUpdated
Player updated according playlist update.
VKNotificationConstants.VideoDataCachingFinishedVKNotificationConstants.VideoDataCachingFinished
Video data caching finished.