Skip to content
This repository was archived by the owner on Feb 20, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ time due to CPU limitations on iOS devices.
subcribed video stream.

**FrameMetadata** -- This project shows how to set metadata (limited to 32 bytes) to a video frame, as well as how to read metadata from a video frame.

**Sender Stats** -- This project shows how to send & display bitrate statistics of the sender in 3 simple steps. It allows launching multiparty connections to see the actual stats of the sender.

## Obtaining OpenTok Credentials

Expand All @@ -98,4 +100,4 @@ We love to hear from you so if you have questions, comments or find a bug in the

## Further Reading

- Check out the Developer Documentation at <https://tokbox.com/developer/>
- Check out the Developer Documentation at <https://tokbox.com/developer/>
26 changes: 26 additions & 0 deletions Sender-Stats/OTXCFramework.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Pod::Spec.new do |s|
build = "2401"
s.name = "OTXCFramework"
s.version = "2.32.0-preview.#{build}"
s.summary = "OpenTok lets you weave interactive live WebRTC video streaming right into your application"
s.description = <<-DESC
The OpenTok iOS SDK lets you use WebRTC video sessions in apps you build for iPad,
iPhone, and iPod touch devices.
DESC
s.homepage = "https://tokbox.com/developer/sdks/ios/"
s.license = { :type => "Commercial", :text => "https://tokbox.com/support/tos" }
s.author = { "TokBox, Inc." => "support@tokbox.com" }

s.platform = :ios
s.ios.deployment_target = '15.0'
s.source = { :http => "https://s3.us-east-1.amazonaws.com/artifact.tokbox.com/pr/otkit-ios-sdk-xcframework/2401/OpenTok-iOS-2.32.0-preview.2401.zip"}
s.resource_bundles = {
'OTPrivacyResources' => ['OpenTok.xcframework/ios-arm64/**/OpenTok.framework/PrivacyInfo.xcprivacy']
}
s.vendored_frameworks = "OpenTok.xcframework"
s.frameworks = "Foundation", "AVFoundation", "AudioToolbox", "CoreFoundation", "CoreGraphics",
"CoreMedia", "CoreTelephony", "CoreVideo", "GLKit", "OpenGLES", "QuartzCore",
"SystemConfiguration", "UIKit", "VideoToolbox", "Network", "Accelerate", "MetalKit"
s.libraries = "c++"
s.requires_arc = false
end
8 changes: 8 additions & 0 deletions Sender-Stats/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
require_relative '../OpenTokSDKVersion'

platform :ios, MinIosSdkVersion
use_frameworks!

target 'Sender-Stats' do
pod 'OTXCFramework', :podspec => 'OTXCFramework.podspec'
end
37 changes: 37 additions & 0 deletions Sender-Stats/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
Sender Stats Sample App
========================================

This sample app demonstrates how to get and show sender stats to the user. It shows how to get the `OTSenderStats` object that contains information such as maxBitrate and currentBitrate in bps. More information on sender stats can be read [here](https://tokbox.com/developer/guides/sender-stats).

*Important:* To use this application, follow the instructions in the
[Quick Start](../README.md#quick-start) section of the main README file
for this repository.

<img src="./readme-images/senderStatsExample1.png" width="400" height="767">

## Setting up the statistis

The following steps are needed to implement the stats monitoring. These are also highlighted in the code sample within `ChatViewController`, along with specific usage example.

### Step 1

First, you need to set the `senderStatisticsTrack` of the Publisher to `true` to start sending the statistics.

### Step 2

Next it is important to set the `subscriber.networkStatsDelegate` on the subscriber - to start getting the delegate callbacks, that contain the statistics.

### Step 3

Add conformance to the `OTSubscriberKitNetworkStatsDelegate` protocol, to be able to read `OTSenderStats`, when the callbacks get triggered.

```swift
func subscriber(_ subscriber: OTSubscriberKit, videoNetworkStatsUpdated stats: OTSubscriberKitVideoNetworkStats) {
// here you can use stats.senderStats - which gives the access to the `OTSenderStats`.
}
```
### Final

Now we have the stats - however to see the proper values for currentBitrate, we'll need to make a connection. To do that, simply join the same session with 2 clients (could be a web client + iOS device, or just 2 separate iOS simulators running simultaneously). When a publisher and subscriber are connected within one session, then we should see the actual bitrates within the sender stats property.


Loading