leedo / noembed

oEmbed gateway service with additional non-oEmbed sources
http://www.noembed.com
481 stars 90 forks source link

As an oembed provider, how do I provide a javascript rich html? #19

Closed simkimsia closed 11 years ago

simkimsia commented 11 years ago

Hi there, I have no issues creating API end point.

My issue is how do I provide a javascript rich html material?

The html material I want to provide is a "book" and the javascript library I will rely on is turnjs.

Here is an example of the page I want to expose via noembed: http://www.turnjs.com/#samples/steve-jobs

So how do I prepare the resource for the resource to be embeddable?

leedo commented 11 years ago

Hi there,

If you are implementing this all on the noembed side of things (aka not running an external oEmbed service) you'll probably want to create an HTML template in share/templates/. Then you can use $self->render($vars) in the serialize method. Then you can include any javascript you want in your template.

Here is an example: render call: https://github.com/leedo/noembed/blob/master/lib/Noembed/Source/Twitter.pm#L82 template: https://github.com/leedo/noembed/blob/master/share/templates/Twitter.html

I hope that helps!

simkimsia commented 11 years ago

Hi leedo,

I am using PHP for my web application.

So does that mean I need to git clone the noembed files and then host them on my server?

I believe noembed uses Perl?

leedo commented 11 years ago

Hi again,

If this is your own application, I would suggest just implementing an oEmbed endpoint in your own application. Then adding noemebd support is as simple as something like the Flickr provider.

See here for more details: http://oembed.com/#section1

You would want to implement the rich type, making sure the html parameter is defined.