Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

#import "include/stream_webrtc_flutter/FlutterRTCDesktopCapturer.h"

#if TARGET_OS_IPHONE
#import <ReplayKit/ReplayKit.h>
#import "include/stream_webrtc_flutter/Broadcast/FlutterBroadcastScreenCapturer.h"
#import "include/stream_webrtc_flutter/FlutterRPScreenRecorder.h"
#endif
#import "include/stream_webrtc_flutter/LocalVideoTrack.h"
#import "include/stream_webrtc_flutter/NativePeerConnectionFactory.h"
#import "include/stream_webrtc_flutter/VideoProcessingAdapter.h"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#import "include/stream_webrtc_flutter/FlutterRTCFrameCapturer.h"
#if TARGET_OS_IPHONE
#import <Flutter/Flutter.h>
#else
#import <FlutterMacOS/FlutterMacOS.h>
#endif

@import CoreImage;
@import CoreVideo;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#import "include/stream_webrtc_flutter/FlutterRTCMediaStream.h"
#import <objc/runtime.h>
#import "AVKit/AVKit.h"
#if TARGET_OS_IPHONE
#import "include/stream_webrtc_flutter/AudioUtils.h"
#endif
#import "include/stream_webrtc_flutter/CameraUtils.h"
#import "include/stream_webrtc_flutter/FlutterRTCFrameCapturer.h"
#import "include/stream_webrtc_flutter/FlutterRTCPeerConnection.h"
Expand All @@ -10,9 +12,7 @@
#import "include/stream_webrtc_flutter/NativePeerConnectionFactory.h"
#import "include/stream_webrtc_flutter/VideoProcessingAdapter.h"
#if TARGET_OS_OSX
// Only present in the common/darwin Classes (macOS-only). The iOS tree is
// iOS-only at deploy-target level so this import is a no-op there.
#import "StreamMacAudioDevices.h"
#import "include/stream_webrtc_flutter/StreamMacAudioDevices.h"
#endif

@implementation RTCMediaStreamTrack (Flutter)
Expand Down Expand Up @@ -84,7 +84,7 @@ - (RTCMediaConstraints*)defaultMediaStreamConstraints {
#endif
];

#if !defined(TARGET_OS_IPHONE)
#if TARGET_OS_OSX
if (@available(macOS 13.0, *)) {
deviceTypes = [deviceTypes arrayByAddingObject:AVCaptureDeviceTypeDeskViewCamera];
}
Expand Down Expand Up @@ -157,7 +157,7 @@ - (void)getUserAudio:(NSDictionary*)constraints
rtcConstraints = [self parseMediaConstraints:[self defaultAudioConstraints]];
}

