This commit is contained in:
Caleb
2025-11-21 12:00:40 +08:00
commit 18ea900c12
1189 changed files with 134605 additions and 0 deletions

BIN
SellyCloudSDK/sdk/.DS_Store vendored Normal file

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,40 @@
//
// LFLiveDebug.h
// LaiFeng
//
// Created by LaiFeng on 16/5/20.
// Copyright © 2016年 LaiFeng All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@interface LFLiveDebug : NSObject
@property (nonatomic, copy) NSString *streamId; ///< 流id
@property (nonatomic, copy) NSString *uploadUrl; ///< 流地址
@property (nonatomic, assign) CGSize videoSize; ///< 上传的分辨率
@property (nonatomic, assign) BOOL isRtmp; ///< 上传方式TCP or RTMP
@property (nonatomic, assign) CGFloat elapsedMilli; ///< 距离上次统计的时间 单位ms
@property (nonatomic, assign) CGFloat timeStamp; ///< 当前的时间戳从而计算1s内数据
@property (nonatomic, assign) CGFloat dataFlow; ///< 总流量
@property (nonatomic, assign) CGFloat bandwidth; ///< 1s内总带宽
@property (nonatomic, assign) CGFloat currentBandwidth; ///< 上次的带宽
@property (nonatomic, assign) CGFloat audioBandwidth;
@property (nonatomic, assign) CGFloat videoBandwidth;
@property (nonatomic, assign) CGFloat currentAudioBandwidth;
@property (nonatomic, assign) CGFloat currentVideoBandwidth;
@property (nonatomic, assign) NSInteger dropFrame; ///< 丢掉的帧数
@property (nonatomic, assign) NSInteger totalFrame; ///< 总帧数
@property (nonatomic, assign) NSInteger capturedAudioCount; ///< 1s内音频捕获个数
@property (nonatomic, assign) NSInteger capturedVideoCount; ///< 1s内视频捕获个数
@property (nonatomic, assign) NSInteger currentCapturedAudioCount; ///< 上次的音频捕获个数
@property (nonatomic, assign) NSInteger currentCapturedVideoCount; ///< 上次的视频捕获个数
@property (nonatomic, assign) NSInteger unSendCount; ///< 未发送个数(代表当前缓冲区等待发送的)
@end

View File

