macOS support (#33)
* mac os support 1 * entitlements * fix updateTrack bug * clean * throws on mac * simplify structure * lock
This commit is contained in:
@@ -8,7 +8,7 @@ PODS:
|
|||||||
- livekit_client (0.5.3):
|
- livekit_client (0.5.3):
|
||||||
- Flutter
|
- Flutter
|
||||||
- WebRTC-SDK (~> 92.4515)
|
- WebRTC-SDK (~> 92.4515)
|
||||||
- path_provider (0.0.1):
|
- path_provider_ios (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- shared_preferences (0.0.1):
|
- shared_preferences (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
@@ -18,7 +18,7 @@ DEPENDENCIES:
|
|||||||
- Flutter (from `Flutter`)
|
- Flutter (from `Flutter`)
|
||||||
- flutter_webrtc (from `.symlinks/plugins/flutter_webrtc/ios`)
|
- flutter_webrtc (from `.symlinks/plugins/flutter_webrtc/ios`)
|
||||||
- livekit_client (from `.symlinks/plugins/livekit_client/ios`)
|
- livekit_client (from `.symlinks/plugins/livekit_client/ios`)
|
||||||
- path_provider (from `.symlinks/plugins/path_provider/ios`)
|
- path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
|
||||||
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
|
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
|
||||||
|
|
||||||
SPEC REPOS:
|
SPEC REPOS:
|
||||||
@@ -33,8 +33,8 @@ EXTERNAL SOURCES:
|
|||||||
:path: ".symlinks/plugins/flutter_webrtc/ios"
|
:path: ".symlinks/plugins/flutter_webrtc/ios"
|
||||||
livekit_client:
|
livekit_client:
|
||||||
:path: ".symlinks/plugins/livekit_client/ios"
|
:path: ".symlinks/plugins/livekit_client/ios"
|
||||||
path_provider:
|
path_provider_ios:
|
||||||
:path: ".symlinks/plugins/path_provider/ios"
|
:path: ".symlinks/plugins/path_provider_ios/ios"
|
||||||
shared_preferences:
|
shared_preferences:
|
||||||
:path: ".symlinks/plugins/shared_preferences/ios"
|
:path: ".symlinks/plugins/shared_preferences/ios"
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ SPEC CHECKSUMS:
|
|||||||
flutter_webrtc: a5a79904f0bca0ea23aff49c51ca765f70a0f703
|
flutter_webrtc: a5a79904f0bca0ea23aff49c51ca765f70a0f703
|
||||||
Libyuv: 5f79ced0ee66e60a612ca97de1e6ccacd187a437
|
Libyuv: 5f79ced0ee66e60a612ca97de1e6ccacd187a437
|
||||||
livekit_client: 2b15f8f6f37bc447184af227bd66d30ed1c5fd38
|
livekit_client: 2b15f8f6f37bc447184af227bd66d30ed1c5fd38
|
||||||
path_provider: d1e9807085df1f9cc9318206cd649dc0b76be3de
|
path_provider_ios: 7d7ce634493af4477d156294792024ec3485acd5
|
||||||
shared_preferences: 5033afbb22d372e15aff8ff766df9021b845f273
|
shared_preferences: 5033afbb22d372e15aff8ff766df9021b845f273
|
||||||
WebRTC-SDK: 21dbc6028a68f3a89718057a2caa970a4da8ebb7
|
WebRTC-SDK: 21dbc6028a68f3a89718057a2caa970a4da8ebb7
|
||||||
|
|
||||||
|
|||||||
@@ -6,11 +6,13 @@ import FlutterMacOS
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
import flutter_webrtc
|
import flutter_webrtc
|
||||||
|
import livekit_client
|
||||||
import path_provider_macos
|
import path_provider_macos
|
||||||
import shared_preferences_macos
|
import shared_preferences_macos
|
||||||
|
|
||||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||||
FlutterWebRTCPlugin.register(with: registry.registrar(forPlugin: "FlutterWebRTCPlugin"))
|
FlutterWebRTCPlugin.register(with: registry.registrar(forPlugin: "FlutterWebRTCPlugin"))
|
||||||
|
LiveKitPlugin.register(with: registry.registrar(forPlugin: "LiveKitPlugin"))
|
||||||
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
|
||||||
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,21 @@
|
|||||||
PODS:
|
PODS:
|
||||||
- flutter_webrtc (0.2.3):
|
- flutter_webrtc (0.7.1):
|
||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
- WebRTC-SDK (= 92.4515.10)
|
- WebRTC-SDK (= 92.4515.11)
|
||||||
- FlutterMacOS (1.0.0)
|
- FlutterMacOS (1.0.0)
|
||||||
|
- livekit_client (0.5.3):
|
||||||
|
- FlutterMacOS
|
||||||
|
- WebRTC-SDK (~> 92.4515)
|
||||||
- path_provider_macos (0.0.1):
|
- path_provider_macos (0.0.1):
|
||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
- shared_preferences_macos (0.0.1):
|
- shared_preferences_macos (0.0.1):
|
||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
- WebRTC-SDK (92.4515.10)
|
- WebRTC-SDK (92.4515.11)
|
||||||
|
|
||||||
DEPENDENCIES:
|
DEPENDENCIES:
|
||||||
- flutter_webrtc (from `Flutter/ephemeral/.symlinks/plugins/flutter_webrtc/macos`)
|
- flutter_webrtc (from `Flutter/ephemeral/.symlinks/plugins/flutter_webrtc/macos`)
|
||||||
- FlutterMacOS (from `Flutter/ephemeral`)
|
- FlutterMacOS (from `Flutter/ephemeral`)
|
||||||
|
- livekit_client (from `Flutter/ephemeral/.symlinks/plugins/livekit_client/macos`)
|
||||||
- path_provider_macos (from `Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos`)
|
- path_provider_macos (from `Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos`)
|
||||||
- shared_preferences_macos (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_macos/macos`)
|
- shared_preferences_macos (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_macos/macos`)
|
||||||
|
|
||||||
@@ -24,17 +28,20 @@ EXTERNAL SOURCES:
|
|||||||
:path: Flutter/ephemeral/.symlinks/plugins/flutter_webrtc/macos
|
:path: Flutter/ephemeral/.symlinks/plugins/flutter_webrtc/macos
|
||||||
FlutterMacOS:
|
FlutterMacOS:
|
||||||
:path: Flutter/ephemeral
|
:path: Flutter/ephemeral
|
||||||
|
livekit_client:
|
||||||
|
:path: Flutter/ephemeral/.symlinks/plugins/livekit_client/macos
|
||||||
path_provider_macos:
|
path_provider_macos:
|
||||||
:path: Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos
|
:path: Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos
|
||||||
shared_preferences_macos:
|
shared_preferences_macos:
|
||||||
:path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_macos/macos
|
:path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_macos/macos
|
||||||
|
|
||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
flutter_webrtc: 8d69a6819b422e5caf1c7b2844a05bc6a62b437b
|
flutter_webrtc: eb68063546a533bb98f0fbcc7b54daf62edea4ed
|
||||||
FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424
|
FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424
|
||||||
|
livekit_client: b137f094e90d910cfa846b282ad41e0e4a6a029b
|
||||||
path_provider_macos: 160cab0d5461f0c0e02995469a98f24bdb9a3f1f
|
path_provider_macos: 160cab0d5461f0c0e02995469a98f24bdb9a3f1f
|
||||||
shared_preferences_macos: 480ce071d0666e37cef23fe6c702293a3d21799e
|
shared_preferences_macos: 480ce071d0666e37cef23fe6c702293a3d21799e
|
||||||
WebRTC-SDK: dabc6471c193814aeb0ad9e6712052567acff601
|
WebRTC-SDK: 21dbc6028a68f3a89718057a2caa970a4da8ebb7
|
||||||
|
|
||||||
PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c
|
PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,10 @@
|
|||||||
<true/>
|
<true/>
|
||||||
<key>com.apple.security.cs.allow-jit</key>
|
<key>com.apple.security.cs.allow-jit</key>
|
||||||
<true/>
|
<true/>
|
||||||
|
<key>com.apple.security.device.audio-input</key>
|
||||||
|
<true/>
|
||||||
|
<key>com.apple.security.device.camera</key>
|
||||||
|
<true/>
|
||||||
<key>com.apple.security.network.client</key>
|
<key>com.apple.security.network.client</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>com.apple.security.network.server</key>
|
<key>com.apple.security.network.server</key>
|
||||||
|
|||||||
@@ -2,8 +2,6 @@
|
|||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>NSMicrophoneUsageDescription</key>
|
|
||||||
<string>Please enable mic to publish.</string>
|
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
<string>$(DEVELOPMENT_LANGUAGE)</string>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
@@ -26,13 +24,15 @@
|
|||||||
<string>public.app-category.developer-tools</string>
|
<string>public.app-category.developer-tools</string>
|
||||||
<key>LSMinimumSystemVersion</key>
|
<key>LSMinimumSystemVersion</key>
|
||||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||||
|
<key>NSCameraUsageDescription</key>
|
||||||
|
<string>Please enable camera to publish.</string>
|
||||||
<key>NSHumanReadableCopyright</key>
|
<key>NSHumanReadableCopyright</key>
|
||||||
<string>$(PRODUCT_COPYRIGHT)</string>
|
<string>$(PRODUCT_COPYRIGHT)</string>
|
||||||
<key>NSMainNibFile</key>
|
<key>NSMainNibFile</key>
|
||||||
<string>MainMenu</string>
|
<string>MainMenu</string>
|
||||||
|
<key>NSMicrophoneUsageDescription</key>
|
||||||
|
<string>Please enable mic to publish.</string>
|
||||||
<key>NSPrincipalClass</key>
|
<key>NSPrincipalClass</key>
|
||||||
<string>NSApplication</string>
|
<string>NSApplication</string>
|
||||||
<key>NSCameraUsageDescription</key>
|
|
||||||
<string>Please enable camera to publish.</string>
|
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
@@ -4,6 +4,10 @@
|
|||||||
<dict>
|
<dict>
|
||||||
<key>com.apple.security.app-sandbox</key>
|
<key>com.apple.security.app-sandbox</key>
|
||||||
<true/>
|
<true/>
|
||||||
|
<key>com.apple.security.device.audio-input</key>
|
||||||
|
<true/>
|
||||||
|
<key>com.apple.security.device.camera</key>
|
||||||
|
<true/>
|
||||||
<key>com.apple.security.network.client</key>
|
<key>com.apple.security.network.client</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>com.apple.security.network.server</key>
|
<key>com.apple.security.network.server</key>
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
#import <Flutter/Flutter.h>
|
|
||||||
|
|
||||||
@interface LiveKitPlugin : NSObject<FlutterPlugin>
|
|
||||||
@end
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
#import "LiveKitPlugin.h"
|
|
||||||
#if __has_include(<livekit_client/livekit_client-Swift.h>)
|
|
||||||
#import <livekit_client/livekit_client-Swift.h>
|
|
||||||
#else
|
|
||||||
// Support project import fallback if the generated compatibility header
|
|
||||||
// is not copied when this plugin is created as a library.
|
|
||||||
// https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816
|
|
||||||
#import "livekit_client-Swift.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@implementation LiveKitPlugin
|
|
||||||
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar {
|
|
||||||
[SwiftLiveKitPlugin registerWithRegistrar:registrar];
|
|
||||||
}
|
|
||||||
@end
|
|
||||||
Symlink
+1
@@ -0,0 +1 @@
|
|||||||
|
../../shared_swift/LiveKitPlugin.swift
|
||||||
@@ -1,9 +1,3 @@
|
|||||||
#
|
|
||||||
# LiveKit
|
|
||||||
# https://livekit.io/
|
|
||||||
# https://github.com/livekit
|
|
||||||
#
|
|
||||||
|
|
||||||
Pod::Spec.new do |s|
|
Pod::Spec.new do |s|
|
||||||
s.name = 'livekit_client'
|
s.name = 'livekit_client'
|
||||||
s.version = '0.5.3'
|
s.version = '0.5.3'
|
||||||
|
|||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
../../shared_swift/LiveKitPlugin.swift
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
Pod::Spec.new do |s|
|
||||||
|
s.name = 'livekit_client'
|
||||||
|
s.version = '0.5.3'
|
||||||
|
s.summary = 'Open source platform for real-time audio and video.'
|
||||||
|
s.description = 'Open source platform for real-time audio and video.'
|
||||||
|
s.homepage = 'https://livekit.io/'
|
||||||
|
s.license = { :file => '../LICENSE' }
|
||||||
|
s.author = { 'LiveKit' => '[email protected]' }
|
||||||
|
s.source = { :path => '.' }
|
||||||
|
s.source_files = 'Classes/**/*'
|
||||||
|
s.public_header_files = 'Classes/**/*.h'
|
||||||
|
s.platform = :osx, '10.11'
|
||||||
|
# Flutter.framework does not contain a i386 slice.
|
||||||
|
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
|
||||||
|
s.swift_version = '5.0'
|
||||||
|
s.static_framework = true
|
||||||
|
|
||||||
|
s.dependency 'FlutterMacOS'
|
||||||
|
s.dependency 'WebRTC-SDK', '~> 92.4515'
|
||||||
|
end
|
||||||
@@ -35,6 +35,8 @@ flutter:
|
|||||||
platforms:
|
platforms:
|
||||||
ios:
|
ios:
|
||||||
pluginClass: LiveKitPlugin
|
pluginClass: LiveKitPlugin
|
||||||
|
macos:
|
||||||
|
pluginClass: LiveKitPlugin
|
||||||
android:
|
android:
|
||||||
package: io.livekit.plugin
|
package: io.livekit.plugin
|
||||||
pluginClass: LiveKitPlugin
|
pluginClass: LiveKitPlugin
|
||||||
|
|||||||
@@ -1,14 +1,29 @@
|
|||||||
import Flutter
|
|
||||||
import UIKit
|
|
||||||
import WebRTC
|
import WebRTC
|
||||||
|
|
||||||
public class SwiftLiveKitPlugin: NSObject, FlutterPlugin {
|
#if os(macOS)
|
||||||
|
import Cocoa
|
||||||
|
import FlutterMacOS
|
||||||
|
#else
|
||||||
|
import Flutter
|
||||||
|
import UIKit
|
||||||
|
#endif
|
||||||
|
|
||||||
|
public class LiveKitPlugin: NSObject, FlutterPlugin {
|
||||||
|
|
||||||
public static func register(with registrar: FlutterPluginRegistrar) {
|
public static func register(with registrar: FlutterPluginRegistrar) {
|
||||||
let channel = FlutterMethodChannel(name: "livekit_client", binaryMessenger: registrar.messenger())
|
|
||||||
let instance = SwiftLiveKitPlugin()
|
#if os(macOS)
|
||||||
|
let messenger = registrar.messenger
|
||||||
|
#else
|
||||||
|
let messenger = registrar.messenger()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
let channel = FlutterMethodChannel(name: "livekit_client", binaryMessenger: messenger)
|
||||||
|
let instance = LiveKitPlugin()
|
||||||
registrar.addMethodCallDelegate(instance, channel: channel)
|
registrar.addMethodCallDelegate(instance, channel: channel)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !os(macOS)
|
||||||
// https://developer.apple.com/documentation/avfaudio/avaudiosession/category
|
// https://developer.apple.com/documentation/avfaudio/avaudiosession/category
|
||||||
let categoryMap: [String: AVAudioSession.Category] = [
|
let categoryMap: [String: AVAudioSession.Category] = [
|
||||||
"ambient": .ambient,
|
"ambient": .ambient,
|
||||||
@@ -16,7 +31,7 @@ public class SwiftLiveKitPlugin: NSObject, FlutterPlugin {
|
|||||||
"playAndRecord": .playAndRecord,
|
"playAndRecord": .playAndRecord,
|
||||||
"playback": .playback,
|
"playback": .playback,
|
||||||
"record": .record,
|
"record": .record,
|
||||||
"soloAmbient": .soloAmbient,
|
"soloAmbient": .soloAmbient
|
||||||
]
|
]
|
||||||
|
|
||||||
// https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions
|
// https://developer.apple.com/documentation/avfaudio/avaudiosession/categoryoptions
|
||||||
@@ -27,9 +42,9 @@ public class SwiftLiveKitPlugin: NSObject, FlutterPlugin {
|
|||||||
"allowBluetooth": .allowBluetooth,
|
"allowBluetooth": .allowBluetooth,
|
||||||
"allowBluetoothA2DP": .allowBluetoothA2DP,
|
"allowBluetoothA2DP": .allowBluetoothA2DP,
|
||||||
"allowAirPlay": .allowAirPlay,
|
"allowAirPlay": .allowAirPlay,
|
||||||
"defaultToSpeaker": .defaultToSpeaker,
|
"defaultToSpeaker": .defaultToSpeaker
|
||||||
// @available(iOS 14.5, *)
|
// @available(iOS 14.5, *)
|
||||||
// "overrideMutedMicrophoneInterruption": .overrideMutedMicrophoneInterruption,
|
// "overrideMutedMicrophoneInterruption": .overrideMutedMicrophoneInterruption,
|
||||||
]
|
]
|
||||||
|
|
||||||
// https://developer.apple.com/documentation/avfaudio/avaudiosession/mode
|
// https://developer.apple.com/documentation/avfaudio/avaudiosession/mode
|
||||||
@@ -42,21 +57,26 @@ public class SwiftLiveKitPlugin: NSObject, FlutterPlugin {
|
|||||||
"videoChat": .videoChat,
|
"videoChat": .videoChat,
|
||||||
"videoRecording": .videoRecording,
|
"videoRecording": .videoRecording,
|
||||||
"voiceChat": .voiceChat,
|
"voiceChat": .voiceChat,
|
||||||
"voicePrompt": .voicePrompt,
|
"voicePrompt": .voicePrompt
|
||||||
]
|
]
|
||||||
|
|
||||||
private func categoryOptions(fromFlutter options: [String]) -> AVAudioSession.CategoryOptions {
|
private func categoryOptions(fromFlutter options: [String]) -> AVAudioSession.CategoryOptions {
|
||||||
var result: AVAudioSession.CategoryOptions = []
|
var result: AVAudioSession.CategoryOptions = []
|
||||||
for option in categoryOptionsMap {
|
for option in categoryOptionsMap {
|
||||||
if (options.contains(option.key)) {
|
if options.contains(option.key) {
|
||||||
result.insert(option.value)
|
result.insert(option.value)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
public func handleConfigureNativeAudio(args: [String: Any?], result: @escaping FlutterResult) {
|
public func handleConfigureNativeAudio(args: [String: Any?], result: @escaping FlutterResult) {
|
||||||
|
|
||||||
|
#if os(macOS)
|
||||||
|
result(FlutterMethodNotImplemented)
|
||||||
|
#else
|
||||||
|
|
||||||
let configuration = RTCAudioSessionConfiguration.webRTC()
|
let configuration = RTCAudioSessionConfiguration.webRTC()
|
||||||
|
|
||||||
// Category
|
// Category
|
||||||
@@ -117,6 +137,7 @@ public class SwiftLiveKitPlugin: NSObject, FlutterPlugin {
|
|||||||
print("[LiveKit] Configure audio error: ", error)
|
print("[LiveKit] Configure audio error: ", error)
|
||||||
result(FlutterError(code: "configure", message: error.localizedDescription, details: nil))
|
result(FlutterError(code: "configure", message: error.localizedDescription, details: nil))
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
|
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
|
||||||
Reference in New Issue
Block a user