aadsm / jsmediatags

Media Tags Reader (ID3, MP4, FLAC)
Other
738 stars 128 forks source link

'Unresolved variable jsmediatags' when using window.jsmediatags #157

Open Android789515 opened 2 years ago

Android789515 commented 2 years ago

Not really understanding the usage instructions, I need a bit of help.

I have a script tag:

<script
    src='https://cdnjs.cloudflare.com/ajax/libs/jsmediatags/3.9.5/jsmediatags.min.js'
    integrity='sha512-YsR46MmyChktsyMMou+Bs74oCa/CDdwft7rJ5wlnmDzMj1mzqncsfJamEEf99Nk7IB0JpTMo5hS8rxB49FUktQ=='
    crossorigin='anonymous'
    referrerpolicy='no-referrer'
>
</script>

however when I try to use it: Screenshot 2022-02-19 174739

Offroaders123 commented 2 years ago

I'm not exactly sure what your dev stack is like for your use case, but I currently have a workaround to use jsmediatags as an ES Module exclusively, in the browser (Relating to the issue I opened that you also commented on recently).

First, I load the <script> tag into the window like JS MediaTags currently supports. Then, I essentially create my own wrapper module that contains the jsmediatags object from the window, Lastly, to tidy things up a little, I remove it from the window object so it is only accessible by using import with my wrapper module.

My Project - Librar.io