支持业务层直接推送视频帧,支持屏幕共享推流

This commit is contained in:
Caleb
2025-12-11 16:52:45 +08:00
parent 14431c1570
commit b85cee5d0d
17 changed files with 209 additions and 182 deletions

View File

@@ -12,6 +12,7 @@
#import "UIView+SellyCloud.h"
#import "SLSVideoGridView.h"
#import "TokenGenerator.h"
#import <ReplayKit/ReplayKit.h> //
@interface SellyVideoCallConferenceController ()<SellyRTCSessionDelegate>
@@ -23,7 +24,7 @@
@property (weak, nonatomic) IBOutlet SLSVideoGridView *grid;
@property (weak, nonatomic) IBOutlet UILabel *duration;
@property (nonatomic, strong)RPSystemBroadcastPickerView *systemBroadcastPicker;
@end
@implementation SellyVideoCallConferenceController
@@ -60,6 +61,29 @@
//view
[self attachLocalStream];
self.localAudioEnable = true;
[self addBroadcastButton];
}
- (void)addBroadcastButton {
if (@available(iOS 12.0, *)) {
self.systemBroadcastPicker = [[RPSystemBroadcastPickerView alloc]
initWithFrame:CGRectMake(UIScreen.mainScreen.bounds.size.width-80, UIScreen.mainScreen.bounds.size.height-180, 60, 60)];
NSString *bundleId = [NSBundle mainBundle].bundleIdentifier;
self.systemBroadcastPicker.preferredExtension = [NSString stringWithFormat:@"%@.ScreenShareUploader",bundleId];// extension bundle id
self.systemBroadcastPicker.showsMicrophoneButton = false;
}
}
- (IBAction)startScreenCapture:(id)sender {
for (UIView *view in self.systemBroadcastPicker.subviews) {
if ([view isKindOfClass:[UIButton class]]) {
[((UIButton *)view) sendActionsForControlEvents:(UIControlEventAllEvents)];
break;
}
}
}
- (void)viewDidDisappear:(BOOL)animated {
@@ -187,6 +211,17 @@
[session renewToken:newToken];
}
- (void)rtcSession:(SellyRTCSession *)session onScreenShareStatusChanged:(SellyScreenShareState)state {
if (state == SellyScreenShareStateStarted) {
self.localVideoEnable = false;
[self.session startScreenCapture];
}
else if (state == SellyScreenShareStateStopped) {
self.localVideoEnable = true;
[self.session enableLocalVideo:true];
}
}
- (SellyRTCSession *)session {
if (!_session) {
_session = [[SellyRTCSession alloc] initWithType:false];