Giter VIP home page Giter VIP logo

meteor-oembed's Introduction

iframely:oembed for Meteor

This package adds embed codes support to Meteor through a oEmbed proxy API. The proxy is configurable, you can use Iframely (with API key), our open-source version, or any other proxy. Including implementing your own.

Quick demo: http://iframely.meteor.com/

iframely:oembed can cache oEmbeds in the database. The package also lets you optionally customize the templates used for renders (especially if the URL is link type and only has title, description and a thumbnail).

Install

meteor add iframely:oembed

Usage

{{>oembed}}

Template context should be an object with url attribute.

Configuration

Configure oembed rendering widget and oEmbed api endpoint:

Meteor.startup(function() {

    // Optional client-side template. If not specified - default widget used.
    IframelyOembed.setTemplate('customWidget');

    // Please configure your oEmbed proxy address. 
    // Default: `'http://open.iframe.ly/api/oembed'` powered by oembedapi.com
    // Query string parameters are fine too
    IframelyOembed.setEndpoint('http://iframe.ly/api/oembed?api_key=<key>');

    // Optionally cache oEmbeds using mongo collection. Defaults:
    IframelyOembed.setCacheOptions({
        cacheTTL: 1000 * 60 * 60, // Hour.
        cacheErrorTTL: 1000 * 60, // Minute.
        cacheEnabled: true
    });
});

See the default base widget as example and boilerplate for template customization:

The context of the widget is the oEmbed JSON object itself. If oEmbed is loading, the temp context is:

{
    loading: true
}

If an error is encountered during oEmbed request (such as page 404s or proxy 503s), the context is set to:

{
    error: ErrorInstance
}

Alternative way to customize base widget is simply via CSS: base-widget.css

Integration example

Here is the integration diff that activates iframely:oembed in the exmaple Meteor todos application (embeds will show up if todo's text is url): meteor-todo-iframely-oembed-demo

And another simple demo app used to test package: meteor-iframely-demo.

License

MIT, (c) 2014 Itteco Software Corp.

meteor-oembed's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

meteor-oembed's Issues

Adding fields to template

Hi there,

I'm trying to create a meteor form with 3 fields. Title, description and URL. Once the form is submitted the title and description would appear above the embedded URL. I have your base code working to type in a video url and have it appear embedded, but am struggling to add the title & description fields to the template.

Can you help me? I'm a coding newbie so please forgive if its a basic question.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.