CC: Tweaked

CC: Tweaked

57M Downloads

HTTP GET binary handle does not return a h.read() as described in the documentation

EmmaKnijn opened this issue ยท 1 comments

commented

Minecraft Version

1.18.x

Version

1.100.10

Details

I was porting my program from old Computronics to ComputerCraft:Tweaked 1.100's dfpwm playing system. I am using this as the code: https://github.com/knijn/musicify/blob/01f272e6df3dafb32aac1f13ddfffc9af4337b97/musicify.lua

Specific function that is relevant is play(), it should download the file (with the options local h = http.get({["url"] = songID.file, ["binary"] = true, ["redirect"] = true})
) and shove it into the handle. I'm trying to use h.read() to read through the dfpwm file but its returning nil for the chunk, causing bogus audio to be played
image

commented

I was following the guide under https://tweaked.cc/guide/speaker_audio.html Storing Audio and at the bottom it suggests https://tweaked.cc/module/fs.html#ty:BinaryReadHandle:read. As it notes at https://tweaked.cc/module/http.html#ty:Response, the binary handle returns the same methods as https://tweaked.cc/module/fs.html#ty:BinaryReadHandle