I am interested in adding several new filters for different video sites, but I need some help getting started. I'm looking at both TED and Democracy Now to begin with.

Example TED

<object width="526" height="374">
<param name="movie" value="http://video.ted.com/assets/player/swf/EmbedPlayer.swf"></param>
<param name="allowFullScreen" value="true" />
<param name="allowScriptAccess" value="always"/>
<param name="wmode" value="transparent"></param>
<param name="bgColor" value="#ffffff"></param>
<param name="flashvars" value="vu=http://video.ted.com/talk/stream/2011G/Blank/RoryStewart_2011G-320k.mp4&su=http://images.ted.com/images/ted/tedindex/embed-posters/RoryStewart-2011G.embed_thumbnail.jpg&vw=512&vh=288&ap=0&ti=1196&lang=&introDuration=15330&adDuration=4000&postAdDuration=830&adKeys=talk=rory_stewart_time_to_end_the_war_in_afghanistan;year=2011;theme=a_taste_of_tedglobal_2011;theme=new_on_ted_com;theme=bold_predictions_stern_warnings;theme=war_and_peace;event=TEDGlobal+2011;tag=Foreign+Policy;tag=Global+Issues;tag=military;tag=peace;tag=politics;tag=war;&preAdTag=tconf.ted/embed;tile=1;sz=512x288;" />
<embed src="http://video.ted.com/assets/player/swf/EmbedPlayer.swf" pluginspace="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" bgColor="#ffffff" width="526" height="374" allowFullScreen="true" allowScriptAccess="always" flashvars="vu=http://video.ted.com/talk/stream/2011G/Blank/RoryStewart_2011G-320k.mp4&su=http://images.ted.com/images/ted/tedindex/embed-posters/RoryStewart-2011G.embed_thumbnail.jpg&vw=512&vh=288&ap=0&ti=1196&lang=&introDuration=15330&adDuration=4000&postAdDuration=830&adKeys=talk=rory_stewart_time_to_end_the_war_in_afghanistan;year=2011;theme=a_taste_of_tedglobal_2011;theme=new_on_ted_com;theme=bold_predictions_stern_warnings;theme=war_and_peace;event=TEDGlobal+2011;tag=Foreign+Policy;tag=Global+Issues;tag=military;tag=peace;tag=politics;tag=war;&preAdTag=tconf.ted/embed;tile=1;sz=512x288;"></embed>

Example Democracy Now

<script type="text/javascript" src="http://www.democracynow.org/embed_show_v2/300/2011/7/27/story/norwegian_shooting_suspects_views_echo_xenophobia"></script>

If someone can help walk me through one of these I will be able to repeat this process for several other video sites. I will happily share my work back here for everyone to use and to possibly be committed to the module.


Status:Active» Postponed (maintainer needs more info)

The problem with both those sites is that there is no ID in the URL that we can use to construct the codec. I don't really see how we can support these I'm afraid.

Thanks for the feedback blackdog. I only have a small group of users, with a separate role on the site, who would be going off the beaten path for these video sites, but I would like to support them. What do you think my best option is then?

Try to find what really needs to be used for the embed codes, and try to create an URL pattern that your users can craft by hand, using information found on site. See the Slideshare codec for example.

I really would like those two supported too. In addition MIT World..... IF you find out let me know. THanks!

I think I can do it (I need now), but I don't know why the module don't catch my codec.

It this:

function MIMODULE_codec_info() {
  $codecs = array();
  // You can offer multiple video formats in one module.
  $codecs['TED'] = array(
    // Will be used some day in user information.
    'name' => t('TED'),
    // Special instructions for end users. Optional.
    'instructions' => t('Click in Embed and copy the link -Link to this talk- and paste here.'),
    // The callback that will output the right embed code.
    'callback' => 'MIMODULE_TED',
    // HTML5 callback, for returning something that's device agnostic.
    // @SEE video_filter_youtube_html5.
    // 'html5_callback' => 'MODULE_service_html5',
    // Regexp can be an array. $video['codec']['delta'] will be set to the key.
    'regexp' => '/ted\.com\/talks\/lang\/([a-zA-Z]+)\/([a-zA-Z0-9\-_]+)\.html',
    'sample_url' => 'http://www.ted.com/talks/lang/es/tim_berners_lee_on_the_next_web.html',
    // Ratio for resizing within user-given width and height (ratio = width / height)
    'ratio' => 425 / 355,
  return $codecs;

Drupal return me the next:

<!-- VIDEO FILTER - INVALID CODEC IN: [video:http://www.ted.com/talks/lang/es/tim_berners_lee_on_the_next_web.html width:300 height:300] -->

Now it's run perfectly:

function customizations_mail($key,&$message,$params){
    switch ($key) {
        case 'mandatory_course_mail':
            $message['headers']['Content-Type'] = 'text/html; charset=UTF-8; format=flowed';
            $message['subject'] = $params['subject'];
            $message['body'][] = $params['body'];
function customizations_codec_info() {
  $codecs = array();
  // You can offer multiple video formats in one module.
  $codecs['ted'] = array(
    // Will be used some day in user information.
    'name' => t('TED'),
    'instructions' => t('Click in Embed and copy the link -Link to this talk- and paste here.'),
    'callback' => 'customizations_TED',
    'html5_callback' => 'customizations_TED',
    'regexp' => '/ted\.com\/talks\/lang\/([a-zA-Z]+)\/([a-zA-Z0-9\-_]+)\.html/',
    'sample_url' => 'http://www.ted.com/talks/lang/es/tim_berners_lee_on_the_next_web.html',
    // Ratio for resizing within user-given width and height (ratio = width / height)
    'ratio' => 4 / 3,
  return $codecs;
function customizations_TED($video) {
  $video['source'] = 'http://embed.ted.com/talks/'.$video['codec']['matches'][2].'.html';
  return video_filter_iframe($video);

I'm going to create a new patch for the module for this new provider. :) Only need time.

Issue summary:View changes
Status:Postponed (maintainer needs more info)» Needs review
new1.51 KB

I added support for TED. Test it please.

Component:Documentation» Code

I change the issue type because now have a code solution directly.