Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,24 @@
// test image for web notifications
var iconImage = null;

AP.init({
container:'#player',//a string containing one CSS selector
volume : 0.7,
autoPlay : true,
notification: false,
playList: [
{'icon': iconImage, 'title': 'Try Everything', 'file': 'mp3/try-everything.mp3'},
{'icon': iconImage, 'title': 'Let It Go', 'file': 'mp3/let-it-go.mp3'}
]
});
fetch("playlist.json")
.then(response => {
if (response.ok) {
return response.json()
} else {
throw Error('Loading playlist: ' + response.statusText)
}
})
.then(playList => {
AP.init({
container:'#player',//a string containing one CSS selector
volume : 0.7,
autoPlay : true,
notification: false,
playList: playList
});
})
.catch(error => alert(error))
</script>
<!-- Audio player js end-->

Expand Down
12 changes: 12 additions & 0 deletions playlist.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[
{
"file" : "mp3/try-everything.mp3",
"icon" : null,
"title" : "Try Everything"
},
{
"icon" : null,
"title" : "Let It Go",
"file" : "mp3/let-it-go.mp3"
}
]