Add preview of .mp3, .ogg and .wav links via <audio> tag.
This fixes #745
This commit is contained in:
parent
2c9e7c7023
commit
b7183fb404
1 changed files with 19 additions and 1 deletions
|
@ -313,6 +313,24 @@ plugins.factory('userPlugins', function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/*
|
||||||
|
* audio Preview
|
||||||
|
*/
|
||||||
|
var audioPlugin = new UrlPlugin('audio', function(url) {
|
||||||
|
if (url.match(/\.(mp3|ogg|wav)\b/i)) {
|
||||||
|
return function() {
|
||||||
|
var element = this.getElement();
|
||||||
|
var aelement = angular.element('<audio controls></audio>')
|
||||||
|
.addClass('embed')
|
||||||
|
.attr('width', '560')
|
||||||
|
.append(angular.element('<source></source>')
|
||||||
|
.attr('src', url));
|
||||||
|
element.innerHTML = aelement.prop('outerHTML');
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* mp4 video Preview
|
* mp4 video Preview
|
||||||
*/
|
*/
|
||||||
|
@ -504,7 +522,7 @@ plugins.factory('userPlugins', function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
plugins: [youtubePlugin, dailymotionPlugin, allocinePlugin, imagePlugin, videoPlugin, spotifyPlugin, cloudmusicPlugin, googlemapPlugin, asciinemaPlugin, yrPlugin, gistPlugin, giphyPlugin, tweetPlugin, vinePlugin]
|
plugins: [youtubePlugin, dailymotionPlugin, allocinePlugin, imagePlugin, videoPlugin, audioPlugin, spotifyPlugin, cloudmusicPlugin, googlemapPlugin, asciinemaPlugin, yrPlugin, gistPlugin, giphyPlugin, tweetPlugin, vinePlugin]
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue