Muzica Web API
Do you own a website or app, which provides music downloads? If yes, you can integrate the Muzica Web API to allow your visitors to add music files from your site to their Muzica account by one click. A music file will be downloaded from your site through our servers and uploaded to the account of the user who has requested the file.
Integration
You can integrate the Muzica Web API easily with a simple script into your web project. Just add the following code to your site:
<script type="text/javascript" src="https://share.muzica.io/static/share_button.js"></script>
Now create a new HTML element which includes the following structure to render a Muzica button into it:
<p class="muzica-button" data-url="http://www.myapp.com/download/test.mp3" data-size="24" data-title="Interpret - Title"></p>
Besides the <p>
tag you can also use any other HTML tag. To render the Muzica button within that element, we need to execute the following Javascript code:
var elem = document.getElementsByClassName("muzica-button")[0]; // Example element
Muzica.createButton(elem); // Renders button within the element
Valid Attributes
Attribut | Description | Example | Required |
---|---|---|---|
data-url | URL of the music file | http://www.myapp.com/test.mp3 | Yes |
data-title | Title of the music file | Kanye West - Stronger | No |
data-size | Size of the Muzica button in pixels (width and height) | 25 | Yes |
Methods
Here you find all methods that are available through the globally Muzica
object.
Method | Description | Example |
---|---|---|
createButton(element) | Renders a Muzica button within the element | Muzica.createButton(document.getElementById('#test')) |
renderAll() | Renders all elements that have the class "muzica-button" including valid attributes | Muzica.renderAll() |