Skip to content

Load MXL files #2772

Closed Answered by samuelbradshaw
efreja asked this question in Q&A
Apr 5, 2022 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

Hi! I'm using MXL files to load sheet music as well.

I think you need to convert the response to an ArrayBuffer or Base64 string, then use vrvToolkit.loadZipDataBuffer() or vrvToolkit.loadZipDataBase64() to load it, instead of using vrvToolkit.loadData(). Here's an example using the JavaScript Fetch API, loading the file as an ArrayBuffer:

fetch(mxlUrl)
  .then(response => response.arrayBuffer())
  .then(data => {
    vrvToolkit.loadZipDataBuffer(data)
    // Do anything else you want with the file here
  }).catch(e => {
    console.log(e);
  });

If you have various files to load in different formats, something like this might be helpful:

if (data instanceof ArrayBuffer) {
  // MXL (Arr…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@lpugin
Comment options

Answer selected by efreja
Comment options

You must be logged in to vote
1 reply
@samuelbradshaw
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants