To receive video playback events, conform to the Protocol FireworkVideoPlaybackDelegate, see file FireworkVideoPlaybackDelegate.swift. You could assign a delegate as follows:
FireworkVideoSDK.eventTracking.videoPlaybackDelegate =// Object to receive video playback events
List of video playback events:
/// Called when a video appears on the screen but the video playback has not started/// - Parameter videoPlayback: The details of the video playbackfuncfireworkVideoDidRecordImpression(_videoPlayback: VideoPlaybackDetails)/// Called when a video has paused playback/// - Parameter videoPlayback: The details of the video playbackfuncfireworkVideoDidPause(_videoPlayback: VideoPlaybackDetails)/// Called when a video has resumed playback/// - Parameter videoPlayback: The details of the video playbackfuncfireworkVideoDidResume(_videoPlayback: VideoPlaybackDetails)/// Called when a video has started playing/// - Parameter videoPlayback: The details of the video playbackfuncfireworkVideoDidStartPlaying(_videoPlayback: VideoPlaybackDetails)/// Called when the first quarter of the video has been played/// - Parameter videoPlayback: The details of the video playbackfuncfireworkVideoReachedFirstQuartile(_videoPlayback: VideoPlaybackDetails)/// Called when the first half of the video has been played/// - Parameter videoPlayback: The details of the video playbackfuncfireworkVideoReachedMidPoint(_videoPlayback: VideoPlaybackDetails)/// Called when the third quarter of the video has been played/// - Parameter videoPlayback: The details of the video playbackfuncfireworkVideoReachedThirdQuartile(_videoPlayback: VideoPlaybackDetails)/// Called when the video reaches end of playback./// - Parameter videoPlayback: The details of the video playbackfuncfireworkVideoDidFinishPlaying(_videoPlayback: VideoPlaybackDetails)/// Called when the user has tapped on the CTA button that appeared during the video playbackfuncfireworkVideoDidTapCTAButton(_videoPlayback: VideoPlaybackDetails)/// Called when the user has tapped on the share button that appeared during the video playbackfuncfireworkVideoDidTapShareButton(_videoPlayback: VideoPlaybackDetails)/// Called when an ad video has started playing/// - Parameter videoPlayback: The details of the video playbackfuncfireworkVideoDidStartPlayingAd(_videoPlayback: VideoPlaybackDetails)/// Called when the ad video reaches end of playback./// - Parameter videoPlayback: The details of the video playbackfuncfireworkVideoDidFinishPlayingAd(_videoPlayback: VideoPlaybackDetails)/// Called when the video is muted./// - Parameter videoPlayback: The details of the video playbackfuncfireworkVideoDidMute(_videoPlayback: VideoPlaybackDetails)/// Called when the video is unmuted./// - Parameter videoPlayback: The details of the video playbackfuncfireworkVideoDidUnmute(_videoPlayback: VideoPlaybackDetails)/// Called when the user closes or skips to the other video manually./// - Parameter videoPlayback: The details of the video playbackfuncfireworkVideoDidClose(_videoPlayback: VideoPlaybackDetails)/// Called when the video is automatically paused./// - Parameter videoPlayback: The details of the video playbackfuncfireworkVideoDidAutomaticallyPause(_videoPlayback: VideoPlaybackDetails)/// Called when the video is automatically resumed./// - Parameter videoPlayback: The details of the video playbackfuncfireworkVideoDidAutomaticallyResume(_videoPlayback: VideoPlaybackDetails)
Feed event callbacks
To receive feed related events, conform to the Protocol FireworkVideoFeedDelegate, see file FireworkVideoFeedDelegate.swift. You could assign a delegate as follows:
FireworkVideoSDK.eventTracking.feedDelegate =// Object to receive feed events
List of feed events:
/// Called when the a video thumbnail is tapped by the user/// - Parameter eventDetails: The details of the feed eventfuncfireworkVideoDidTapThumbnail(_eventDetails: FeedEventDetails)
Live stream event callbacks
Live stream events can be observed by assigning a receiver as the FireworkLiveStreamEventDelegate. This will provide different methods that will be invoked at the time of each event.
// Assign a delegateFireworkVideoSDK.eventTracking.liveStreamEventDelegate =// Object to receive live stream events
List of live stream events:
/// Delegate that handles live stream eventspublicprotocolFireworkLiveStreamEventDelegate:AnyObject{/** Called when a user joins an active live stream. - Parameter liveStream: Details about the live stream event are included. */funcfireworkLiveStreamUserDidJoin(_liveStream: LiveStreamEventDetails)/** Called when the user leaves an active live stream. - Parameter liveStream: Details about the live stream event are included. */funcfireworkLiveStreamUserDidLeave(_liveStream: LiveStreamEventDetails)/** Called when a user sends a message to an active live stream. - Parameters: - message: Details of the chat message sent - liveStream: Details about the live stream event are included. */funcfireworkLiveStreamUserDidSendChat(_message: LiveStreamMessageDetails, toliveStream: LiveStreamEventDetails)/** Called when a user sends a like to an active live stream. - Parameter liveStream: Details about the live stream event are included. */funcfireworkLiveStreamUserDidSendLike(_liveStream: LiveStreamEventDetails)}
Data Tracking Level
The SDK provides a way to specify the level of data tracking that should be performed. The default value is .all. To change the data tracking level, use the following API:
FireworkVideoSDK.analytics.dataTrackingLevel = .essentialOnly // Only essential data will be tracked// ORFireworkVideoSDK.analytics.dataTrackingLevel = .all // All data will be tracked// ORFireworkVideoSDK.analytics.dataTrackingLevel = .none// No data will be tracked