Skip to content
Draft
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
1 change: 1 addition & 0 deletions mobile/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ dependencies {

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "com.squareup.okhttp3:okhttp:$okhttp_version"
implementation "androidx.media3:media3-datasource-okhttp:1.8.0"
implementation 'org.chromium.net:cronet-embedded:143.7445.0'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlin_coroutines_version"
implementation "androidx.work:work-runtime-ktx:$work_version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import app.alextran.immich.connectivity.ConnectivityApiImpl
import app.alextran.immich.core.HttpClientManager
import app.alextran.immich.core.ImmichPlugin
import app.alextran.immich.core.NetworkApiPlugin
import androidx.media3.datasource.okhttp.OkHttpDataSource
import me.albemala.native_video_player.NativeVideoPlayerPlugin
import app.alextran.immich.images.LocalImageApi
import app.alextran.immich.images.LocalImagesImpl
import app.alextran.immich.images.RemoteImageApi
Expand All @@ -31,6 +33,7 @@ class MainActivity : FlutterFragmentActivity() {
companion object {
fun registerPlugins(ctx: Context, flutterEngine: FlutterEngine) {
HttpClientManager.initialize(ctx)
NativeVideoPlayerPlugin.dataSourceFactory = { OkHttpDataSource.Factory(HttpClientManager.getClient()) }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Setting this is good, but we should confirm that it doesn't cache the video because that will trash the disk cache of the shared session.

flutterEngine.plugins.add(NetworkApiPlugin())

val messenger = flutterEngine.dartExecutor.binaryMessenger
Expand Down
6 changes: 6 additions & 0 deletions mobile/ios/Runner/Core/URLSessionManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ class URLSessionManager: NSObject {
delegate = URLSessionManagerDelegate()
session = Self.buildSession(delegate: delegate)
super.init()
if #available(iOS 15, *) {
VideoProxyServer.shared.session = session
}
Comment on lines +70 to +72
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is intentionally only set when getting an mTLS or basic auth challenge because it's less efficient than the default AVPlayer handling.

Self.serverUrls = UserDefaults.group.stringArray(forKey: SERVER_URLS_KEY) ?? []
NotificationCenter.default.addObserver(
Self.self,
Expand All @@ -78,6 +81,9 @@ class URLSessionManager: NSObject {

func recreateSession() {
session = Self.buildSession(delegate: delegate)
if #available(iOS 15, *) {
VideoProxyServer.shared.session = session
}
}

static func setServerUrls(_ urls: [String]) {
Expand Down
Loading