Skip to content
This repository was archived by the owner on Oct 26, 2024. It is now read-only.

Commit

Permalink
Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
LisoUseInAIKyrios committed Sep 10, 2024
1 parent b8641be commit dff69e7
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@
import app.revanced.integrations.youtube.patches.spoof.ClientType;
import app.revanced.integrations.youtube.settings.Settings;

/**
* Video streaming data. Fetching is tied to the behavior YT uses,
* where this class fetches the streams only when YT fetches.
*
* Effectively the cache expiration of these fetches is the same as the stock app,
* since the stock app would not use expired streams and therefor
* the integrations replace stream hook is called only if YT
* would have used it's own client streams.
*/
public class StreamingDataRequest {

private static final ClientType[] CLIENT_ORDER_TO_USE;
Expand Down Expand Up @@ -150,11 +159,12 @@ private static ByteBuffer fetch(String videoId, Map<String, String> playerHeader
if (connection.getContentLength() != 0) {
try (InputStream inputStream = new BufferedInputStream(connection.getInputStream())) {
try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {
byte[] buffer = new byte[8192];
byte[] buffer = new byte[2048];
int bytesRead;
while ((bytesRead = inputStream.read(buffer)) >= 0) {
baos.write(buffer, 0, bytesRead);
}
baos.flush();

return ByteBuffer.wrap(baos.toByteArray());
}
Expand Down

0 comments on commit dff69e7

Please sign in to comment.