Merge pull request #746 from simeng/master
Add preview of .mp3, .ogg and .wav links via <audio> tag.
This commit is contained in:
commit
c706c93e43
|
@ -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 New Issue