SellyCloud Live
SellyCloud Live is an interactive live streaming platform that enables
you to experience the complete push-pull streaming workflow in
real-time.
Get Started
Choose your platform to start integrating SellyCloud Live streaming
capabilities into your application.
iOS
Integrate SellyCloud Live into your iOS application using our native
iOS SDK. Supports iOS 12.0 and above.
Requirements
iOS 12.0+, Xcode 12.0+, Swift 5.0+ or Objective-C
1. Add Permissions (Info.plist)
<key>NSCameraUsageDescription</key>
<string>Camera access is required for live streaming</string>
<key>NSMicrophoneUsageDescription</key>
<string>Microphone access is required for live streaming</string>
2. Initialize Pusher
#import <SellyCloudSDK/SellyVideoPusher.h>
@interface YourViewController () <SellyPusherManagerDelegate>
@property (nonatomic, strong) SellyVideoPusher *livePusher;
@property (nonatomic, strong) UIView *previewView;
@end
@implementation YourViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Add preview view
[self.view addSubview:self.previewView];
// Create pusher
self.livePusher = [[SellyVideoPusher alloc] initWithUrl:@"rtmp://your-server/live/stream"];
self.livePusher.preview = self.previewView;
self.livePusher.delegate = self;
// Start capturing
[self.livePusher startRunning:AVCaptureDevicePositionFront videoConfig:nil audioConfig:nil];
// Start streaming
[self.livePusher startLive];
}
- (UIView *)previewView {
if (!_previewView) {
_previewView = [[UIView alloc] initWithFrame:self.view.bounds];
}
return _previewView;
}
@end
3. Implement Delegate Callbacks
#pragma mark - SellyPusherManagerDelegate
- (void)pusher:(SellyVideoPusher *)pusher liveStatusDidChanged:(SellyLiveState)status {
// Streaming status changed
}
- (void)pusher:(SellyVideoPusher *)pusher onError:(NSError *)error {
NSLog(@"Streaming error: %@", error.localizedDescription);
}
4. Common Controls
// Switch front/back camera
[self.livePusher switchCameraPosition:nil];
// Set mirror
self.livePusher.mirror = YES;
// Mute/Unmute
[self.livePusher stopMicrophone];
[self.livePusher startMicrophone];
// Stop/Start camera
[self.livePusher stopCamera];
[self.livePusher startCamera];
5. Resource Management
- (void)viewDidDisappear:(BOOL)animated {
[super viewDidDisappear:animated];
[self.livePusher stopLive:nil];
}
Android
Integrate SellyCloud Live into your Android application using our
native Android SDK. Supports Android 5.0 (API level 21) and above.
Requirements
Android 5.0+ (API 21+), Android Studio 4.0+, Java 8+ or Kotlin 1.4+
1. Add Permissions (AndroidManifest.xml)
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO" />
<uses-permission android:name="android.permission.INTERNET" />
2. Add Preview View to Layout
<!-- For RTMP streaming use OpenGlView -->
<com.pedro.library.view.OpenGlView
android:id="@+id/surfaceViewPush"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- For WHIP streaming use SurfaceViewRenderer -->
<org.webrtc.SurfaceViewRenderer
android:id="@+id/whipPreview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone" />
3. Initialize Streaming Manager
class MainActivity : AppCompatActivity() {
private var streamingManager: StreamingManager? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
// Step 1: Create StreamingManager
streamingManager = StreamingManager(this)
// Step 2: Set state callback
streamingManager?.setStreamingListener(object : StreamingListener {
override fun onStateUpdate(state: StreamingState, message: String?, extras: Bundle?) {
when (state) {
StreamingState.IDLE -> Log.d(TAG, "Idle")
StreamingState.CONNECTING -> Log.d(TAG, "Connecting...")
StreamingState.STREAMING -> Log.d(TAG, "Streaming")
StreamingState.RECONNECTING -> Log.d(TAG, "Reconnecting...")
StreamingState.STOPPED -> Log.d(TAG, "Stopped")
StreamingState.FAILED -> Log.d(TAG, "Error: $message")
}
}
override fun onError(error: StreamingError) {
Log.e(TAG, "Error: ${error.message}")
}
})
// Step 3: Configure streaming parameters
streamingManager?.updateStreamConfig(
protocol = Protocol.RTMP, // or Protocol.WHIP
width = 1080,
height = 1920,
fps = 30,
videoBitrate = 2_500_000,
audioBitrate = 128_000,
iFrameInterval = 2,
maxRetryCount = 5,
retryDelayMs = 3000,
facing = "front" // "front" or "back"
)
// Step 4: Initialize preview view
streamingManager?.initialize(binding.surfaceViewPush)
}
}
4. Start/Stop Streaming
// Set streaming URL and start streaming
streamingManager?.updateStreamConfig(
host = "rtmp.example.com",
appName = "live",
streamName = "stream123",
streamKey = ""
)
streamingManager?.startStreaming()
// Stop streaming
streamingManager?.stopStreaming()
5. Common Controls
// Switch camera
streamingManager?.switchCamera()
// Set mirror
streamingManager?.setMirror(horizontal = true, vertical = false)
// Change resolution
streamingManager?.changeResolution(720, 1280)
// Switch orientation
streamingManager?.switchOrientation()
6. Resource Management
override fun onResume() {
super.onResume()
streamingManager?.resumePreview()
}
override fun onPause() {
super.onPause()
streamingManager?.pausePreview()
}
override fun onDestroy() {
super.onDestroy()
streamingManager?.release()
}
Web
Integrate SellyCloud Live into your web application using our
JavaScript SDK. Supports modern browsers with WebRTC capabilities.
Requirements
Modern browsers (Chrome 74+, Firefox 66+, Safari 12.1+, Edge 79+), ES6+ support
1. Import SDK
<!-- UMD method -->
<script src="dist/sellycloudwebsdk.umd.js"></script>
<script>
const client = SellyCloudWebSdk.CreateSellyRtcEngine();
</script>
// ES Module method
import { CreateSellyRtcEngine } from './dist/sellycloudwebsdk.es.js';
const client = CreateSellyRtcEngine();
2. Listen to Events
// Log output
client.on('log', (msg) => {
console.log('[SDK]', msg);
});
// Local preview stream ready - bind to video element
client.on('preview-stream', (stream) => {
const preview = document.getElementById('preview');
if (preview && stream) {
preview.srcObject = stream;
}
});
// Local preview stopped
client.on('preview-stopped', () => {
console.log('Preview stopped');
});
// Push stream ICE connection state change
client.on('push-ice', (state) => {
console.log('Push ICE state:', state);
// state: 'new' | 'checking' | 'connected' | 'completed' | 'failed' | 'disconnected' | 'closed'
});
// Push stream success - returns server address for generating share link
client.on('push-success', ({ app, stream, zlm, preferredTcp }) => {
console.log('Push success:', { app, stream, zlm });
// Generate share link (using relative path)
const basePath = location.pathname.substring(0, location.pathname.lastIndexOf('/') + 1);
const shareUrl = `${location.origin}${basePath}player.html?app=${encodeURIComponent(app)}&stream=${encodeURIComponent(stream)}&zlm=${encodeURIComponent(zlm)}&preferred_tcp=${preferredTcp}`;
console.log('Share URL:', shareUrl);
});
// Push stream stopped
client.on('push-stopped', () => {
console.log('Push stopped');
});
3. Enumerate Devices
async function getDevices() {
const { cameras, mics } = await client.getDevices();
console.log('Cameras:', cameras);
console.log('Microphones:', mics);
return { cameras, mics };
}
4. Start Preview
async function startPreview(videoDeviceId, audioDeviceId) {
try {
await client.startPreview({
videoDeviceId, // Optional: specify camera
audioDeviceId // Optional: specify microphone
});
console.log('Preview started');
} catch (err) {
console.error('Preview failed:', err.message);
}
}
5. Stop Preview
function stopPreview() {
client.stopPreview();
// Clear video element
document.getElementById('preview').srcObject = null;
}
6. Start Push
async function startPush() {
try {
const result = await client.startPush({
app: 'live', // Application name
stream: 'channel123', // Channel ID
preferredTcp: '0' // Optional: '0' UDP priority (default), '1' TCP priority
});
console.log('Push success:', result);
// result.zlm contains server address
} catch (err) {
console.error('Push failed:', err.message);
}
}
7. Stop Push
client.stopPush();
Live API
SellyCloud Live is built on top of SellyCloud Video SDK and SellyCloud
Player SDK. Choose your platform to access detailed API documentation:
iOS
1. Methods
Live streaming pusher supporting RTMP and RTC protocols. Instance mode.
Initialization Methods
| Method |
Parameters |
Description |
- (instancetype)initWithUrl: |
url (NSString) |
Initialize with streaming URL |
- (instancetype)initWithStreamInfo: |
streamInfo (SellyPlayerStreamInfo) |
Initialize with stream info (supports encryption) |
Capture Control
| Method |
Parameters |
Description |
- (void)startRunning:videoConfig:audioConfig: |
position, videoConfig, audioConfig |
Start audio/video capture |
- (void)startRunningAudio: |
audioConfig |
Start audio-only capture |
- (NSError *)startCamera |
- |
Start video capture |
- (void)stopCamera |
- |
Stop video capture |
- (void)startMicrophone |
- |
Start audio capture |
- (void)stopMicrophone |
- |
Stop audio capture |
- (void)switchCameraPosition: |
completion |
Switch front/back camera |
Streaming Control
| Method |
Parameters |
Return Value |
Description |
- (NSError *)startLive |
- |
NSError |
Start streaming |
- (void)stopLive: |
callback |
void |
Stop streaming |
Utility Functions
| Method |
Parameters |
Return Value |
Description |
- (UIImage *)getCurrentImage |
- |
UIImage |
Capture current frame |
- (void)pushStaticImage: |
image |
void |
Push static image |
- (void)stopPushImage |
- |
void |
Stop pushing static image |
Properties
| Property |
Type |
Description |
preview |
UIView |
Local preview view |
delegate |
id<SellyPusherManagerDelegate> |
Callback delegate |
mirror |
BOOL |
Enable local preview mirroring |
isMute |
BOOL (readonly) |
Is muted |
isCameraEnable |
BOOL (readonly) |
Is camera enabled |
liveState |
SellyLiveState (readonly) |
Current streaming state |
enableCustomVideoProcess |
BOOL |
Enable video preprocessing (beauty filter) |
captureDevicePosition |
AVCaptureDevicePosition |
Current camera position |
scaleMode |
SellyPlayerScalingMode |
Scaling mode |
2. SellyLiveVideoConfiguration
Class Methods
| Method |
Description |
+ (instancetype)defaultConfiguration |
Get default configuration |
Properties
| Property |
Type |
Description |
videoSize |
CGSize |
Video output resolution (width and height must be multiples of 2) |
outputImageOrientation |
UIInterfaceOrientation |
Video output orientation |
autorotate |
BOOL |
Auto-rotate |
videoFrameRate |
NSUInteger |
Video frame rate (fps) |
videoMinFrameRate |
NSUInteger |
Video minimum frame rate |
videoMaxKeyframeInterval |
NSUInteger |
Maximum keyframe interval |
videoBitRate |
NSUInteger |
Video bitrate (bps) |
videoMinBitRate |
NSUInteger |
Video minimum bitrate (bps) |
sessionPreset |
SellyLiveVideoSessionPreset |
Video capture resolution |
landscape |
BOOL (readonly) |
Is landscape |
3. SellyPusherManagerDelegate - Callbacks
Streaming status and error callbacks.
| Method |
Parameters |
Description |
- (void)pusher:liveStatusDidChanged: |
pusher, status |
Streaming status changed |
- (void)pusher:onError: |
pusher, error |
Streaming error |
- (CVPixelBufferRef)pusher:onCaptureVideoFrame: |
pusher, pixelBuffer |
Video preprocessing (beauty filter) |
- (void)pusher:onStatisticsUpdate: |
pusher, stats |
Streaming statistics update |
4. Enumerations
SellyLiveState - Streaming Status
| Value |
Description |
SellyLiveStateReady |
Ready |
SellyLiveStatePending |
Connecting |
SellyLiveStateStart |
Streaming |
SellyLiveStateStop |
Stopped |
SellyLiveStateError |
Error |
SellyLiveStateRefresh |
Reconnecting |
SellyLiveVideoSessionPreset - Video Resolution Preset
| Value |
Resolution |
Bitrate Range |
SellyLiveVideoResolution480x360 |
480×360 |
400~600 Kbps |
SellyLiveVideoResolution480x480 |
480×480 |
350~525 Kbps |
SellyLiveVideoResolution640x480 |
640×480 |
600~900 Kbps |
SellyLiveVideoResolution640x360 |
640×360 |
500~900 Kbps |
SellyLiveVideoResolution960x540 |
960×540 |
800~1500 Kbps |
SellyLiveVideoResolution1280x720 |
1280×720 |
1000~1800 Kbps |
SellyPlayerScalingMode - Scaling Mode
| Value |
Description |
SellyPlayerScalingModeNone |
No scaling |
SellyPlayerScalingModeAspectFit |
Aspect fit, may have black bars |
SellyPlayerScalingModeAspectFill |
Aspect fill, may crop |
SellyPlayerScalingModeFill |
Stretch fill |
5. SellyPlayerStreamInfo - Stream Info
| Property |
Type |
Description |
streamId |
NSString |
Stream ID |
protocol |
NSString |
Protocol type ("rtmp" / "rtc") |
Android
1. Methods
Live streaming manager supporting RTMP and WHIP protocols.
Constructor
| Method |
Parameters |
Description |
StreamingManager(context) |
context: Context |
Create streaming manager |
Initialization and Preview
| Method |
Parameters |
Description |
initialize(view) |
view: View |
Initialize and bind preview view |
startPreview() |
- |
Start local preview |
pausePreview() |
- |
Pause preview |
resumePreview() |
- |
Resume preview |
stopWhipPreview() |
- |
Stop WHIP preview |
Streaming Control
| Method |
Parameters |
Description |
startStreaming() |
- |
Start streaming |
stopStreaming() |
- |
Stop streaming |
switchProtocol(protocol, view) |
protocol: Protocol, view: View |
Switch streaming protocol |
Configuration Methods
| Method |
Parameters |
Description |
updateStreamConfig(...) |
See parameters table below |
Update streaming configuration |
changeResolution(width, height) |
width: Int, height: Int |
Change resolution |
updateStreamConfig Parameters
| Parameter |
Type |
Description |
protocol |
Protocol |
Streaming protocol (RTMP/WHIP) |
host |
String |
Server address |
appName |
String |
Application name |
streamName |
String |
Stream name |
streamKey |
String |
Stream key |
width |
Int |
Video width |
height |
Int |
Video height |
fps |
Int |
Frame rate |
videoBitrate |
Int |
Video bitrate (bps) |
audioBitrate |
Int |
Audio bitrate (bps) |
iFrameInterval |
Int |
Keyframe interval (seconds) |
maxRetryCount |
Int |
Maximum retry count |
retryDelayMs |
Long |
Retry delay (milliseconds) |
facing |
String |
Camera direction ("front"/"back") |
Camera Control
| Method |
Parameters |
Description |
switchCamera() |
- |
Switch front/back camera |
switchOrientation() |
- |
Switch portrait/landscape orientation |
setMirror(horizontal, vertical) |
horizontal: Boolean, vertical: Boolean |
Set mirror mode |
Beauty Filter Control
| Method |
Parameters |
Description |
setBeautyEngine(engine) |
engine: BeautyEngine |
Set beauty filter engine |
setBeautyEnabled(enabled) |
enabled: Boolean |
Enable/disable beauty filter |
Video Source Control
| Method |
Parameters |
Return Value |
Description |
setBitmapAsVideoSource(bitmap) |
bitmap: Bitmap |
Boolean |
Set image as video source |
restoreCameraVideoSource() |
- |
- |
Restore camera video source |
Resource Release
| Method |
Description |
release() |
Release all resources |
2. Callbacks
Callback Setup
| Method |
Parameters |
Description |
setStreamingListener(listener) |
listener: StreamingListener |
Set streaming status listener |
Streaming Status and Error Callbacks
| Method |
Parameters |
Description |
onStateUpdate(state, message, extras) |
state: StreamingState, message: String?, extras: Bundle? |
Streaming status update |
onError(error) |
error: StreamingError |
Streaming error callback |
3. Enumerations
Protocol - Streaming Protocol
| Value |
Description |
Protocol.RTMP |
RTMP protocol |
Protocol.WHIP |
WHIP protocol (WebRTC-HTTP) |
StreamingState - Streaming Status
| Value |
Description |
IDLE |
Ready to start |
CONNECTING |
Connecting |
STREAMING |
Streaming |
RECONNECTING |
Reconnecting |
STOPPED |
Stopped |
FAILED |
Streaming error |
4. StreamingError - Streaming Error
| Property |
Type |
Description |
message |
String |
Error message |
Web
Methods
CreateSellyRtcEngine()
Creates an RTC client instance.
Return Value: SellyRtcEngine - RTC client instance
getDevices()
Enumerates available camera and microphone devices.
Return Value: Promise<{ cameras: MediaDeviceInfo[], mics: MediaDeviceInfo[] }>
| Field |
Type |
Description |
cameras |
MediaDeviceInfo[] |
List of available cameras |
mics |
MediaDeviceInfo[] |
List of available microphones |
startPreview(options)
Start local camera/microphone preview.
Parameters:
| Parameter |
Type |
Required |
Default |
Description |
options.videoDeviceId |
string |
No |
undefined |
Specify camera device ID |
options.audioDeviceId |
string |
No |
undefined |
Specify microphone device ID |
Return Value: Promise<MediaStream> - Local media stream
Triggers Event: preview-stream
stopPreview()
Stop local preview and release camera/microphone resources.
Return Value: void
Triggers Event: preview-stopped
startPush(options)
Start pushing stream to server.
Parameters:
| Parameter |
Type |
Required |
Default |
Description |
options.app |
string |
Yes |
- |
Application name (e.g. 'live') |
options.stream |
string |
Yes |
- |
Channel ID |
options.preferredTcp |
string |
No |
'0' |
Transport protocol: '0' UDP preferred, '1' TCP preferred |
Return Value: Promise<{ app, stream, zlm, preferredTcp }>
| Field |
Type |
Description |
app |
string |
Application name |
stream |
string |
Channel ID |
zlm |
string |
ZLMediaServer address for generating share link |
preferredTcp |
string |
Transport protocol used |
Triggers Events: push-ice, push-success
stopPush()
Stop pushing stream.
Return Value: void
Triggers Event: push-stopped
Events
Event List
| Event Name |
Callback Parameters |
Description |
log |
msg: string |
SDK internal log message |
preview-stream |
stream: MediaStream |
Local preview stream ready, bind to video element for playback |
preview-stopped |
None |
Local preview stopped |
push-ice |
state: string |
Push stream ICE connection state changed |
push-success |
{ app, stream, zlm, preferredTcp } |
Push stream succeeded |
push-stopped |
None |
Push stream stopped |
push-success Callback Parameters
| Field |
Type |
Description |
app |
string |
Application name |
stream |
string |
Channel ID |
zlm |
string |
ZLMediaServer address |
preferredTcp |
string |
Transport protocol used |
ICE State Values
| State |
Description |
new |
Initial state |
checking |
Checking connection |
connected |
Connected |
completed |
Connection completed |
failed |
Connection failed |
disconnected |
Connection disconnected |
closed |
Connection closed |
Share Link Format
After successful push, use the returned parameters to generate a share link:
player.html?app={app}&stream={stream}&zlm={zlm}&preferred_tcp={preferredTcp}
| Parameter |
Description |
app |
Application name |
stream |
Channel ID |
zlm |
ZLMediaServer address (URL encoded) |
preferred_tcp |
Transport protocol |