mirror of
https://github.com/captbaritone/webamp.git
synced 2026-01-23 10:15:31 +00:00
Infer name from url
This commit is contained in:
parent
06b3412e4f
commit
f492da6abd
3 changed files with 10 additions and 5 deletions
|
|
@ -2,7 +2,7 @@
|
|||
<body>
|
||||
<script src='embed.min.js'
|
||||
data-media="https://cdn.rawgit.com/captbaritone/llama/master/llama-2.91.mp3"
|
||||
data-filename= "1. DJ Mike Llama - Llama Whippin' Intro"
|
||||
data-filename="1. DJ Mike Llama - Llama Whippin' Intro"
|
||||
></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -42,8 +42,7 @@ var initFromTemplate = function (template) {
|
|||
'volume': 50,
|
||||
'balance': 0,
|
||||
'mediaFile': {
|
||||
'url': scriptTag.dataset.media,
|
||||
'name': scriptTag.dataset.trackname
|
||||
'url': scriptTag.dataset.media
|
||||
},
|
||||
'skinUrl': 'https://cdn.rawgit.com/captbaritone/winamp-skins/master/v2/base-2.91.wsz'
|
||||
});
|
||||
|
|
|
|||
10
js/winamp.js
10
js/winamp.js
|
|
@ -31,7 +31,8 @@ Winamp = {
|
|||
|
||||
this.setVolume(options.volume);
|
||||
this.setBalance(options.balance);
|
||||
this.loadFromUrl(options.mediaFile.url, options.mediaFile.name);
|
||||
var filename = options.mediaFile.name ? options.mediaFile.name : false;
|
||||
this.loadFromUrl(options.mediaFile.url, filename);
|
||||
var skinFile = new MyFile();
|
||||
skinFile.setUrl(options.skinUrl);
|
||||
this.setSkin(skinFile);
|
||||
|
|
@ -219,7 +220,12 @@ Winamp = {
|
|||
|
||||
// Used only for the initial load, since it must have a CORS header
|
||||
loadFromUrl: function(url, fileName) {
|
||||
this.fileName = fileName;
|
||||
if(fileName) {
|
||||
this.fileName = fileName;
|
||||
} else {
|
||||
this.fileName = url.split('/').pop();
|
||||
}
|
||||
|
||||
var file = new MyFile();
|
||||
file.setUrl(url);
|
||||
file.processBuffer(this._loadBuffer.bind(this));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue