mirror of
https://github.com/captbaritone/webamp.git
synced 2026-08-01 14:33:38 +00:00
Add an example showing multiple skins loaded
This commit is contained in:
parent
22d88bf60e
commit
3c15b7f044
2 changed files with 62 additions and 0 deletions
13
examples/multipleSkins/README.md
Normal file
13
examples/multipleSkins/README.md
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# Multiple Skins Example
|
||||
|
||||
An example of setting up Webamp with multiple skins.
|
||||
|
||||
This example fetches the Webamp bundle from a free CDN, and fetches the audio file and skin from a free CDN as well.
|
||||
|
||||
You should be able to open this local html file in your browser and see Webamp working.
|
||||
|
||||
```
|
||||
$ git clone git@github.com:captbaritone/webamp.git
|
||||
$ cd webamp
|
||||
$ open examples/multipleSkins/index.html
|
||||
```
|
||||
49
examples/multipleSkins/index.html
Executable file
49
examples/multipleSkins/index.html
Executable file
|
|
@ -0,0 +1,49 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="app" style="height: 100vh">
|
||||
<!-- Webamp will attempt to center itself within this div -->
|
||||
</div>
|
||||
<script src="https://unpkg.com/webamp@1.4.2/built/webamp.bundle.min.js"></script>
|
||||
<script>
|
||||
const Webamp = window.Webamp;
|
||||
const webamp = new Webamp({
|
||||
// Optional. An array of objects representing skins.
|
||||
// These will appear in the "Options" menu under "Skins".
|
||||
// Note: These URLs must be served with the correct CORs headers.
|
||||
//
|
||||
// These will appear in the dropdown menu under "Skins".
|
||||
availableSkins: [
|
||||
{
|
||||
url: "https://archive.org/cors/winampskin_Green-Dimension-V2/Green-Dimension-V2.wsz",
|
||||
name: "Green Dimension V2",
|
||||
},
|
||||
{
|
||||
url: "https://archive.org/cors/winampskin_mac_os_x_1_5-aqua/mac_os_x_1_5-aqua.wsz",
|
||||
name: "Mac OSX v1.5 (Aqua)",
|
||||
},
|
||||
],
|
||||
initialTracks: [
|
||||
{
|
||||
metaData: {
|
||||
artist: "DJ Mike Llama",
|
||||
title: "Llama Whippin' Intro",
|
||||
},
|
||||
// NOTE: Your audio file must be served from the same domain as your HTML
|
||||
// file, or served with permissive CORS HTTP headers:
|
||||
// https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
|
||||
url: "https://cdn.jsdelivr.net/gh/captbaritone/webamp@43434d82cfe0e37286dbbe0666072dc3190a83bc/mp3/llama-2.91.mp3",
|
||||
duration: 5.322286,
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
// Returns a promise indicating when it's done loading.
|
||||
webamp.renderWhenReady(document.getElementById("app"));
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue