支持业务层直接推送视频帧,支持屏幕共享推流
This commit is contained in:
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user