Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local speaker = peripheral.find("speaker")
- if not speaker then
- print("Speaker not found. Please make sure a speaker is connected.")
- return
- end
- print("Please enter the URL of the music file you want to play:")
- local url = read()
- local response = http.get(url, nil, true)
- if response then
- local responseData = response.readAll()
- response.close() -- Response'ı kapatmak önemlidir.
- speaker.playSound(responseData)
- print("Music successfully played.")
- else
- print("Request failed. HTTP Error: " .. (response and response.getResponseCode() or "Unknown"))
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement