XPSDKVideoConnectionFrame
@interface XPSDKVideoConnectionFrame : NSObject
The XPSDKVideoConnectionFrame represents a frame of video, sent over video connection.
A frame always contains a header, may contain one or more header extensions and may contain a single (JPEG encoded) image.
This class provides methods to analyze binary data and determine if it contains a complete and valid frame to be parsed. Use them before attempting to init an instance.
-
ID of the video as specified in the frame’s header
Declaration
Objective-C
@property (readonly, nonatomic) XPSDKVideoID videoID;
-
Timestamp of the frame
Declaration
Objective-C
@property (assign, readwrite, nonatomic) int *timestamp;
-
Index of the frame (not used at the moment)
Declaration
Objective-C
@property (readonly, nonatomic) int frameNumber;
-
Timestamp of the frame (in ms)
Declaration
Objective-C
@property (readonly, nonatomic) long long timestamp_ms;
-
Declaration
Objective-C
@property (strong, nonatomic) NSString *carouselVideoID
-
Flag indicating whether the frame contains the size header extension
If a frame contains size information (header extension) we get several properties - resolution of the camera, what region is cropped and sent and what are the dimensions of the image we will receive. This is not sent with every frame we get, but only if any of these change (say after changeStream commands).
Declaration
Objective-C
@property (readonly, nonatomic) int hasSizeInformation;
-
Flag indicating whether the frame contains the playback header extension
If the frame contains the Live header extension, current and changed live events come in pair.
Declaration
Objective-C
@property (readonly, nonatomic) int hasLiveInformation;
-
Flag indicating whether the frame contains the playback header extension
If the frame contains the Playback header extension, current and changed live events come in pair.
Declaration
Objective-C
@property (readonly, nonatomic) int hasPlaybackInformation;
-
Flag indicating whether the frame contains the carousel header extension
Declaration
Objective-C
@property (readonly, nonatomic) int hasCarouselInformation;
-
The resolution of the camera
Declaration
Objective-C
@property (readonly, nonatomic) int sourceSize;
-
This is not a crop rectangle and is improperly defined as UIEdgeInsets. top/left correspond to the offset from the top and left edge of the camera but bottom and right are actually the coordinates of the bottom right corner of the crop area.
Declaration
Objective-C
@property (readonly, nonatomic) int sourceCrop;
-
The dimensions of the image we (will) receive
Declaration
Objective-C
@property (readonly, nonatomic) int destinationSize;
-
The crop rectangle as proper rectangle - top left is the top left corner and width/height is width/height - both in camera’s resolution
Declaration
Objective-C
@property (readonly, nonatomic) int sourceRect;
-
Resampling tag
Declaration
Objective-C
@property (readonly, nonatomic) int resamplingTag;
-
Current live events property comes in pair with changed live events if the frame contains the Live header extension. Both properties contain a mask of XPSDKVideoConnectionFrameLiveFlags.
Declaration
Objective-C
@property (readonly, nonatomic) XPSDKVideoConnectionFrameLiveEventsMask currentLiveEvents;
-
Changed live events property comes in pair with changed live events if the frame contains the Live header extension. Both properties contain a mask of XPSDKVideoConnectionFrameLiveFlags.
Declaration
Objective-C
@property (readonly, nonatomic) XPSDKVideoConnectionFrameLiveEventsMask changedLiveEvents;
-
Current live events property comes in pair with changed playback events if the frame contains the Playback header extension. Both properties contain a mask of XPSDKVideoConnectionFramePlaybackFlags.
Declaration
Objective-C
@property (readonly, nonatomic) XPSDKVideoConnectionFramePlaybackEventsMask currentPlaybackEvents;
-
Changed live events property comes in pair with current playback events if the frame contains the Playback header extension. Both properties contain a mask of XPSDKVideoConnectionFramePlaybackFlags.
Declaration
Objective-C
@property (readonly, nonatomic) XPSDKVideoConnectionFramePlaybackEventsMask changedPlaybackEvents;
-
Image, if any, sent with the frame
Declaration
Objective-C
@property (nonatomic, strong) UIImage * image
-
Checks a byte stream and verifies if we have enough data in it to construct a frame object
Note: if the base frame header contains an unnaturally long expected frame length (say 1GB) this method will return NO if the data is less than that size. It could be good idea to have some limit on how large a frame may be so we can detect such potentially invalid headers and discard that data, sending the video connection in
self repair
modeDeclaration
Objective-C
+ (id)dataContainsCompleteFrame:(id)data;
Parameters
data
The byte array to check
Return Value
Yes if the data contains enough data to parse the base header, the header contains a valid frame length and that there is enough data to construct a frame with that length.
-
Checks a byte stream and verifies if the data contains the correct video ID
Declaration
Objective-C
+ (id)data:(id)data matchesVideoID:(id)videoID;
Parameters
data
The data to be checked
videoID
The video ID to check for
Return Value
Yes if the data seems to contain a valid frame
-
Designated initializer - c reates a new frame object from a byte stream
Declaration
Objective-C
- (id)initWithData:(id)data;
Parameters
data
input data
totalSize
Pointer to an unsigned integer variable. The initializer will set it to the actual number of bytes read to construct the frame
-
Declaration
Objective-C
- (BOOL)isSegmentedStream;