|
@@ -98,3 +98,104 @@ cardDensity:(NSInteger)cardDensity
|
|
|
@end
|
|
|
|
|
|
#endif /* AMediaStream_h */
|
|
|
+//
|
|
|
+// AMediaStream.h
|
|
|
+// all
|
|
|
+//
|
|
|
+// Created by admin on 2024/3/14.
|
|
|
+//
|
|
|
+
|
|
|
+#ifndef AMediaStream_h
|
|
|
+#define AMediaStream_h
|
|
|
+
|
|
|
+#import <Foundation/Foundation.h>
|
|
|
+#import <WebRTC/RTCPeerConnection.h>
|
|
|
+#import <WebRTC/RTCDataChannel.h>
|
|
|
+#import <WebRTC/RTCStatisticsReport.h>
|
|
|
+#import <WebRTC/RTCVideoRenderer.h>
|
|
|
+
|
|
|
+RTC_OBJC_EXPORT
|
|
|
+@protocol RTC_OBJC_TYPE(MediaStreamClientEventsDelegate) <NSObject>
|
|
|
+
|
|
|
+- (void)dataChannelDidChangeFromPeerName:(NSString*)peerName State:(RTCDataChannelState)state;
|
|
|
+
|
|
|
+-(void)onChannelDataFromPeerName:(NSString*)peerName buffer:(RTC_OBJC_TYPE(RTCDataBuffer) *)buffer;
|
|
|
+
|
|
|
+-(void)onChangeConnectionStateFromPeerName:(NSString*)peerName didChangeIceConnectionState:(RTCIceConnectionState)state;
|
|
|
+
|
|
|
+-(void)onFrameResolutionChangedFromPeerName:(NSString*)peerName videoWidth:(int)videoWidth videoHeight:(int)videoHeight rotation:(int)rotation;
|
|
|
+
|
|
|
+-(void)didGetStats:(NSString*)peerName stats:(RTC_OBJC_TYPE(RTCStatisticsReport) *)stats;
|
|
|
+
|
|
|
+//code 0 成功 1失败
|
|
|
+-(void)onAuthResultFromPeerName:(NSString*)peerName code:(int)code descriptions:(NSString*)descriptions;
|
|
|
+
|
|
|
+@end
|
|
|
+
|
|
|
+RTC_OBJC_EXPORT
|
|
|
+@interface RTC_OBJC_TYPE(AMediaStream) : UIView
|
|
|
+
|
|
|
++(void)globalInitialization;
|
|
|
+
|
|
|
++(void)globalDeinitialization;
|
|
|
+
|
|
|
+-(instancetype)initWithFrame:(CGRect)frame;
|
|
|
+
|
|
|
+//NSDictionary *iceMessage=@{
|
|
|
+// @"CHINANET":@"电信",
|
|
|
+// @"CMNET":@"移动",
|
|
|
+// @"UNICOM":@"联通"
|
|
|
+//};
|
|
|
+
|
|
|
+-(int)start:(NSURL *)url
|
|
|
+ ice:(NSDictionary*)ice
|
|
|
+ sn:(NSString*)sn
|
|
|
+ direct:(NSInteger)direct
|
|
|
+ fmt:(NSInteger)fmt
|
|
|
+ videoWidth:(NSInteger)videoWidth
|
|
|
+videoHeight:(NSInteger)videoHeight
|
|
|
+ fps:(NSInteger)fps
|
|
|
+ bitrate:(NSInteger)bitrate
|
|
|
+ cardWidth:(NSInteger)cardWidth
|
|
|
+ cardHeight:(NSInteger)cardHeight
|
|
|
+cardDensity:(NSInteger)cardDensity
|
|
|
+ token:(NSString*)token;
|
|
|
+
|
|
|
+- (int)startUploadChannel:(NSURL *)url
|
|
|
+ ice:(NSDictionary*)ice
|
|
|
+ sn:(NSString*)sn
|
|
|
+ token:(NSString*)token;
|
|
|
+
|
|
|
+- (void)disconnect;
|
|
|
+
|
|
|
+- (BOOL)sendData:(NSString*)strData;
|
|
|
+
|
|
|
+- (BOOL)sendBinary:(NSData*)data;
|
|
|
+
|
|
|
+- (void)sendKey:(int)value;
|
|
|
+
|
|
|
+- (void)pauseStream;
|
|
|
+
|
|
|
+- (void)resumeStream;
|
|
|
+
|
|
|
+- (void)setMaxBitrate:(NSNumber*)rate;
|
|
|
+
|
|
|
+- (void)setShouldGetStats:(BOOL)shouldGetStats;
|
|
|
+
|
|
|
+- (void)setVideoContentMode:(UIViewContentMode)mode;
|
|
|
+
|
|
|
+- (void)setCardSize:(NSInteger)cardWidth
|
|
|
+ cardHeight:(NSInteger)cardHeight
|
|
|
+ cardDensity:(NSInteger)cardDensity;
|
|
|
+
|
|
|
+- (void)setVideoSize:(NSInteger)videoWidth
|
|
|
+ videoHeight:(NSInteger)videoHeight;
|
|
|
+
|
|
|
+
|
|
|
+@property (nonatomic, weak) id <MediaStreamClientEventsDelegate> eventDelegate;
|
|
|
+@property(nonatomic,readonly) NSString *name;
|
|
|
+@property(nonatomic, assign) BOOL shouldGetStats;
|
|
|
+
|
|
|
+@end
|
|
|
+
|
|
|
+#endif /* AMediaStream_h */
|