Play Video from Byte[]

I store my video in a MySQL database with a LONGBLOB field.
With a MySqlDataReader a get my video as a Byte.
How can I convert it in a VideoClip to play it in a VideoPlayer ?
Thanks for taking the time to read this :slight_smile:

In short: You can’t directly use a byte array.

The VideoClip class is a transcoded asset that is supposed to be stored in your project. VideoClips can only be created in the editor by the VideoClipImporter. So you can’t use a VideoClip when you want to view dynamically loaded video data at runtime.

However the VideoPlayer allows you to play a video file given either an HTTP URL or an absolute or relative file path on the target device. That means if you have your video as byte array you would need to store it in a file and let the VideoPlayer play that file.

Pretty much all of that can be directly derived from reading the documentation links i’ve provided.

Unfortunately, Android Q (10) has a lot of problems when trying to access files from the emulated storage (not application data path or streaming assets path).

Also I agree with @karsnen that it is not feasible to load a video into memory and save it to dataPath or temporary cache path to just play it in Unity.