Added oEmbed video support.

pull/1181/head
George Secrieru 10 years ago
parent 22432bb990
commit 41852253f4
  1. 4
      packages/rocketchat-oembed/client/baseWidget.coffee
  2. 10
      packages/rocketchat-oembed/client/oembedVideoWidget.html
  3. 1
      packages/rocketchat-oembed/package.js

@ -1,6 +1,5 @@
Template.oembedBaseWidget.helpers
template: ->
# console.log this
if this._overrideTemplate
return this._overrideTemplate
@ -10,6 +9,9 @@ Template.oembedBaseWidget.helpers
if this.headers?.contentType?.match(/audio\/.*/)?
return 'oembedAudioWidget'
if this.headers?.contentType?.match(/video\/.*/)?
return 'oembedVideoWidget'
if this.parsedUrl?.host is 'www.youtube.com' and this.meta?.twitterPlayer?
return 'oembedYoutubeWidget'

@ -0,0 +1,10 @@
<template name="oembedVideoWidget">
{{#if parsedUrl}}
<blockquote>
<video controls class="inline-video">
<source src="{{url}}" type="{{headers.contentType}}">
Your browser does not support the video element.
</video>
</blockquote>
{{/if}}
</template>

@ -21,6 +21,7 @@ Package.onUse(function(api) {
api.addFiles('client/oembedImageWidget.coffee', 'client');
api.addFiles('client/oembedAudioWidget.html', 'client');
api.addFiles('client/oembedVideoWidget.html', 'client');
api.addFiles('client/oembedYoutubeWidget.html', 'client');

Loading…
Cancel
Save