Available from SDK 2.1.0
Knowing how much peers are connected to you and how much offload a single SDK instance is performing while you are integrating the SDK could be useful. It could as well be used to send data to third parties analytics.
The SDK exposes a stats method which could be used like the following on an initialized SDK instance:
var func stats(_ completion: (_ stats: [String : Any]?) -> ()): Bool
- (void)stats:(void(^)(NSDictionary<NSString *, id> *))completion;
The completion gives access to a dictionary containing the following keys:
cdn: Traffic downloaded from the cdn (cumulated bytes).
p2p: Traffic downloaded from the p2p network (cumulated bytes).
upload: Traffic uploaded to the p2p network (cumulated bytes).
peers: Real time connected peers count.
On top of the stats API exposed by the SDK, we created a view helper to help you integrate and understand Streamroot DNA™ faster. The StatsView will inform you about the different states of the SDK lifecycle and Streamroot metrics. The view looks like the following:
To add statsview, just call the corresponding method from the streamrootSDK instance:
func displayStats(onView: UIView)
- (void)displayStatsOnView:(UIView * _Nullable)view;
The activation can have multiple states:
- Initialization Failed
- Access Requested
- Access Granted
- Access Denied
- Active -> with the activation duration
- Error Throwed
- Warning Raised