-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to use in TypeScript #75
Comments
To be honest I'm not sure, I have never used TypeScript, I've been using flow. My guess is that you'd have to build the TypeScript types in a file? |
Hmm...not sure how I would do that... |
I managed to include it in my code using the following import statement: import * as jsmediatags from 'jsmediatags'; but now I'm getting another error as seen in the screenshot below: I'm working on an Android application based on cordova so passing the URL to jsmediatags's read function like this: 'file:///storage/emulated/0/Music/02%20-%20Break%20The%20Rules.mp3' As you see in the response, it's kind of working as there are tags in the response property but I don't know how to make it work completely. Also, I found this issue that might be somewhat similar: but I don't understand what exactly I should do. |
OK, I was able to get it to work like this: jsmediatags.read(file.toInternalURL(), { Had to use the method 'toInternalURL()' on the file. |
@rajatkhare619, I'm glad you found the solution as I don't have any experience with Cordova. Pretty sure other people using the same technology have the same question, have you thought about writing a blog post about this? I could advertise it here on github. |
That sounds like a good idea. I'll try to write it when I get some free time. |
Hi, i used this lib on Ionic. Just need to add plugin Allow-Control-Allow-Origin: * to google chrome and implement the rajatkhare619's solution. It works for me 👍 |
i cant seem to copy
however, i was able to get this library working with ts types by including the cdn into index.html like: installing the types: then casting the window variable to a global const with the type: import * as jsmediatagsType from '../../node_modules/@types/jsmediatags';
const jsmediatags = (window as any).jsmediatags as typeof jsmediatagsType; |
side note, there do seem to be some versioning problems... the current npm package is at |
I wanted to use this library in svelte + typescript and these tips did not work out for me but this small change in the package.json of my local node module did. I don't even have to import it anymore since it is globally available anyway
|
Hello,
How would I use this in TypeScript? How would I import it in a module. I tried including the js file in index.html but the code can't find 'jsmediatags'.
The text was updated successfully, but these errors were encountered: