2
\$\begingroup\$

I'm trying to play an HLS live-stream within my Unity app.

I could write a script for fetching the short .ts video segments and enqueuing them, but I don't know how I can actually play them inside Unity: its built-in video player doesn't support .ts files, and going by their descriptions, the plug-ins I was able to find on the Asset Store that can play them only do so on native, not web, builds. I'd be happy to be proven wrong on this, though.

I considered simply displaying the video in an HTML player and somehow projecting it onto the surface. Whether or not HTML/CSS allows that kind of fine manipulation of the video player is up in the air.

Alternatively, I could try converting the videos to a playable format on the fly. That might work if it's not too slow — it'd just add a few seconds of latency to the live-stream — but the question is how I'm going to do that from a WebGL build. Could I package something like ffmpeg with the build?

Or maybe I can write my own player. The problem is, I don't even know where to start. Most of my searches have turned up only very low-level descriptions of the MPEG-2 Transport Stream protocol and nothing on how to actually play them.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.