VideoPlayer not accepting blob: URL's

I’m trying to load videos dynamically from memory in a project, and this is causing a particular headache for WebGL. On standalone and mobile, I could just save this file temporarily on disk and load it from there, but that’s not possible on WebGL.
To try and work around this, I’m sending the video data to JS and creating a blob, then using URL.createObjectURL. However, after I set the url property of a VideoPlayer, then call Play(), the url property seems to get reset to an empty string, and the video doesn’t play.

.jslib code:

mergeInto(LibraryManager.library, {
    CreateBlob: function(array, size)
    {
        var blobData = HEAPU8.subarray(array, array + size);
        var blob = new Blob([blobData], { type: "video/mp4" })
        var url = URL.createObjectURL(blob);
       
        var bufferSize = lengthBytesUTF8(url) + 1;
        var buffer = _malloc(bufferSize);
        stringToUTF8(url, buffer, bufferSize);
       
        return buffer;
    }
});

C# code

public VideoPlayer vid;

[DllImport("__Internal")]
private static extern string CreateBlob(byte[] array, int size);

[...]

void PlayVideo(byte[] videoData)
{
    string url = CreateBlob(videoData, videoData.Length);

    Debug.Log("Video URL before: " + url);

    vid.url = url;
    vid.Play();

    Debug.Log("Video URL after: " + vid.url);
}

The above C# logs out:

I know the issue isn’t with the video or the process of converting it into a blob: URL, as I can open URL returned from CreateBlob in another tab, and it plays the video just fine.

I’ve seen other threads around (for example, here ) that seem to be a result of Unity incorrectly parsing blob: URL’s. Is this what’s happening here, or is there a fundamental problem with playing video’s from blob: URL’s?

Thanks,
Stephen

The issue is, Videoplayer.url only takes string starting with “https” otherwise resets to an empty string and nothing happens.

My video player plugin accepts blobs just fine

My mistake, the blob urls work, but not without an extension at the end of it. For e.g. .mp4

Correction: Blob urls are accepted, but Videoplayer.url does not recognize a url without an extension or maybe type .mp4 or .vp8.

Does your video player asset play blobs if they don’t have an extension at the end?

It works with any valid video blob, usually created with createObjectURL. Blobs don’t usually have an extension at the end as far as I know.