kbumsik / opus-media-recorder

MediaRecorder polyfill for Opus recording using WebAssembly
http://kbumsik.io/opus-media-recorder/
Other
312 stars 39 forks source link

Script tag load from CDN@latest not work #13

Closed tarepan closed 5 years ago

tarepan commented 5 years ago

Summary

Library load with script tag (cdn.jsdelivr.net...@latest...) do not work at all.

Situation

Thanks for your great library, I start to use this library intensively in my project.
When I try to use this library in browser (Windows10, Chrome72) through script tag as written in index.md, like below,

<script src="https://cdn.jsdelivr.net/npm/opus-media-recorder@latest/OpusMediaRecorder.umd.js"></script>

it cause exception and not work at all.

If I modify the src attribute from
"...cdn.jsdeliver.net...@latest..."
to
"...cdn.jsdeliver.net...@0.7.16..."
, it completely works.

Error codes

Uncaught (in promise) DOMException: Failed to construct 'Worker': Script at 'file:///C:/~/myProject/encoderWorker.umd.js' cannot be accessed from origin 'null'.
    at n.t._workerFactory (https://cdn.jsdelivr.net/npm/opus-media-recorder@latest/OpusMediaRecorder.umd.js:1:4163)
    at n.value (https://cdn.jsdelivr.net/npm/opus-media-recorder@latest/OpusMediaRecorder.umd.js:1:5424)
    at new n (https://cdn.jsdelivr.net/npm/opus-media-recorder@latest/OpusMediaRecorder.umd.js:1:4180)
    at file:///C:/~/myProject/index.html:28:35

Cause candidate

npm repo is not updated...? (I am noob about CDN or cdn.jsdelivr.net)

kbumsik commented 5 years ago

Hi, I glad to hear you use this library :) And yes, the @lastest of the JSDelivr usually takes a day to reflect the changes, and that's the reason why I changed to @0.7.16 in the lastest commit 9f4d8c6ec3371f363886cb254491ee56f39f680f. So let's wait for a while. I will cose the issue when @latest is updated.

Apart from the issue, I recommend you not to use @latest if the project is important. As you can see the incident I made last time, this libeary is not extensively tested yet. Moreover, I might change the API if the current implementation does not match the W3C MediaRecorder spec. I'm currently writing test scripts to make it more stable. You may want to start using @lastest when I make a 1.0.0 version :)

tarepan commented 5 years ago

I have not know the system of JSDelivr, thank you for kind description!

Yeah, version control is important.
I will lock a version and carefully update it if needed.
Thanks for advice! I am cheering and looking forward to v1.0!!

kbumsik commented 5 years ago

I close this issue sine the new 0.7.17 is out. I recommend using this version since it fixed a critical issue with WebM encoding. See #14 .