Global Notifications
On top of reactive publishers exposed by some components, VideoKit offers a variety of global notifications sent through NSNotification that give you the flexibility to react on certain events.
You can subscribe through the notification center:
NotificationCenter.default.addObserver(self, selector: #selector(self.notificationHandler(_:)), name: .<NotificationName>, object: nil)
In the snipped above, NotificationName
can be any of the following:
.VKVideoCreated
Sent when a new video is created. The notification.userInfo
payload will be filled with:
[
id: String,
video: Video
]
.VKVideoUpdated
Sent when an existing video is updated. The notification.userInfo
payload will be filled with:
[
id: String,
changes: [String:Any]
]
.VKVideoDeleted
Sent when an existing video is deleted. The notification.userInfo
payload will be filled with:
[
id: String
]
.VKSessionStateChanged
Sent when the session state changes. The notification.userInfo
payload will be filled with:
[
state: SessionManager.State
]
.VKVideoUploadStarted
Sent when the upload of a certain video starts. The notification.userInfo
payload will be filled with:
[
id: String, // video/upload ID
upload: Upload
]
.VKVideoUploadProgress
Sent when the upload of a certain video has made new progress. The notification.userInfo
payload will be filled with:
[
id: String, // video/upload ID
upload: Upload
]
.VKVideoUploadCanceled, .VKVideoUploadFailed, .VKVideoUploadComplete
Sent when the upload of a certain video finishes (either with success, failure or cancelled state).
The notification.userInfo
payload will be filled with:
[
id: String, // video/upload ID
error: Error?
]
.VKVideoUploadsChanged
Sent when any of the currently active uploads changes. The notification.userInfo
payload will be filled with:
[
uploads: [Upload]
]
.VKStreamCreated
Sent when a new stream is created. The notification.userInfo
payload will be filled with:
[
id: String,
stream: Stream
]
.VKStreamDeleted
Sent when an existing stream is deleted. The notification.userInfo
payload will be filled with:
[
id: String
]
.VKPlaylistUpdated
Sent when the content of any of the active playlists changes. The notification.userInfo
payload will be filled with:
[
playlist: Playlist,
videos: [Video]
]
.VKVideoPlaybackFailed
Sent when the playback of a certain video fails. The notification.userInfo
payload will be filled with:
[
id: String, // video id
error: Error
]