Skip to content

Embedding in a Web Page

Below is a basic guide on how to embed the edML player and the edML file on an HTML webpage.

First, download the edML player as a ZIP file and unzip it. Copy all the files to an appropriate location on your web server. Also place the edML file, your course file, and all necessary (media) files in an appropriate location on your web server. Make sure that the path specifications, as indicated in the edML file, remain correct on the web server. In the simplest case, use a ZIP file containing the (media) files and the edML file. This should also be playable in the online version of the player.

In the header of the HTML webpage, include the files edmlplayer.min.js and edmlplayer.min.css with the appropriate path specifications relative to their storage location on your web server.

<link rel="stylesheet" href="path to edmlplayer.min.css"/>  
<script src="path to edmlplayer.min.js"></script> 

At the end of the HTML web page, add the code to launch the edML player. This is done using a JavaScript script:

<script>
    var edmlplayer = new edML_Player("path to edML file or zip file");
    edmlplayer.play();
</script>
In this simple version, the edML player creates a div element in the HTML body that spans the entire height and width of the screen.

You can achieve a slightly more attractive appearance by adding a div element with the ID “edml” to the HTML body and styling it with CSS. A simple web page in which the player files and the edML file are located in the same directory as the HTML file might look like this:

<!DOCTYPE html>
<head>
    <meta charset="utf-8" name="viewport" content="width=device-width, initial-scale=1"/>
    <link rel="stylesheet" href="edmlplayer.min.css"/>
    <script src="edmlplayer.min.js"></script>
</head>

<body>
    <div id="edml"></div>
</body>

<style>
    body,html{
        margin: 0px;
        padding: 0px;
        width: 100%;
        height: 100%;
    }

    #edml{
        height: 100%;
        max-height: 100%;
    }
</style>

<script>
    var edmlplayer = new edML_Player("edmlfile.edml");
    edmlplayer.play();
</script>