admin管理员组文章数量:1336660
I am trying to use mediainfo.js in my Blazor Webassambly App. Using JS in this context is new to me, so I am not shure how to deal with this. Calling javascript functions out of my c# code is not the problem, but if I try to use some mediainfo part inside of my own javascript function, I get errors.
I tried different ways to import the madiainfo.js library to may project: as File, over CDN,... But every time it seems that it could not be found if I try to use it.
Maybe someone can give me a small example how to use it.
regards Alex
UPDATE:
Here is what I am doning at the moment: at index.html I have this lines:
<script src=".js/dist/mediainfo.js"></script>
<script src="mediainfo-wrapper.js"></script>
my mediainfo-wrapper.js is this:
async function getMediaInfo(file) {
const mediaInfoInstance = await MediaInfo({ format: 'object' });
const fileData = await file.arrayBuffer();
const result = await mediaInfoInstance.analyzeData(() => file.size, () => fileData);
return result;
}
and with this line I call the JS function from my Blazor code:
await JSRuntime.InvokeAsync<string>("getMediaInfo", file);
After some more experiments, there is still no solution, but I think my problem is, that I not know how to correctly import the needed js files/modules. In the npm package there are different subfolders (esm, esm-bundle, umd) I tried all of them as entry point, but I am not shure what is the right way for my Blazor Webassambly, or even if it is possible at all.
I would be very happy to get some help, because I have no more ideas what I can try here.
本文标签: javascriptUsing mediainfojs in Blazor WebassamblyStack Overflow
版权声明:本文标题:javascript - Using mediainfo.js in Blazor Webassambly - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742420453a2471552.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论