2

I want to add oembed provider to my buddypress activity content

I found this function

<?php wp_oembed_add_provider( $format, $provider, $regex ); ?> 

I know I need it to add with init filter

I've contacted developers of that site and they gave me oembed link.

so site is http://www.myvideo.ge/

and they gave me this link: http://embed.myvideo.ge/flv_player/player.php?video_id=xxxx.format

so if video is http://www.myvideo.ge/?video_id=2119027 I need to contact http://embed.myvideo.ge/flv_player/player.php?video_id=2119027.mp4

But I have no Idea how to sum everything this

2

The easiest way would be to take advantage of Embedly's outstanding API. Add this code to your theme's functions.php:

// Add Myvideo oEmbed
function add_oembed_myvideo(){
  wp_oembed_add_provider(
    'http://www.myvideo.ge/*',
    'http://api.embed.ly/v1/api/oembed'
  );
}

add_action('init', 'add_oembed_myvideo');

Embedly is free up to 5,000 "unique URLs per hour per month". Unless you're going wild with embeds on your site, you'll probably never need to pay. But if you're interested in Embedly's premium services, here's details on their pricing.

  • first of all, it's not working, it's only parsing the title and giving inside anchor. that's not exactly what I'm looking for, maybe wp_embed_register_handler ... I will do more inverstigation I guess – CBeTJlu4ok Aug 30 '13 at 5:15
  • 1
    It doesn't look like myvideo.ge is actually implementing oEmbed.They definitely don't support oEmbed discovery, because there's no <link rel="alternate" type="application/json+oembed" href="…"> tag in the page. If you look at the source code for a YouTube page, you'll see a tag like that pointing to a link like this. That JSON document is what WordPress and intermediaries like Embedly use to find out how a provider wants their content embedded, which is in the html member. – Dave Ross Aug 30 '13 at 13:08
  • 1
    If they're not using oEmbed, then wp_embed_register_handler is the way to go. You'd be responsible for generating the HTML in your code, but the example on the wp_embed_register_handler Codex page should make it easy to write your own handler. – Dave Ross Aug 30 '13 at 13:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.