UrlLoader:setStreaming
From GiderosMobile
Available since: Gideros 2020.2
Class: UrlLoader
Description
Enables the streaming of url.
UrlLoader:setStreaming(bool)
Parameters
bool: (boolean) streaming mode
Example
Streams an mp3 from the web
loader=UrlLoader.new()
loader:setStreaming(true) -- enable streaming mode
-- create our mp3 Buffer
loader.mp3=Buffer.new("buffer.mp3",true)
-- process stream data
loader:addEventListener(Event.PROGRESS,function (e)
loader.mp3:append(e.chunk)
if loader.mp3:size()>100000 and not loader.mp3.started then
Sound.new("|B|buffer.mp3"):play() -- play the buffer content by name
loader.mp3.started=true
end
if loader.mp3.started then
-- periodically trim already played data from buffer
loader.mp3:trim(loader.mp3:tell())
end
end)
loader:load("http://soundimage.org/wp-content/uploads/2017/08/Bubble-Gum-Puzzler.mp3")