-- Color Pixel Video Player (HTTP version) -- Requires Advanced Computer / Advanced Monitor -- Frame format: each line is color IDs separated by comma local config = { baseUrl = "https://your-domain.com/color_frames/frame_%03d.txt", totalFrames = 120, fps = 10, screenW = 39, screenH = 12, } local quit = false local colorMap = { [0] = colors.black, [1] = colors.red, [2] = colors.green, [3] = colors.brown, [4] = colors.blue, [5] = colors.purple, [6] = colors.cyan, [7] = colors.lightGray, [8] = colors.gray, [9] = colors.pink, [10] = colors.lime, [11] = colors.yellow, [12] = colors.lightBlue, [13] = colors.magenta, [14] = colors.orange, [15] = colors.white, } local function drawFrame(frameData) local lines = {} for line in string.gmatch(frameData, "[^\n]+") do table.insert(lines, line) end for y = 1, math.min(#lines, config.screenH) do local pixels = {} for num in string.gmatch(lines[y], "%d+") do table.insert(pixels, tonumber(num)) end term.setCursorPos(1, y) for x = 1, math.min(#pixels, config.screenW) do local c = colorMap[pixels[x]] or colors.black term.setBackgroundColor(c) term.write(" ") end end end local function playFrames() term.clear() term.setBackgroundColor(colors.black) term.setCursorPos(1, 1) print("Buffering...") sleep(0.5) for frame = 1, config.totalFrames do if quit then break end local url = string.format(config.baseUrl, frame) local res = http.get(url) if res then local data = res.readAll() res.close() drawFrame(data) end sleep(1 / config.fps) end quit = true end local function listenExit() while not quit do local _, key = os.pullEvent("key") if key == keys.q then quit = true break end end end -- Run term.clear() print("Color Pixel Video Player") print("Press Q to quit") sleep(2) parallel.waitForAny(playFrames, listenExit) term.setBackgroundColor(colors.black) term.setTextColor(colors.white) term.clear() term.setCursorPos(1, 1) print("Playback ended")