torinmb / mediapipe-touchdesigner

GPU Accelerated MediaPipe Plugin for TouchDesigner

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect MimeType preventing javascript from loading on some machines

mikebru opened this issue · comments

Hey there!

I was testing on a few different computers and noticed that on some PCs Mediapipe wouldn't load.

From taking a look at the webpage I saw that this error was occurring,

Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec.

I went into the Mediapipe tox and added these lines of code in the mp_webserver_callbacks dat.

if fileName.endswith('.js'): mimeType = ['application/javascript'] else: mimeType = mimetypes.guess_type(fileName, strict=False)

This solved the issue for me and allowed the TOX to function correctly.

image

Ohhhh thanks for that gem of info @mikebru ! That would explain why so many people seem to be having issues with the web page randomly not loading, we'll put that change into the next release!

@torinmb - FYI

Great fix! Just published a new release that incorporates this :)
https://github.com/torinmb/mediapipe-touchdesigner/releases/tag/v0.2.2