Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VIDEO-12594 Add support for setting isCameraMultitaskingEnabled #226

Open
wants to merge 1 commit into
base: spike/uikit-pip
Choose a base branch
from
Open
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
2 changes: 2 additions & 0 deletions VideoApp/VideoApp/Stores/AppSettings/AppSettingsStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ protocol AppSettingsStoreWriting: LaunchStore {
var videoSize: VideoSize { get set }
var userIdentity: String { get set }
var isTURNMediaRelayOn: Bool { get set }
var isCameraMultitaskingEnabled: Bool { get set }
var areInsightsEnabled: Bool { get set }
var coreSDKLogLevel: SDKLogLevel { get set }
var platformSDKLogLevel: SDKLogLevel { get set }
Expand All @@ -43,6 +44,7 @@ class AppSettingsStore: AppSettingsStoreWriting {
@Storage(key: makeKey("videoSize"), defaultValue: .vga) var videoSize: VideoSize
@Storage(key: makeKey("userIdentity"), defaultValue: "") var userIdentity: String
@Storage(key: makeKey("isTURNMediaRelayOn"), defaultValue: false) var isTURNMediaRelayOn: Bool
@Storage(key: makeKey("isCameraMultitaskingEnabled"), defaultValue: false) var isCameraMultitaskingEnabled: Bool
@Storage(key: makeKey("areInsightsEnabled"), defaultValue: true) var areInsightsEnabled: Bool
@Storage(key: makeKey("coreSDKLogLevel"), defaultValue: SDKLogLevel.info) var coreSDKLogLevel: SDKLogLevel
@Storage(key: makeKey("platformSDKLogLevel"), defaultValue: SDKLogLevel.info) var platformSDKLogLevel: SDKLogLevel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,18 @@ import TwilioVideo

class CameraSourceFactory {
private let remoteConfigStore: RemoteConfigStoreReading = RemoteConfigStoreFactory().makeRemoteConfigStore()
private let appSettingStore: AppSettingsStoreWriting = AppSettingsStore.shared

func makeCameraSource() -> CameraSource? {
let options = CameraSourceOptions() { builder in
if let scene = UIApplication.shared.windows.filter({ $0.isKeyWindow }).first?.windowScene {
builder.orientationTracker = UserInterfaceTracker(scene: scene)
}

if #available(iOS 16.0, *) {
builder.enableCameraMultitasking = self.appSettingStore.isCameraMultitaskingEnabled
}

switch self.remoteConfigStore.roomType {
case .group, .groupSmall:
// Take a best guess and remove rotation tags using hardware acceleration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ class AdvancedSettingsViewModel: SettingsViewModel {
title: "Insights",
isOn: appSettingsStore.areInsightsEnabled,
updateHandler: { self.appSettingsStore.areInsightsEnabled = $0 }
),
.toggle(
title: "Enable Camera Multitasking",
isOn: appSettingsStore.isCameraMultitaskingEnabled,
updateHandler: { self.appSettingsStore.isCameraMultitaskingEnabled = $0 }
)
]
),
Expand Down