1

I have a website developed in C# MVC5 .NET and I need to use de MediaInfolib DLL javascript version. I am not able to load the .wasm file.

This is my .cshtml code:

    <script type="text/javascript">
        // Load the WebAssembly MediaInfo module if the browser supports it,
        // otherwise load the asmjs module
        var wasm_path ="@Url.Content("~/")" + "lib/MediaInfo_DLL/";
        var MediaInfoJs = document.createElement('script');
        if ('WebAssembly' in window) {
            MediaInfoJs.src = wasm_path + "MediaInfoWasm.js";
        } else {
            MediaInfoJs.src = wasm_path + "MediaInfo.js";
        }
        document.body.appendChild(MediaInfoJs);

        // Continue initialization
        MediaInfoJs.onload = function () {
          var MediaInfoModule, MI, processing = false, CHUNK_SIZE = 1024 * 1024;

          var finish = function() {
              MI.Close();
              MI.delete();
              processing = false;
          }

          ...

         MediaInfoModule = MediaInfoLib(
             {'locateFile': function(path, prefix) {return wasm_path + path; }},
             { 'postRun': function () {
            console.debug('MediaInfo ready');

            // Information about MediaInfo
            document.getElementById('result').innerText = 'Info_Parameters:\n';
            document.getElementById('result').innerText += MediaInfoModule.MediaInfo.Option_Static('Info_Parameters') + '\n\n';

            document.getElementById('result').innerText += 'Info_Codecs:\n';
            document.getElementById('result').innerText += MediaInfoModule.MediaInfo.Option_Static('Info_Codecs') + '\n';

            // Get selected file
            var input = document.getElementById('input');
            input.onchange = function() {
              if(input.files.length > 0) {
                document.getElementById('result').innerText = "Processing...";
                parseFile(input.files[0], showResult);
              }
            }
             }
             });

        };
    </script>

I have these warnings in the MediaInfoWasm.js and the page doesn`t work:

MediaInfoWasm.js:19 failed to asynchronously prepare wasm: failed to load wasm binary file at '/lib/MediaInfo_DLL/MediaInfoWasm.wasm' Module.c.printErr.c.printErr @ MediaInfoWasm.js:19 MediaInfoWasm.js:19 failed to load wasm binary file at '/lib/MediaInfo_DLL/MediaInfoWasm.wasm' Module.c.printErr.c.printErr @ MediaInfoWasm.js:19

Has somebody used this MediaInfolib javascript version with MVC5? Thanks in advance. María José.

Aarif
  • 1,595
  • 3
  • 17
  • 29
Marijosemg
  • 11
  • 1

0 Answers0