Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
MrWalnut
Reel Rookie

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

 

0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.