superpoweredSDK / Low-Latency-Android-iOS-Linux-Windows-tvOS-macOS-Interactive-Audio-Platform

🇸Superpowered Audio, Networking and Cryptographics SDKs. High performance and cross platform on Android, iOS, macOS, tvOS, Linux, Windows and modern web browsers.
https://superpowered.com
1.32k stars 284 forks source link

Progressive downloads, unknown content length, and a local proxy server #759

Closed flagoworld closed 11 months ago

flagoworld commented 11 months ago

Hi,

I'm having an issue that I am having a hard time diagnosing. Here's the deal:

I am having SP load from a local URL (http://localhost:port/path/to/file). This local server does stuff with the file data before passing it to SP. One possible thing it can do is pull the data from a remote source and forward it to SP (proxy). This works perfectly in every case EXCEPT if there's no Content-Length from the remote source. If I point SP to the same remote source for the file, SP plays it as expected and updated the duration when the file is done downloading. If I point SP to the local server/proxy, when SP always seems to close the socket after ~ 1MB (26 seconds) of data is sent. It starts playing, then the progressive download finished event fires at 26 seconds of buffer. On the local server, it's still writing data and then suddenly hits errno 32 broken pipe. Seems like SP is closing the connection for some reason. So far as I can tell, all the response headers are getting forwarded and SP should be treating the proxy the exact same as the remote URL. I can't figure out what is different, and there's no error from SP to tell me why it's closing the connection. Simply adding back the Content-Length header fixes it, but that is not an option because the content length is not always known. Unsure how to diagnose this. Any help appreciated.

balazsbanto commented 11 months ago

Continuing this conversation in Zendesk.