#if !defined(TARGET_OS_IPHONE)
#if TARGET_OS_OSX
if (audioDeviceId != nil) {
[self selectAudioInput:audioDeviceId result:nil];
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
#import "include/stream_webrtc_flutter/FlutterRTCPeerConnection.h"
#import <objc/runtime.h>
#import "include/stream_webrtc_flutter/AudioUtils.h"
#import <StreamWebRTC/StreamWebRTC.h>
#import "include/stream_webrtc_flutter/FlutterRTCDataChannel.h"
#import "include/stream_webrtc_flutter/FlutterWebRTCPlugin.h"
#import "include/stream_webrtc_flutter/NativePeerConnectionFactory.h"

#if TARGET_OS_IPHONE
#import <StreamWebRTC/StreamWebRTC.h>
#elif TARGET_OS_MAC
#import <WebRTC/WebRTC.h>
#endif
@implementation RTCPeerConnection (Flutter)

@dynamic eventSink;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
#import "include/stream_webrtc_flutter/FlutterWebRTCPlugin.h"
#if TARGET_OS_IPHONE
#import "include/stream_webrtc_flutter/AudioUtils.h"
#endif
#import "include/stream_webrtc_flutter/CameraUtils.h"

#import "include/stream_webrtc_flutter/AudioManager.h"
#import "include/stream_webrtc_flutter/FlutterDataPacketCryptor.h"
#import "include/stream_webrtc_flutter/FlutterRTCDataChannel.h"
#import "include/stream_webrtc_flutter/FlutterRTCDesktopCapturer.h"
#import "include/stream_webrtc_flutter/FlutterRTCEncryptionManager.h"
#import "include/stream_webrtc_flutter/FlutterRTCMediaRecorder.h"
#import "include/stream_webrtc_flutter/FlutterRTCMediaStream.h"
#import "include/stream_webrtc_flutter/FlutterRTCPeerConnection.h"
#if TARGET_OS_IPHONE
#import "include/stream_webrtc_flutter/FlutterRTCMediaRecorder.h"
#import "include/stream_webrtc_flutter/FlutterRTCVideoPlatformViewController.h"
#import "include/stream_webrtc_flutter/FlutterRTCVideoPlatformViewFactory.h"
#endif
#import "include/stream_webrtc_flutter/FlutterRTCVideoRenderer.h"
#import "include/stream_webrtc_flutter/ProcessorProvider.h"
#import "include/stream_webrtc_flutter/VideoEffectProcessor.h"
Expand Down Expand Up @@ -125,9 +129,9 @@ @implementation FlutterWebRTCPlugin {
AVAudioSessionPort _preferredInput;
#endif
AudioManager* _audioManager;
BOOL _stereoPlayoutPreferred;
#if TARGET_OS_IPHONE
FLutterRTCVideoPlatformViewFactory* _platformViewFactory;
BOOL _stereoPlayoutPreferred;
dispatch_block_t _stereoRefreshDebounceBlock;
#endif

Expand Down Expand Up @@ -213,7 +217,9 @@ - (instancetype)initWithChannel:(FlutterMethodChannel*)channel
self.renders = [NSMutableDictionary new];
self.videoCapturerStopHandlers = [NSMutableDictionary new];
self.videoCaptureState = [NSMutableDictionary new];
#if TARGET_OS_IPHONE
self.recorders = [NSMutableDictionary new];
#endif
self.trackVolumeCache = [NSMutableDictionary new];
self.pausedTrackVolumes = [NSMutableDictionary new];
_factories = [NSMutableDictionary new];
Expand Down Expand Up @@ -2114,10 +2120,12 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result {
}
dispatch_async(nf.admQueue, ^{
if (nf.audioSuspended) {
#if TARGET_OS_IPHONE
NSDictionary* audioConfigSnapshot = nf.audioConfigSnapshot;
if (audioConfigSnapshot != nil) {
[AudioUtils setAppleAudioConfiguration:audioConfigSnapshot];
}
#endif
BOOL restorePlaying = nf.wasPlayingBeforeSuspend;
BOOL restoreRecording = nf.wasRecordingBeforeSuspend;
if (restorePlaying) {
Expand Down Expand Up @@ -2417,6 +2425,10 @@ - (void)mediaStreamTrackSetVideoEffects:(nonnull NSString*)trackId
}

- (void)enableMultitaskingCameraAccess:(BOOL)enable result:(FlutterResult)result {
#if TARGET_OS_OSX
NSLog(@"enableMultitaskingCameraAccess: Multitasking camera access is not available on macOS.");
result(@NO);
#else
@try {
AVCaptureSession* session = self.videoCapturer.captureSession;
if (session == nil) {
Expand All @@ -2425,11 +2437,6 @@ - (void)enableMultitaskingCameraAccess:(BOOL)enable result:(FlutterResult)result
return;
}

#if TARGET_OS_OSX
NSLog(@"enableMultitaskingCameraAccess: Multitasking camera access is not available on macOS.");
result(@NO);
return;
#else
if (@available(iOS 16.0, *)) {
BOOL shouldChange = session.multitaskingCameraAccessEnabled != enable;
BOOL canChange = !enable || (enable && session.isMultitaskingCameraAccessSupported);
Expand All @@ -2456,12 +2463,12 @@ - (void)enableMultitaskingCameraAccess:(BOOL)enable result:(FlutterResult)result
@"enableMultitaskingCameraAccess: Multitasking camera access requires iOS 16 or later.");
result(@NO);
}
#endif
} @catch (NSException* exception) {
NSLog(@"enableMultitaskingCameraAccess: Exception occurred: %@ - %@", exception.name,
exception.reason);
result(@NO);
}
#endif
}

- (void)mediaStreamGetTracks:(NSString*)streamId result:(FlutterResult)result {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#import "include/stream_webrtc_flutter/NativePeerConnectionFactory.h"
#if TARGET_OS_IPHONE
#import "include/stream_webrtc_flutter/AudioUtils.h"
#endif
#import "include/stream_webrtc_flutter/VideoFactoriesPrivate.h"

#import <StreamWebRTC/StreamWebRTC.h>
Expand Down Expand Up @@ -30,9 +32,11 @@ - (instancetype)initWithFactoryId:(NSString*)factoryId
dispatch_queue_attr_make_with_qos_class(DISPATCH_QUEUE_SERIAL, QOS_CLASS_USER_INITIATED,
0));

#if TARGET_OS_IPHONE
if (appleAudioConfiguration != nil) {
[AudioUtils setAppleAudioConfiguration:appleAudioConfiguration];
}
#endif

VideoDecoderFactory* decoderFactory = [[VideoDecoderFactory alloc] init];
VideoEncoderFactory* encoderFactory = [[VideoEncoderFactory alloc] init];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#if TARGET_OS_IPHONE
#import <Flutter/Flutter.h>
#else
#import <FlutterMacOS/FlutterMacOS.h>
#endif
#import <StreamWebRTC/StreamWebRTC.h>

#import "FlutterWebRTCPlugin.h"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#if TARGET_OS_IPHONE
#import <Flutter/Flutter.h>
#else
#import <FlutterMacOS/FlutterMacOS.h>
#endif
#import <Foundation/Foundation.h>
#import <StreamWebRTC/StreamWebRTC.h>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#if TARGET_OS_IPHONE
#import <Flutter/Flutter.h>
#else
#import <FlutterMacOS/FlutterMacOS.h>
#endif
#import <StreamWebRTC/StreamWebRTC.h>

#import "FlutterWebRTCPlugin.h"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#if TARGET_OS_IPHONE
#import <Flutter/Flutter.h>
#else
#import <FlutterMacOS/FlutterMacOS.h>
#endif
#import <StreamWebRTC/StreamWebRTC.h>

@interface FlutterRTCFrameCapturer : NSObject <RTCVideoRenderer>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
#if TARGET_OS_IPHONE
#import <Flutter/Flutter.h>
#else
#import <FlutterMacOS/FlutterMacOS.h>
#endif
#import <Foundation/Foundation.h>
#import <StreamWebRTC/StreamWebRTC.h>
#import "LocalTrack.h"

@class VideoEffectProcessor;
@class FlutterRTCVideoRenderer;
@class FlutterRTCFrameCapturer;
#if TARGET_OS_IPHONE
@class FlutterRTCMediaRecorder;
#endif
@class AudioManager;
@class NativePeerConnectionFactory;

Expand All @@ -19,13 +25,11 @@ typedef void (^CapturerStopHandler)(CompletionHandler _Nonnull handler);
@interface FlutterWebRTCPlugin : NSObject <FlutterPlugin,
RTCPeerConnectionDelegate,
RTCAudioDeviceModuleDelegate,
FlutterStreamHandler
#if TARGET_OS_OSX
,
RTCDesktopMediaListDelegate,
RTCDesktopCapturerDelegate
RTCDesktopCapturerDelegate,
#endif
>
FlutterStreamHandler>

/**
* Per-call factory registry, keyed by factoryId.
Expand Down Expand Up @@ -55,8 +59,10 @@ typedef void (^CapturerStopHandler)(CompletionHandler _Nonnull handler);
@property(nonatomic, strong) NSMutableDictionary<NSString*, id<LocalTrack>>* _Nullable localTracks;
@property(nonatomic, strong)
NSMutableDictionary<NSNumber*, FlutterRTCVideoRenderer*>* _Nullable renders;
#if TARGET_OS_IPHONE
@property(nonatomic, strong)
NSMutableDictionary<NSNumber*, FlutterRTCMediaRecorder*>* _Nonnull recorders;
#endif
@property(nonatomic, strong)
NSMutableDictionary<NSString*, CapturerStopHandler>* _Nullable videoCapturerStopHandlers;
@property(nonatomic, strong)
Expand Down
Loading
Loading