Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Level 8

Downloading and playing .ts file in roku player

I am trying to download ts files from a web server by using AsyncGetToFile method and storing them in a temporary ts file. After that, I am sending the downloaded file to video player through a roStreamSocket object but the player stays buffering and doesn't start to play the video. All these operations are being handled by proxy server that I have coded in BrightScript. Any help would be appreciated!

Byte Array is being populated. There is no problem with that. Here is some code (fileToReturn is the file path and dataType is video/MP2T ) :

function sendVideoResponse(fileToReturn, dataType)
    reply = CreateObject("roByteArray")
    videoFileData = CreateObject("roByteArray")
    packet = "HTTP/1.1 200 OK" + Chr(13) + Chr(10)
    packet = packet + "Date: " + getCurrentDateforHTTPResponse() + Chr(13) + Chr(10)
    packet = packet + "Content-Type: " + dataType + Chr(13) + Chr(10)
    packet = packet + "Content-Length: " + videoFileData.Count().ToStr() + Chr(13) + Chr(10)
    m.connection.send(reply, 0, reply.Count())
end function


0 Kudos