@@ -0,0 +1,41 @@
//
// SellyCloudManager.h
// SellyCloudSDK
//
// Created by Caleb on 7/7/25.
//
#import <Foundation/Foundation.h>
#import "SellyLiveVideoConfiguration.h"
#import "SellyLiveAudioConfiguration.h"
#import "SellyPusherManagerDelegate.h"
#import "SellyPlayerManagerDelegate.h"
#import "LFLiveDebug.h"
#import "SellyPublicDefinition.h"
#import "SellyVideoPlayer.h"
#import "SellyVideoPusher.h"
#import "SellyLivePusherStats.h"
#import "SellyRTCEngine.h"
#import "SellyRTCSession.h"
#import "SellyRTCVideoConfiguration.h"
#import "SellyRTCSessionDelegate.h"
NS_ASSUME_NONNULL_BEGIN
@interface SellyCloudManager : NSObject
+ (instancetype)sharedInstance;
- (void)startWithKey:(NSString *)apiKey appName:(NSString *)appName;
/**
设置洋葱盾appKey和rs
@return 0表示成功非0表示失败请咨询Kiwi开发人员
*/
+ (NSInteger)setKiwiAppKey:(const char *)appKey name:(const char *)name;
+ (NSString *)sdkVersion;
+ (void)uploadLog:(void(^)(NSString * _Nullable url, NSError * _Nullable error))callback;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,436 @@
#if 0
#elif defined(__arm64__) && __arm64__
// Generated by Apple Swift version 6.2 effective-5.10 (swiftlang-6.2.0.19.9 clang-1700.3.19.1)
#ifndef SELLYCLOUDSDK_SWIFT_H
#define SELLYCLOUDSDK_SWIFT_H
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wgcc-compat"
#if !defined(__has_include)
# define __has_include(x) 0
#endif
#if !defined(__has_attribute)
# define __has_attribute(x) 0
#endif
#if !defined(__has_feature)
# define __has_feature(x) 0
#endif
#if !defined(__has_warning)
# define __has_warning(x) 0
#endif
#if __has_include(<swift/objc-prologue.h>)
# include <swift/objc-prologue.h>
#endif
#pragma clang diagnostic ignored "-Wauto-import"
#if defined(__OBJC__)
#include <Foundation/Foundation.h>
#endif
#if defined(__cplusplus)
#include <cstdint>
#include <cstddef>
#include <cstdbool>
#include <cstring>
#include <stdlib.h>
#include <new>
#include <type_traits>
#else
#include <stdint.h>
#include <stddef.h>
#include <stdbool.h>
#include <string.h>
#endif
#if defined(__cplusplus)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnon-modular-include-in-framework-module"
#if defined(__arm64e__) && __has_include(<ptrauth.h>)
# include <ptrauth.h>
#else
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wreserved-macro-identifier"
# ifndef __ptrauth_swift_value_witness_function_pointer
# define __ptrauth_swift_value_witness_function_pointer(x)
# endif
# ifndef __ptrauth_swift_class_method_pointer
# define __ptrauth_swift_class_method_pointer(x)
# endif
#pragma clang diagnostic pop
#endif
#pragma clang diagnostic pop
#endif
#if !defined(SWIFT_TYPEDEFS)
# define SWIFT_TYPEDEFS 1
# if __has_include(<uchar.h>)
# include <uchar.h>
# elif !defined(__cplusplus)
typedef unsigned char char8_t;
typedef uint_least16_t char16_t;
typedef uint_least32_t char32_t;
# endif
typedef float swift_float2 __attribute__((__ext_vector_type__(2)));
typedef float swift_float3 __attribute__((__ext_vector_type__(3)));
typedef float swift_float4 __attribute__((__ext_vector_type__(4)));
typedef double swift_double2 __attribute__((__ext_vector_type__(2)));
typedef double swift_double3 __attribute__((__ext_vector_type__(3)));
typedef double swift_double4 __attribute__((__ext_vector_type__(4)));
typedef int swift_int2 __attribute__((__ext_vector_type__(2)));
typedef int swift_int3 __attribute__((__ext_vector_type__(3)));
typedef int swift_int4 __attribute__((__ext_vector_type__(4)));
typedef unsigned int swift_uint2 __attribute__((__ext_vector_type__(2)));
typedef unsigned int swift_uint3 __attribute__((__ext_vector_type__(3)));
typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4)));
#endif
#if !defined(SWIFT_PASTE)
# define SWIFT_PASTE_HELPER(x, y) x##y
# define SWIFT_PASTE(x, y) SWIFT_PASTE_HELPER(x, y)
#endif
#if !defined(SWIFT_METATYPE)
# define SWIFT_METATYPE(X) Class
#endif
#if !defined(SWIFT_CLASS_PROPERTY)
# if __has_feature(objc_class_property)
# define SWIFT_CLASS_PROPERTY(...) __VA_ARGS__
# else
# define SWIFT_CLASS_PROPERTY(...)
# endif
#endif
#if !defined(SWIFT_RUNTIME_NAME)
# if __has_attribute(objc_runtime_name)
# define SWIFT_RUNTIME_NAME(X) __attribute__((objc_runtime_name(X)))
# else
# define SWIFT_RUNTIME_NAME(X)
# endif
#endif
#if !defined(SWIFT_COMPILE_NAME)
# if __has_attribute(swift_name)
# define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X)))
# else
# define SWIFT_COMPILE_NAME(X)
# endif
#endif
#if !defined(SWIFT_METHOD_FAMILY)
# if __has_attribute(objc_method_family)
# define SWIFT_METHOD_FAMILY(X) __attribute__((objc_method_family(X)))
# else
# define SWIFT_METHOD_FAMILY(X)
# endif
#endif
#if !defined(SWIFT_NOESCAPE)
# if __has_attribute(noescape)
# define SWIFT_NOESCAPE __attribute__((noescape))
# else
# define SWIFT_NOESCAPE
# endif
#endif
#if !defined(SWIFT_RELEASES_ARGUMENT)
# if __has_attribute(ns_consumed)
# define SWIFT_RELEASES_ARGUMENT __attribute__((ns_consumed))
# else
# define SWIFT_RELEASES_ARGUMENT
# endif
#endif
#if !defined(SWIFT_WARN_UNUSED_RESULT)
# if __has_attribute(warn_unused_result)
# define SWIFT_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
# else
# define SWIFT_WARN_UNUSED_RESULT
# endif
#endif
#if !defined(SWIFT_NORETURN)
# if __has_attribute(noreturn)
# define SWIFT_NORETURN __attribute__((noreturn))
# else
# define SWIFT_NORETURN
# endif
#endif
#if !defined(SWIFT_CLASS_EXTRA)
# define SWIFT_CLASS_EXTRA
#endif
#if !defined(SWIFT_PROTOCOL_EXTRA)
# define SWIFT_PROTOCOL_EXTRA
#endif
#if !defined(SWIFT_ENUM_EXTRA)
# define SWIFT_ENUM_EXTRA
#endif
#if !defined(SWIFT_CLASS)
# if __has_attribute(objc_subclassing_restricted)
# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_CLASS_EXTRA
# define SWIFT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
# else
# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
# define SWIFT_CLASS_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
# endif
#endif
#if !defined(SWIFT_RESILIENT_CLASS)
# if __has_attribute(objc_class_stub)
# define SWIFT_RESILIENT_CLASS(SWIFT_NAME) SWIFT_CLASS(SWIFT_NAME) __attribute__((objc_class_stub))
# define SWIFT_RESILIENT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_class_stub)) SWIFT_CLASS_NAMED(SWIFT_NAME)
# else
# define SWIFT_RESILIENT_CLASS(SWIFT_NAME) SWIFT_CLASS(SWIFT_NAME)
# define SWIFT_RESILIENT_CLASS_NAMED(SWIFT_NAME) SWIFT_CLASS_NAMED(SWIFT_NAME)
# endif
#endif
#if !defined(SWIFT_PROTOCOL)
# define SWIFT_PROTOCOL(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
# define SWIFT_PROTOCOL_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
#endif
#if !defined(SWIFT_EXTENSION)
# define SWIFT_EXTENSION(M) SWIFT_PASTE(M##_Swift_, __LINE__)
#endif
#if !defined(OBJC_DESIGNATED_INITIALIZER)
# if __has_attribute(objc_designated_initializer)
# define OBJC_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer))
# else
# define OBJC_DESIGNATED_INITIALIZER
# endif
#endif
#if !defined(SWIFT_ENUM_ATTR)
# if __has_attribute(enum_extensibility)
# define SWIFT_ENUM_ATTR(_extensibility) __attribute__((enum_extensibility(_extensibility)))
# else
# define SWIFT_ENUM_ATTR(_extensibility)
# endif
#endif
#if !defined(SWIFT_ENUM)
# define SWIFT_ENUM(_type, _name, _extensibility) enum _name : _type _name; enum SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type
# if __has_feature(generalized_swift_name)
# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) enum _name : _type _name SWIFT_COMPILE_NAME(SWIFT_NAME); enum SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type
# else
# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) SWIFT_ENUM(_type, _name, _extensibility)
# endif
#endif
#if !defined(SWIFT_UNAVAILABLE)
# define SWIFT_UNAVAILABLE __attribute__((unavailable))
#endif
#if !defined(SWIFT_UNAVAILABLE_MSG)
# define SWIFT_UNAVAILABLE_MSG(msg) __attribute__((unavailable(msg)))
#endif
#if !defined(SWIFT_AVAILABILITY)
# define SWIFT_AVAILABILITY(plat, ...) __attribute__((availability(plat, __VA_ARGS__)))
#endif
#if !defined(SWIFT_WEAK_IMPORT)
# define SWIFT_WEAK_IMPORT __attribute__((weak_import))
#endif
#if !defined(SWIFT_DEPRECATED)
# define SWIFT_DEPRECATED __attribute__((deprecated))
#endif
#if !defined(SWIFT_DEPRECATED_MSG)
# define SWIFT_DEPRECATED_MSG(...) __attribute__((deprecated(__VA_ARGS__)))
#endif
#if !defined(SWIFT_DEPRECATED_OBJC)
# if __has_feature(attribute_diagnose_if_objc)
# define SWIFT_DEPRECATED_OBJC(Msg) __attribute__((diagnose_if(1, Msg, "warning")))
# else
# define SWIFT_DEPRECATED_OBJC(Msg) SWIFT_DEPRECATED_MSG(Msg)
# endif
#endif
#if defined(__OBJC__)
#if !defined(IBSegueAction)
# define IBSegueAction
#endif
#endif
#if !defined(SWIFT_EXTERN)
# if defined(__cplusplus)
# define SWIFT_EXTERN extern "C"
# else
# define SWIFT_EXTERN extern
# endif
#endif
#if !defined(SWIFT_CALL)
# define SWIFT_CALL __attribute__((swiftcall))
#endif
#if !defined(SWIFT_INDIRECT_RESULT)
# define SWIFT_INDIRECT_RESULT __attribute__((swift_indirect_result))
#endif
#if !defined(SWIFT_CONTEXT)
# define SWIFT_CONTEXT __attribute__((swift_context))
#endif
#if !defined(SWIFT_ERROR_RESULT)
# define SWIFT_ERROR_RESULT __attribute__((swift_error_result))
#endif
#if defined(__cplusplus)
# define SWIFT_NOEXCEPT noexcept
#else
# define SWIFT_NOEXCEPT
#endif
#if !defined(SWIFT_C_INLINE_THUNK)
# if __has_attribute(always_inline)
# if __has_attribute(nodebug)
# define SWIFT_C_INLINE_THUNK inline __attribute__((always_inline)) __attribute__((nodebug))
# else
# define SWIFT_C_INLINE_THUNK inline __attribute__((always_inline))
# endif
# else
# define SWIFT_C_INLINE_THUNK inline
# endif
#endif
#if defined(_WIN32)
#if !defined(SWIFT_IMPORT_STDLIB_SYMBOL)
# define SWIFT_IMPORT_STDLIB_SYMBOL __declspec(dllimport)
#endif
#else
#if !defined(SWIFT_IMPORT_STDLIB_SYMBOL)
# define SWIFT_IMPORT_STDLIB_SYMBOL
#endif
#endif
#if defined(__OBJC__)
#if __has_feature(objc_modules)
#if __has_warning("-Watimport-in-framework-header")
#pragma clang diagnostic ignored "-Watimport-in-framework-header"
#endif
@import AVFoundation;
@import CoreFoundation;
@import Foundation;
@import MetalKit;
@import ObjectiveC;
@import UIKit;
#endif
#endif
#pragma clang diagnostic ignored "-Wproperty-attribute-mismatch"
#pragma clang diagnostic ignored "-Wduplicate-method-arg"
#if __has_warning("-Wpragma-clang-attribute")
# pragma clang diagnostic ignored "-Wpragma-clang-attribute"
#endif
#pragma clang diagnostic ignored "-Wunknown-pragmas"
#pragma clang diagnostic ignored "-Wnullability"
#pragma clang diagnostic ignored "-Wdollar-in-identifier-extension"
#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
#if __has_attribute(external_source_symbol)
# pragma push_macro("any")
# undef any
# pragma clang attribute push(__attribute__((external_source_symbol(language="Swift", defined_in="SellyCloudSDK",generated_declaration))), apply_to=any(function,enum,objc_interface,objc_category,objc_protocol))
# pragma pop_macro("any")
#endif
#if defined(__OBJC__)
@class UIView;
@protocol HKRtmpPusherProtocol;
@class SellyLiveVideoConfiguration;
@class SellyLiveAudioConfiguration;
@class NSString;
SWIFT_CLASS("_TtC13SellyCloudSDK12HKRtmpPusher")
@interface HKRtmpPusher : NSObject
@property (nonatomic, strong) UIView * _Nullable preview;
@property (nonatomic) NSInteger reconnectInterval;
@property (nonatomic) NSInteger reconnectCount;
@property (nonatomic, strong) id <HKRtmpPusherProtocol> _Nullable delegate;
@property (nonatomic) enum AVCaptureDevicePosition currentPosition;
@property (nonatomic) BOOL muted;
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
- (void)startRunning:(enum AVCaptureDevicePosition)captureDevicePosition videoConfig:(SellyLiveVideoConfiguration * _Nonnull)videoConfig audioConfig:(SellyLiveAudioConfiguration * _Nonnull)audioConfig;
- (void)startRunningAudio:(SellyLiveAudioConfiguration * _Nonnull)audioConfig;
- (void)startLive:(NSString * _Nonnull)urlStr;
- (void)stopLive;
- (void)startCamera;
- (void)stopCamera;
- (void)switchCamera;
- (void)setPreviewView:(UIView * _Nonnull)view;
@end
@class SellyLivePusherStats;
SWIFT_PROTOCOL("_TtP13SellyCloudSDK20HKRtmpPusherProtocol_")
@protocol HKRtmpPusherProtocol
///
- (void)pusher:(HKRtmpPusher * _Nonnull)pusher onPushStatusChanged:(NSString * _Nonnull)status;
@optional
- (void)pusher:(HKRtmpPusher * _Nonnull)pusher onLiveStatsChanged:(SellyLivePusherStats * _Nonnull)stats;
@end
/// The <code>IOStream</code> class is the foundation of a RTMPStream.
SWIFT_CLASS("_TtC13SellyCloudSDK8IOStream")
@interface IOStream : NSObject
/// The number of frames per second being displayed.
@property (nonatomic, readonly) uint16_t currentFPS;
/// Creates an object.
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
@end
@class NSCoder;
@protocol MTLDevice;
/// A view that displays a video content of a NetStream object which uses Metal api.
SWIFT_CLASS("_TtC13SellyCloudSDK8MTHKView")
@interface MTHKView : MTKView
/// Initializes and returns a newly allocated view object with the specified frame rectangle.
- (nonnull instancetype)initWithFrame:(CGRect)frame OBJC_DESIGNATED_INITIALIZER;
/// Returns an object initialized from data in a given unarchiver.
- (nonnull instancetype)initWithCoder:(NSCoder * _Nonnull)aDecoder OBJC_DESIGNATED_INITIALIZER;
/// Prepares the receiver for service after it has been loaded from an Interface Builder archive, or nib file.
- (void)awakeFromNib;
- (void)drawRect:(CGRect)rect;
- (nonnull instancetype)initWithFrame:(CGRect)frameRect device:(id <MTLDevice> _Nullable)device SWIFT_UNAVAILABLE;
@end
/// The NetSocket class creates a two-way connection between a client and a server as a client. This class is wrapper for a InputStream and an OutputStream.
SWIFT_CLASS("_TtC13SellyCloudSDK9NetSocket")
@interface NetSocket : NSObject
- (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
@end
/// The NetClient class creates a two-way connection between a NetService.
SWIFT_CLASS("_TtC13SellyCloudSDK9NetClient")
@interface NetClient : NetSocket
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
+ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
@end
/// The NetService class creates a two-way connection between a client and a server as a server.
SWIFT_CLASS("_TtC13SellyCloudSDK10NetService")
@interface NetService : NSObject
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
+ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
@end
@class NSNetService;
@class NSInputStream;
@class NSOutputStream;
@interface NetService (SWIFT_EXTENSION(SellyCloudSDK)) <NSNetServiceDelegate>
- (void)netService:(NSNetService * _Nonnull)sender didAcceptConnectionWithInputStream:(NSInputStream * _Nonnull)inputStream outputStream:(NSOutputStream * _Nonnull)outputStream;
@end
@class NSStream;
@interface NetSocket (SWIFT_EXTENSION(SellyCloudSDK)) <NSStreamDelegate>
- (void)stream:(NSStream * _Nonnull)aStream handleEvent:(NSStreamEvent)eventCode;
@end
@class AVSampleBufferDisplayLayer;
/// A view that displays a video content of a NetStream object which uses AVSampleBufferDisplayLayer api.
SWIFT_CLASS("_TtC13SellyCloudSDK9PiPHKView")
@interface PiPHKView : UIView
/// Returns the class used to create the layer for instances of this class.
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly) Class _Nonnull layerClass;)
+ (Class _Nonnull)layerClass SWIFT_WARN_UNUSED_RESULT;
/// The views Core Animation layer used for rendering.
@property (nonatomic, readonly, strong) AVSampleBufferDisplayLayer * _Nonnull layer;
/// Initializes and returns a newly allocated view object with the specified frame rectangle.
- (nonnull instancetype)initWithFrame:(CGRect)frame OBJC_DESIGNATED_INITIALIZER;
/// Returns an object initialized from data in a given unarchiver.
- (nullable instancetype)initWithCoder:(NSCoder * _Nonnull)aDecoder OBJC_DESIGNATED_INITIALIZER;
/// Prepares the receiver for service after it has been loaded from an Interface Builder archive, or nib file.
- (void)awakeFromNib;
@end
/// An object that provides the interface to control a one-way channel over a RtmpConnection.
SWIFT_CLASS("_TtC13SellyCloudSDK10RTMPStream")
@interface RTMPStream : IOStream
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
+ (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
@end
#endif
#if __has_attribute(external_source_symbol)
# pragma clang attribute pop
#endif
#if defined(__cplusplus)
#endif
#pragma clang diagnostic pop
#endif
#else
#error unsupported Swift architecture
#endif

View File

@@ -0,0 +1,34 @@
#ifdef __OBJC__
#import <UIKit/UIKit.h>
#else
#ifndef FOUNDATION_EXPORT
#if defined(__cplusplus)
#define FOUNDATION_EXPORT extern "C"
#else
#define FOUNDATION_EXPORT extern
#endif
#endif
#endif
#import "SellyLiveAudioConfiguration.h"
#import "SellyLivePusherStats.h"
#import "SellyLiveVideoConfiguration.h"
#import "SellyPlayerManagerDelegate.h"
#import "SellyPlayerStreamInfo.h"
#import "SellyPublicDefinition.h"
#import "SellyPusherManagerDelegate.h"
#import "SellyRTCEngine.h"
#import "SellyRTCP2pStats.h"
#import "SellyRTCSession.h"
#import "SellyRTCSessionDelegate.h"
#import "SellyRtcVideoCanvas.h"
#import "SellyRTCVideoConfiguration.h"
#import "SellyRTCVideoFrame.h"
#import "SellyVideoPlayer.h"
#import "SellyVideoPusher.h"
#import "SellyCloudManager.h"
#import "LFLiveDebug.h"
FOUNDATION_EXPORT double SellyCloudSDKVersionNumber;
FOUNDATION_EXPORT const unsigned char SellyCloudSDKVersionString[];

View File

@@ -0,0 +1,73 @@
//
// SellyLiveAudioConfiguration.h
// SellyCloudLiveKit
//
// Created by LaiFeng on 16/5/20.
// Copyright © 2016年 LaiFeng All rights reserved.
//
#import <Foundation/Foundation.h>
/// 音频码率 (默认96Kbps)
typedef NS_ENUM (NSUInteger, SellyLiveAudioBitRate) {
/// 32Kbps 音频码率
SellyLiveAudioBitRate_32Kbps = 32000,
/// 64Kbps 音频码率
SellyLiveAudioBitRate_64Kbps = 64000,
/// 96Kbps 音频码率
SellyLiveAudioBitRate_96Kbps = 96000,
/// 128Kbps 音频码率
SellyLiveAudioBitRate_128Kbps = 128000,
/// 默认音频码率,默认为 96Kbps
SellyLiveAudioBitRate_Default = SellyLiveAudioBitRate_96Kbps
};
/// 音频采样率 (默认44.1KHz)
typedef NS_ENUM (NSUInteger, SellyLiveAudioSampleRate){
/// 16KHz 采样率
SellyLiveAudioSampleRate_16000Hz = 16000,
/// 44.1KHz 采样率
SellyLiveAudioSampleRate_44100Hz = 44100,
/// 48KHz 采样率
SellyLiveAudioSampleRate_48000Hz = 48000,
/// 默认音频采样率,默认为 44.1KHz
SellyLiveAudioSampleRate_Default = SellyLiveAudioSampleRate_44100Hz
};
/// Audio Live quality音频质量
typedef NS_ENUM (NSUInteger, SellyLiveAudioQuality){
/// 低音频质量 audio sample rate: 16KHz audio bitrate: numberOfChannels 1 : 32Kbps 2 : 64Kbps
SellyLiveAudioQuality_Low = 0,
/// 中音频质量 audio sample rate: 44.1KHz audio bitrate: 96Kbps
SellyLiveAudioQuality_Medium = 1,
/// 高音频质量 audio sample rate: 44.1MHz audio bitrate: 128Kbps
SellyLiveAudioQuality_High = 2,
/// 超高音频质量 audio sample rate: 48KHz, audio bitrate: 128Kbps
SellyLiveAudioQuality_VeryHigh = 3,
/// 默认音频质量 audio sample rate: 44.1KHz, audio bitrate: 96Kbps
SellyLiveAudioQuality_Default = SellyLiveAudioQuality_High
};
@interface SellyLiveAudioConfiguration : NSObject<NSCoding, NSCopying>
/// 默认音频配置
+ (instancetype)defaultConfiguration;
/// 音频配置
+ (instancetype)defaultConfigurationForQuality:(SellyLiveAudioQuality)audioQuality;
#pragma mark - Attribute
///=============================================================================
/// @name Attribute
///=============================================================================
/// 声道数目(default 2)
@property (nonatomic, assign) NSUInteger numberOfChannels;
/// 采样率
@property (nonatomic, assign) SellyLiveAudioSampleRate audioSampleRate;
/// 码率
@property (nonatomic, assign) SellyLiveAudioBitRate audioBitrate;
/// flv编码音频头 44100 为0x12 0x10
@property (nonatomic, assign, readonly) char *asc;
/// 缓存区长度
@property (nonatomic, assign,readonly) NSUInteger bufferLength;
@end

View File

@@ -0,0 +1,41 @@
//
// SellyLivePusherStats.h
// AFNetworking
//
// Created by Caleb on 23/9/25.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface SellyLivePusherStats : NSObject <NSCopying>
//直播协议
@property (nonatomic, strong)NSString *protocol;
/// App / System CPU%
@property (nonatomic, assign) NSUInteger appCpu;
@property (nonatomic, assign) NSUInteger systemCpu;
/// 帧率fps
@property (nonatomic, assign) NSUInteger fps;
/// 视频 / 音频码率kbps
@property (nonatomic, assign) NSUInteger videoBitrate;
@property (nonatomic, assign) NSUInteger audioBitrate;
/// 总上行速率kbps等于videoBitrate+audioBitrate
@property (nonatomic, assign) NSUInteger netSpeed;
/// RTTms
@property (nonatomic, assign) NSUInteger rtt;
/// 快照时间ms since boot
@property (nonatomic, assign) uint64_t timestampMs;
//videoSize
@property (nonatomic, assign)CGSize size;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,77 @@
//
// SellyLiveVideoConfiguration.h
// SellyCloudLiveKit
//
// Created by LaiFeng on 16/5/20.
// Copyright © 2016年 LaiFeng All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
/// 视频分辨率(都是169 当此设备不支持当前分辨率,自动降低一级)
/// 以下码率范围为帧率=15的时候计算出来的。如果帧率上调码率范围相应上调
typedef NS_ENUM (NSUInteger, SellyLiveVideoSessionPreset){
/// 分辨率 480*360码率范围400Kbps ~ 600Kbps帧率15fps。
SellyLiveVideoResolution480x360,
/// 分辨率 480*480码率范围350Kbps ~ 525Kbps帧率15fps。
SellyLiveVideoResolution480x480,
/// 分辨率 640*480码率范围600Kbps ~ 900Kbps帧率15fps。
SellyLiveVideoResolution640x480,
/// 分辨率 640*360码率范围500Kbps ~ 900Kbps帧率15fps。
SellyLiveVideoResolution640x360,
/// 分辨率 960*540码率范围800Kbps ~ 1500Kbps帧率15fps。
SellyLiveVideoResolution960x540,
/// 分辨率 1280*720码率范围1000Kbps ~ 1800Kbps帧率15fps。
SellyLiveVideoResolution1280x720,
/// 分辨率 1920*1080码率范围2500Kbps ~ 3000Kbps帧率15fps。
// SellyLiveVideoResolution1920x1080
};
@interface SellyLiveVideoConfiguration : NSObject
/// 默认视频配置
+ (instancetype)defaultConfiguration;
#pragma mark - Attribute
///=============================================================================
/// @name Attribute
///=============================================================================
/// 视频输出分辨率,宽高务必设定为 2 的倍数,否则解码播放时可能出现绿边
@property (nonatomic, assign) CGSize videoSize;
/// 视频输出方向
@property (nonatomic, assign) UIInterfaceOrientation outputImageOrientation;
/// 自动旋转(这里只支持 left 变 right portrait 变 portraitUpsideDown)
@property (nonatomic, assign) BOOL autorotate;
/// 视频的帧率,即 fps
@property (nonatomic, assign) NSUInteger videoFrameRate;
/// 视频的最小帧率,即 fps
@property (nonatomic, assign) NSUInteger videoMinFrameRate;
/// 最大关键帧间隔,可设定为 fps 的2倍影响一个 gop 的大小
@property (nonatomic, assign) NSUInteger videoMaxKeyframeInterval;
/// 视频的码率,单位是 bps
@property (nonatomic, assign) NSUInteger videoBitRate;
/// 视频的最小码率,单位是 bps
@property (nonatomic, assign) NSUInteger videoMinBitRate;
///< 视频采集分辨率
@property (nonatomic, assign) SellyLiveVideoSessionPreset sessionPreset;
///< 是否是横屏
@property (nonatomic, assign, readonly) BOOL landscape;
@end

View File

@@ -0,0 +1,26 @@
//
// SellyPlayerDelegate.h
// SellyCloudSDK
//
// Created by Caleb on 14/7/25.
//
#import <Foundation/Foundation.h>
#import "SellyPublicDefinition.h"
#import "SellyVideoPlayer.h"
NS_ASSUME_NONNULL_BEGIN
@protocol SellyPlayerManagerDelegate <NSObject>
@optional
- (void)player:(SellyVideoPlayer *)player prepareToPlayChanged:(BOOL)prepare;
/**
SellyCloudMPMovieFinishReason
*/
- (void)player:(SellyVideoPlayer *)player playbackDidFinished:(NSDictionary *)resultInfo;
- (void)player:(SellyVideoPlayer *)player playbackStateChanged:(SellyPlayerState)state;
- (void)player:(SellyVideoPlayer *)player onError:(NSError *)error;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,18 @@
//
// SellyPlayerStreamInfo.h
// SellyCloudSDK
//
// Created by Caleb on 18/9/25.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface SellyPlayerStreamInfo : NSObject
@property (nonatomic, strong)NSString *streamId;
//rtmp,rtc
@property (nonatomic, strong)NSString *protocol;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,64 @@
//
// SellyPublicDefinition.h
// Pods
//
// Created by Caleb on 22/8/25.
//
#ifndef SellyPublicDefinition_h
#define SellyPublicDefinition_h
typedef NS_ENUM(NSInteger, SellyPlayerScalingMode) {
SellyPlayerScalingModeNone, // No scaling
SellyPlayerScalingModeAspectFit, // Uniform scale until one dimension fits
SellyPlayerScalingModeAspectFill, // Uniform scale until the movie fills the visible bounds. One dimension may have clipped contents
};
typedef NS_ENUM(NSInteger, SellyPlayerState) {
SellyPlayerStateIdle = 0,
SellyPlayerStateConnecting,
SellyPlayerStatePlaying,
SellyPlayerStatePaused,
SellyPlayerStateStoppedOrEnded,
SellyPlayerStateFailed
};
typedef NS_ENUM(NSInteger, SellyCloudMPMovieFinishReason) {
SellyCloudMPMovieFinishReasonPlaybackEnded,
SellyCloudMPMovieFinishReasonPlaybackError,
SellyCloudMPMovieFinishReasonUserExited
};
typedef NS_ENUM(NSInteger, SellyLiveState) {
SellyLiveStateIdle = 0, // 初始/未开始
SellyLiveStateConnecting, // 建立会话RTMP连接 或 SDP/ICE协商中
SellyLiveStatePublishing, // 已在上行推流(码流稳定输出)
SellyLiveStateReconnecting, // 断线重试中(短暂)
SellyLiveStateStopped, // 正常结束stop
SellyLiveStateFailed // 异常结束(错误/不可恢复)
};
typedef NS_ENUM (NSUInteger, SellyCloudLiveSocketErrorCode) {
SellyCloudLiveSocketError_PreView = 201, ///< 预览失败
SellyCloudLiveSocketError_GetStreamInfo = 202, ///< 获取流媒体信息失败
SellyCloudLiveSocketError_ConnectSocket = 203, ///< 连接socket失败
SellyCloudLiveSocketError_Verification = 204, ///< 验证服务器失败
SellyCloudLiveSocketError_ReConnectTimeOut = 205, ///< 重新连接服务器超时
SellyCloudLiveSocketError_HttpRequest = 400, //http请求报错
};
typedef NS_ENUM(NSInteger, SellyVideoCallType) {
SellyVideoCallTypeAudio, // 语音
SellyVideoCallTypeVideo, // 视频
};
//信令连接状态
typedef NS_ENUM(NSInteger, SellyRoomConnectionState) {
SellyRoomStateDisconnected,
SellyRoomStateConnecting,
SellyRoomStateConnected,
SellyRoomStateReconnecting,
SellyRoomStateFailed,
};
#endif /* SellyPublicDefinition_h */

View File

@@ -0,0 +1,25 @@
//
// SellyCloudRTMPDelegate.h
// SellyCloudSDK
//
// Created by Caleb on 7/7/25.
//
#import <Foundation/Foundation.h>
#import "LFLiveDebug.h"
#import "SellyPublicDefinition.h"
#import "SellyLivePusherStats.h"
NS_ASSUME_NONNULL_BEGIN
@class SellyVideoPusher;
@protocol SellyPusherManagerDelegate <NSObject>
@optional
- (void)pusher:(SellyVideoPusher *)pusher liveStatusDidChanged:(SellyLiveState)status;
- (void)pusher:(SellyVideoPusher *)pusher onError:(NSError *)error;
//视频前处理
- (CVPixelBufferRef)pusher:(SellyVideoPusher *)pusher onCaptureVideoFrame:(CVPixelBufferRef)pixelBuffer;
//直播中stats回调
- (void)pusher:(SellyVideoPusher *)pusher onStatisticsUpdate:(SellyLivePusherStats *)stats;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,30 @@
//
// SellyRTCEngine.h
// SellyCloudSDK
//
// Created by Caleb on 1/11/25.
//
// SellyRTCEngine.h
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface SellyRTCEngine : NSObject
+ (instancetype)sharedEngine;
/// 引擎初始化(只需在 App 启动时调用一次)
- (void)startUp;
/// 创建一次“通话会话”,每次通话都要传入一个新的 transport 实例
//- (SellyRTCP2pSession *)createSessionWithTransport:(id<SellySignalTransport>)transport;
//当前用户id
@property (nonatomic, strong)NSString *userId;
//是否支持simulcast
@property (nonatomic, assign)BOOL supportSimulcast;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,49 @@
//
// SellyRTCP2pStats.h
// SellyCloudSDK
//
// Created by Caleb on 10/11/25.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface SellyRTCP2pStats : NSObject
/// 基本
/// 传输ICE/DTLS
@property(nonatomic, assign) double transportRttMs; // candidate-pair.currentRoundTripTime * 1000
@property(nonatomic, copy, nullable) NSString *relayProtocol; // udp/tcp/tlsTURN时可见
@property(nonatomic, copy) NSString *audioCodec;
@property(nonatomic, copy) NSString *videoCodec;
/// 媒体累计字节
@property(nonatomic, assign) uint64_t txAudioBytes;
@property(nonatomic, assign) uint64_t txVideoBytes;
@property(nonatomic, assign) uint64_t rxAudioBytes;
@property(nonatomic, assign) uint64_t rxVideoBytes;
@property(nonatomic, assign, readonly) uint64_t txBytes; // 汇总
@property(nonatomic, assign, readonly) uint64_t rxBytes;
/// 视频信息(能拿到就填)
@property(nonatomic, assign) double sentFps;
@property(nonatomic, assign) NSInteger sentWidth;
@property(nonatomic, assign) NSInteger sentHeight;
@property(nonatomic, assign) double recvFps;
@property(nonatomic, assign) NSInteger recvWidth;
@property(nonatomic, assign) NSInteger recvHeight;
/// —— 新增:瞬时 Kbps由 Helper 用“前一帧”差分计算)——
@property(nonatomic, assign) double txAudioKbps; // 本次 - 上次 bytes / Δt
@property(nonatomic, assign) double txVideoKbps;
@property(nonatomic, assign) double rxAudioKbps;
@property(nonatomic, assign) double rxVideoKbps;
@property(nonatomic, assign) double txKbps; // = txAudioKbps + txVideoKbps
@property(nonatomic, assign) double rxKbps; // = rxAudioKbps + rxVideoKbps
/// 时间戳(内部用)
@property(nonatomic, assign) NSTimeInterval intervalMs; // 与上次快照的间隔(毫秒),首帧为 0
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,93 @@
//
// SellyRTCSession.h
// SellyCloudSDK
//
// Created by Caleb on 17/11/25.
//
#import <Foundation/Foundation.h>
#import "SellyRTCVideoConfiguration.h"
#import "SellyRTCSessionDelegate.h"
#import <AVFoundation/AVFoundation.h>
#import "SellyRtcVideoCanvas.h"
NS_ASSUME_NONNULL_BEGIN
@interface SellyRTCSession : NSObject
/**
@param isP2p 是否单聊
*/
- (instancetype)initWithType:(BOOL)isP2p;
- (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE;
/**
@brief 发起通话
*/
- (void)startWithChannelId:(NSString *)channelId token:(NSString *)token;
/// 结束通话
- (void)end;
//是否开启本地视频,默认不开启
- (void)enableLocalVideo:(BOOL)enable;
//是否开启本地音频采集,默认开启
- (void)enableLocalAudio:(BOOL)enable;
//切换前后摄像头
- (void)switchCamera;
/**
* Starts the local video preview before joining a channel.
*
* Once you call this method to start the local video preview, if you leave
* the channel by calling \ref leaveChannel: leaveChannel, the local video
* preview remains until you call \ref stopPreview to disable it.
*/
- (void)startPreview;
/**
* Stops the local video preview and the video.
*/
- (void)stopPreview;
/**
屏蔽对方的声音单聊不用传userId
*/
- (void)muteRemoteAudioStream:(NSString *)userId mute:(BOOL)mute;
/**
@brief 设置声音输出通道
如果没有外接设备(蓝牙,耳机)等,可以直接调用这个方法在听筒和扬声器直接来回切换
如果有外接设备建议直接使用AVRoutePickerView
有外接设备的情况下,无法切换为听筒播放,但是可以切换为扬声器播放
*/
- (void)setAudioOutput:(AVAudioSessionPortOverride)port;
/**
发送自定义消息给对方
*/
- (void)sendMessage:(NSString *)message completion:(nonnull void (^)(NSError * _Nullable))completion;
//本地localView
- (void)setLocalCanvas:(SellyRtcVideoCanvas *)localCanvas;
//远程remoteView
- (void)setRemoteCanvas:(SellyRtcVideoCanvas *)remoteCanvas;
//更新token
- (void)renewToken:(NSString * _Nonnull)token;
//
@property (nonatomic, weak)id<SellyRTCSessionDelegate> delegate;
//视频编码设置 需要在startWithChannelId之前调用
@property (nonatomic, strong)SellyRTCVideoConfiguration *videoConfig;
////通话连接状态
@property (nonatomic, assign, readonly)SellyRoomConnectionState connectionState;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,118 @@
//
// SellyRTCSessionDelegate.h
// SellyCloudSDK
//
// Created by Caleb on 5/11/25.
//
#import <Foundation/Foundation.h>
#import "SellyRTCP2pStats.h"
#import "SellyRTCVideoFrame.h"
@class SellyRTCSession;
NS_ASSUME_NONNULL_BEGIN
//流的连接状态
typedef enum : NSUInteger {
SellyRTCConnectStateDisconnected, //断开连接
SellyRTCConnectStateConnecting, //连接中
SellyRTCConnectStateConnected, //连接成功
SellyRTCConnectStateReconnecting, //重连
} SellyRTCConnectState;
@protocol SellyRTCSessionDelegate <NSObject>
@optional
/**
通话报错无法恢复,需要结束流程
*/
- (void)rtcSession:(SellyRTCSession * _Nonnull)session onError:(NSError *)error;
/** A remote user's video was enabled or disabled.
@param enabled Enabled or disabled:
* Yes: User has enabled the video function.
* No: User has disabled the video function.
@param userId Remote user ID.
*/
- (void)rtcSession:(SellyRTCSession * _Nonnull)session videoEnabled:(BOOL)enabled userId:(nullable NSString *)userId;
/** A remote user's audio was enabled or disabled.
@param enabled Enabled or disabled:
* Yes: User has enabled the audio function.
* No: User has disabled the audio function.
@param userId Remote user ID.
*/
- (void)rtcSession:(SellyRTCSession * _Nonnull)session audioEnabled:(BOOL)enabled userId:(nullable NSString *)userId;
/**
收到对方自定义消息
*/
- (void)rtcSession:(SellyRTCSession * _Nonnull)session didReceiveMessage:(NSString *)message userId:(nullable NSString *)userId;
/**
@brief stream连接状态发生改变
*/
- (void)rtcSession:(SellyRTCSession * _Nonnull)session connectionStateChanged:(SellyRTCConnectState)state userId:(nullable NSString *)userId;
/**
@brief 会话连接状态发生改变
会话重连期间内ice会持续重启直到超时
*/
- (void)rtcSession:(SellyRTCSession * _Nonnull)session onRoomConnectionStateChanged:(SellyRoomConnectionState)state;
//视频前处理
- (CVPixelBufferRef)rtcSession:(SellyRTCSession * _Nonnull)session onCaptureVideoFrame:(CVPixelBufferRef)pixelBuffer;
/**
* Occurs each time the SDK receives a video frame sent by the remote user.
*
* After you successfully register the video frame observer, the SDK triggers this callback each time a
* video frame is received. In this callback, you can get the video data sent by the remote user. You
* can then post-process the data according to your scenarios.
*
@return Determines whether to ignore the current video frame if the pre-processing fails:
* - true: Do not ignore.
* - false: Ignore, in which case this method does not sent the current video frame to the SDK.
*/
- (BOOL)rtcSession:(SellyRTCSession *)session onRenderVideoFrame:(SellyRTCVideoFrame *)videoFrame userId:(NSString *)userId;
/**
统计功能
如果是单聊 userId = nil
*/
- (void)rtcSession:(SellyRTCSession * _Nonnull)session onStats:(SellyRTCP2pStats *)stats userId:(nullable NSString *)userId;
/**
用户加入频道
*/
- (void)rtcSession:(SellyRTCSession * _Nonnull)session onUserJoined:(nullable NSString *)userId;
/**
用户离开频道
*/
- (void)rtcSession:(SellyRTCSession * _Nonnull)session onUserLeave:(nullable NSString *)userId;
/**
通话时长回调
*/
- (void)rtcSession:(SellyRTCSession * _Nonnull)session onDuration:(NSInteger)duration;
/**
收到token将要过期消息
@param token The token that will expire in 60 seconds.
*/
- (void)rtcSession:(SellyRTCSession * _Nonnull)session tokenWillExpire:(NSString *)token;
/**
收到token已过期消息
token过期后依然可以正常通话但是断网重连会失败
*/
- (void)rtcSession:(SellyRTCSession * _Nonnull)session tokenExpired:(NSString *)token;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,45 @@
//
// SellyRTCVideoConfiguration.h
// SellyCloudSDK
//
// Created by Caleb on 5/11/25.
//
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
NS_ASSUME_NONNULL_BEGIN
typedef CGSize SellyRTCVideoResolution;
extern SellyRTCVideoResolution const SellyRTCVideoResolution480x360;
extern SellyRTCVideoResolution const SellyRTCVideoResolution480x480;
extern SellyRTCVideoResolution const SellyRTCVideoResolution640x360;
extern SellyRTCVideoResolution const SellyRTCVideoResolution640x480;
extern SellyRTCVideoResolution const SellyRTCVideoResolution960x540;
extern SellyRTCVideoResolution const SellyRTCVideoResolution1280x720;
typedef NS_ENUM(NSInteger, SellyVideoCodecType) {
SellyVideoCodecTypeH264 = 1,
SellyVideoCodecTypeH265 = 2,
};
@interface SellyRTCVideoConfiguration : NSObject
//分辨率
@property(assign, nonatomic) SellyRTCVideoResolution resolution;
//帧率
@property(assign, nonatomic) NSInteger frameRate;
//最大码率 bps
@property(assign, nonatomic) NSInteger maxBitrate;
//最小码率 bps
@property(assign, nonatomic) NSInteger minBitrate;
/**
会议模式仅支持h264单聊支持h264h265
*/
@property (nonatomic, assign) SellyVideoCodecType preferCodec;
//默认使用前/后置摄像头
@property (nonatomic, assign)AVCaptureDevicePosition preferPosition;
+ (instancetype)defaultConfig;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,29 @@
//
// SCSVideoFrame.h
// SellyCloudSDK
//
// Created by Caleb on 19/11/25.
//
#import <Foundation/Foundation.h>
#import <CoreMedia/CoreMedia.h>
NS_ASSUME_NONNULL_BEGIN
@interface SellyRTCVideoFrame : NSObject
/// 宽度(像素)
@property (nonatomic, assign) int width;
/// 高度(像素)
@property (nonatomic, assign) int height;
/// 旋转角度0 / 90 / 180 / 270
@property (nonatomic, assign) NSInteger rotation;
/// 时间戳(可选)
@property (nonatomic, assign) int64_t timestamp;
/// 像素数据
@property (nonatomic, assign, nullable) CVPixelBufferRef pixelBuffer;
/// 业务元信息
@property (nonatomic, copy, nullable) NSString *uid;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,23 @@
//
// SellyRtcVideoCanvas.h
// SellyCloudSDK
//
// Created by Caleb on 11/11/25.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
@interface SellyRtcVideoCanvas : NSObject
//用户id
@property(strong, nonatomic) NSString *userId;
/**
*The video display view.
*/
@property(strong, nonatomic) UIView *_Nullable view;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,56 @@
//
// SellyVideoPlayer.h
// SellyCloudSDK
//
// Created by Caleb on 17/9/25.
//
/**
1、SellyVODPlayer、SellyCloudRtmpPlayer、SellyRtcPlayer将事件通过SellyPlayerDelegate代理回调到SellyVideoPlayer
2、SellyVideoPlayer将收到的事件汇总处理后通过SellyPlayerManagerDelegate回调给业务层
*/
#import <Foundation/Foundation.h>
#import "SellyPlayerStreamInfo.h"
@protocol SellyPlayerManagerDelegate;
NS_ASSUME_NONNULL_BEGIN
@interface SellyVideoPlayer : NSObject
//接盾的情况下请调用该方法初始化
- (instancetype)initWithStreamInfo:(SellyPlayerStreamInfo *)streamInfo;
- (instancetype)initWithUrl:(NSURL *)url;
- (void)prepareToPlay;
- (void)play;
- (void)pause;
- (void)stop;
- (BOOL)isPlaying;
/** 截取当前图片 */
- (UIImage *)getCurrentImage;
//业务层需要将这个view加在页面上显示
@property (nonatomic, strong, readonly)UIView *view;
//代理
@property (nonatomic, weak) id<SellyPlayerManagerDelegate> delegate;
//音量 静音播放设置0即可
@property (nonatomic, assign) CGFloat playbackVolume;
//播放状态
@property(nonatomic, readonly) SellyPlayerState playbackState;
//缩放
@property (nonatomic, assign)SellyPlayerScalingMode scaleMode;
#warning 以下属性对点播生效
//是否自动开始播放默认true
@property(nonatomic) BOOL shouldAutoplay;
//视频时长
@property(nonatomic, readonly) NSTimeInterval duration;
//可播放时长
@property(nonatomic, readonly) NSTimeInterval playableDuration;
@property(nonatomic) NSTimeInterval currentPlaybackTime;
@property(nonatomic, readonly) BOOL isPreparedToPlay;
@property(nonatomic) float playbackRate;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,109 @@
//
// SellyVideoPusher.h
// SellyCloudSDK
//
// Created by Caleb on 18/9/25.
//
#import <Foundation/Foundation.h>
#import <AVFoundation/AVFoundation.h>
#import "SellyPusherManagerDelegate.h"
#import "SellyPlayerStreamInfo.h"
NS_ASSUME_NONNULL_BEGIN
@interface SellyVideoPusher : NSObject
//接盾的情况下请调用该方法初始化rtc推流也通过该方法
- (instancetype)initWithStreamInfo:(SellyPlayerStreamInfo *)streamInfo;
- (instancetype)initWithUrl:(NSString *)url;
/**
是否开启本地预览镜像
*/
@property (nonatomic, assign)BOOL mirror;
/**
开始采集音视频流程,默认会采集语音和视频
@param captureDevicePosition 使用前置还是后置摄像头
@param videoConfig 视频采集/推流参数传nil将使用默认推流参数
@param audioConfig 音频采集/推流参数传nil将使用默认推流参数
*/
- (void)startRunning:(AVCaptureDevicePosition)captureDevicePosition videoConfig:(nullable SellyLiveVideoConfiguration *)videoConfig audioConfig:(nullable SellyLiveAudioConfiguration *)audioConfig;
/**
纯语音直播调用该方法,开始采集语音流程,不会采集视频
无法在直播中开启视频需要开关摄像头的请调用startRunning:videoConfig:audioConfig:方法
@param audioConfig 音频采集/推流参数传nil将使用默认推流参数
*/
- (void)startRunningAudio:(nullable SellyLiveAudioConfiguration *)audioConfig;
/**
开启视频采集,中途关闭摄像头再次开启需要调用
*/
- (nullable NSError *)startCamera;
/**
停止视频采集,中途关闭摄像头调用
*/
- (void)stopCamera;
/**
切换前后摄像头
*/
- (void)switchCameraPosition:(void (^)(NSError * _Nullable error))completion;
/**
开启音频采集
*/
- (void)startMicrophone;
/**
停止语音采集
*/
- (void)stopMicrophone;
/**
开始推流
@return 返回nil表示流程成功不代表推流成功
*/
- (nullable NSError *)startLive;
/**
停止推流
*/
- (void)stopLive:(void(^)(NSError *error))callback;
/**
截取当前图片
*/
- (UIImage *)getCurrentImage;
/**
推送静态图片调用1次即可不用循环调用
*/
- (void)pushStaticImage:(UIImage *)image;
/**
停止推送静态图片
*/
- (void)stopPushImage;
/**
本地预览view
*/
@property (nonatomic, strong)UIView *preview;
/**
回调
*/
@property (nonatomic, weak)id<SellyPusherManagerDelegate> delegate;
@property (nonatomic, assign, readonly)BOOL isMute;
@property (nonatomic, assign, readonly)BOOL isCameraEnable;
@property (nonatomic, assign, readonly)SellyLiveState liveState;
/**
是否支持视频前置处理,例如实现美颜功能. default no
*/
@property (nonatomic, assign)BOOL enableCustomVideoProcess;
//当前的摄像头方向
@property (nonatomic, assign)AVCaptureDevicePosition captureDevicePosition;
//缩放
@property (nonatomic, assign)SellyPlayerScalingMode scaleMode;
@end
NS_ASSUME_NONNULL_END

Binary file not shown.

View File

@@ -0,0 +1,9 @@
{
"ABIRoot": {
"kind": "Root",
"name": "NO_MODULE",
"printedName": "NO_MODULE",
"json_format_version": 8
},
"ConstValues": []
}

View File

@@ -0,0 +1,11 @@
framework module SellyCloudSDK {
umbrella header "SellyCloudSDK-umbrella.h"
export *
module * { export * }
}
module SellyCloudSDK.Swift {
header "SellyCloudSDK-Swift.h"
requires objc
}

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB