diff --git a/strawApp/src/main/kotlin/com/sulkta/straw/net/IosSafeHttpDataSource.kt b/strawApp/src/main/kotlin/com/sulkta/straw/net/IosSafeHttpDataSource.kt index 51d603e00..7a81709b0 100644 --- a/strawApp/src/main/kotlin/com/sulkta/straw/net/IosSafeHttpDataSource.kt +++ b/strawApp/src/main/kotlin/com/sulkta/straw/net/IosSafeHttpDataSource.kt @@ -21,11 +21,14 @@ package com.sulkta.straw.net +import android.util.Log import androidx.media3.common.C import androidx.media3.common.util.UnstableApi import androidx.media3.datasource.DataSpec import androidx.media3.datasource.HttpDataSource +private const val TAG = "IosSafeDS" + @UnstableApi class IosSafeHttpDataSource( private val inner: HttpDataSource, @@ -57,11 +60,23 @@ class IosSafeHttpDataSource( // come out as `bytes=N-M` (closed, accepted by googlevideo iOS URLs) // instead of `bytes=N-` (open, rejected with 403). val bounded = dataSpec.buildUpon().setLength(requestLen).build() + Log.i( + TAG, + "open: pos=${bounded.position} len=${bounded.length} " + + "(origLen=${dataSpec.length}, chunkBytes=$chunkBytes) " + + "url=${dataSpec.uri.toString().take(120)}", + ) originalSpec = dataSpec totalRead = 0 // inner.open() returns the BOUNDED chunk's length. Track it so we // know when to roll to the next chunk. - chunkRemaining = inner.open(bounded) + chunkRemaining = try { + inner.open(bounded) + } catch (t: Throwable) { + Log.w(TAG, "open failed: ${t.javaClass.simpleName}: ${t.message}") + throw t + } + Log.i(TAG, "open: inner returned chunkRemaining=$chunkRemaining") // Report the original (potentially unbounded) length to the caller — // ExoPlayer cares about the overall length, not our internal chunking. return if (dataSpec.length == C.LENGTH_UNSET.toLong()) {