The previous code called dataSpec.subrange(dataSpec.position, length) which *adds* the offset to the existing position rather than setting an absolute bounded slice — that turned every first open() into Range request `bytes=(2*N)-(2*N+chunk-1)`, doubling the offset and still 403'ing for the wrong reason. DataSpec.subrange(offset, length) docs: "position of the new DataSpec will be position + offset". So subrange(0, L) gives a bounded slice at the current position. We want absolute control, so use buildUpon().setPosition(N).setLength(L).build() — explicit, unambiguous. Caught on vc=17 emulator smoke: ExoPlayer logged InvalidResponseCodeException 403 at IosSafeHttpDataSource.kt:58 (the inner.open(bounded) call), meaning the bounded shape was wrong. Player.Listener.onPlayerError DID fire and surface the error in the UI — so that part of the patch works. |
||
|---|---|---|
| .. | ||
| src/main | ||
| build.gradle.kts | ||