android media player - how to disable range request? (broken audio streaming on Nexus 7)

前端 未结 3 1635
轮回少年
轮回少年 2021-01-30 06:03

I have a audio streaming app, which runs a local proxy server. The local proxy server makes a http connection to a internet streaming source, gets and buffers locally the stream

3条回答
  •  余生分开走
    2021-01-30 06:15

    When you seek or skip or the connection is lost and MediaPlayer keeps reconnecting to the proxy server, you must send this response with Status 206 after you get the request and range(int) from the client.

    String headers += "HTTP/1.0 206 OK\r\n";
    headers += "Content-Type: audio/mpeg\r\n";
    headers += "Accept-Ranges: bytes\r\n";
    headers += "Content-Length: " + (fileSize-range) + "\r\n";
    headers += "Content-Range: bytes "+range + "-" + fileSize + "/*\r\n";
    headers += "\r\n";
    

提交回复
热议问题