javascript - Using mediainfo.js in Blazor Webassambly - Stack Overflow

I am trying to use mediainfo.js in my Blazor Webassambly App.Using JS in this context is new to me, so

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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742420453a4440578.html

相关推荐

  • javascript - Using mediainfo.js in Blazor Webassambly - Stack Overflow

    I am trying to use mediainfo.js in my Blazor Webassambly App.Using JS in this context is new to me, so

    1天前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信