Merge pull request #529 from glowing-bear/add-video-support

Display ogv, mp4 and webm videos inside a video tag
This commit is contained in:
David Cormier 2015-02-18 11:03:31 -05:00
commit 544f27c472
3 changed files with 24 additions and 1 deletions

View file

@ -309,6 +309,10 @@ div.embed img.embed {
max-width: 100%; max-width: 100%;
} }
video.embed {
max-width: 100%;
}
div.colourbox { div.colourbox {
display: inline-block; display: inline-block;
border-radius: 3px; border-radius: 3px;

View file

@ -267,6 +267,15 @@ plugins.factory('userPlugins', function() {
} }
}); });
/*
* mp4 video Preview
*/
var videoPlugin = new UrlPlugin('video', function(url) {
if (url.match(/\.(mp4|webm|ogv)\b/i)) {
return '<video class="embed" width="560"><source src="'+url+'"></source></video>';
}
});
/* /*
* Cloud Music Embedded Players * Cloud Music Embedded Players
*/ */
@ -382,7 +391,7 @@ plugins.factory('userPlugins', function() {
}); });
return { return {
plugins: [youtubePlugin, dailymotionPlugin, allocinePlugin, imagePlugin, spotifyPlugin, cloudmusicPlugin, googlemapPlugin, asciinemaPlugin, yrPlugin, gistPlugin, tweetPlugin, vinePlugin] plugins: [youtubePlugin, dailymotionPlugin, allocinePlugin, imagePlugin, videoPlugin, spotifyPlugin, cloudmusicPlugin, googlemapPlugin, asciinemaPlugin, yrPlugin, gistPlugin, tweetPlugin, vinePlugin]
}; };

View file

@ -71,6 +71,16 @@ describe('filter', function() {
plugins); plugins);
})); }));
it('should recognize html5 videos', inject(function(plugins) {
expectTheseMessagesToContain([
'http://www.quirksmode.org/html5/videos/big_buck_bunny.mp4',
'http://www.quirksmode.org/html5/videos/big_buck_bunny.webm',
'http://www.quirksmode.org/html5/videos/big_buck_bunny.ogv',
],
'video',
plugins);
}));
it('should recognize images', inject(function(plugins) { it('should recognize images', inject(function(plugins) {
expectTheseMessagesToContain([ expectTheseMessagesToContain([
'http://i.imgur.com/BTNIDBR.gif', 'http://i.imgur.com/BTNIDBR.gif',