Verovio App

App based on Verovio for displaying MEI or MusicXML files

by lpugin

HTML

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Verovio App demo</title>
    <style>
    html, body {
        width: 100%;
        height: 100%;
        margin: 0;
    }
    .header {
        padding: 30px;
        height:80px;
    }
    #app {
        height: auto;
        width: 100%;
        position: absolute;
        top: 80px;
        bottom: 0;
    }
    </style>
</head>
<body>
    <div class="header">How to use the Verovio App</div>
    <div id="app">Verovio is loading...</div>
    <script type="module">
        import 'https://editor.verovio.org/javascript/app/verovio-app.js';
        
        const options = {
            defaultView: 'editor', // default is 'responsive', alternative is 'document'
            responsiveZoom: 3, // 0-7, default is 4
            enableResponsive: false, // default is true
            enableDocument: false, // default is true
            enableEditor: true
        }
        
        // A MusicXML file
        var file = 'https://www.verovio.org/examples/musicxml/Vivaldi_Concerto_No.4_in_F_Minor_Winter.xml';
        // A MEI file
        //var file = 'https://www.verovio.org/editor/brahms.mei';
        
        const app = new Verovio.App(document.getElementById("app"), options);
        fetch(file)
            .then(function(response) {
                return response.text();
            })
            .then(function(text) {
                app.loadData(text);
            });
    </script>
</body>
</html>