Forum Discussion

MrWalnut's avatar
MrWalnut
Reel Rookie
5 years ago

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")
    videoFileData.ReadFile(fileToReturn)
    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)
    reply.fromAsciiString(packet)
    reply.Append(videoFileData)
    m.connection.send(reply, 0, reply.Count())
end function

 

No RepliesBe the first to reply