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
http://www.ted.com/talks/rory_stewart_time_to_end_the_war_in_afghanistan...

<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>
</object>

Example Democracy Now
http://www.democracynow.org/2011/7/27/norwegian_shooting_suspects_views_...

<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.

Comments

blackdog’s picture

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.

bryancasler’s picture

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?

blackdog’s picture

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.

AntiNSA’s picture

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

estoyausente’s picture

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] -->

estoyausente’s picture

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'];
            break;
    }
}

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.

estoyausente’s picture

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

I added support for TED. Test it please.

estoyausente’s picture

Component:Documentation» Code

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

estoyausente’s picture

TED have changed his url (now it hasn't .html at the end of it). I change the code and I made a patch.

estoyausente’s picture

Title:Help with creating new filters» Help with creating new filters [Added TED support code patch]
markconroy’s picture

Hi folks,

I've created two modules which allow you to embed videos from these two providers with video_filter module:

https://www.drupal.org/project/video_filter_democracynow
https://www.drupal.org/project/video_filter_ted

Hope that helps someone.

bryancasler’s picture

Thank you Mark!

estoyausente’s picture

Ok, But I think that is better create an integration with it :(

markconroy’s picture

Hi estoyausente,

If the module maintainer(s) wish to integrate these with the parent module, they are welcome to. Seems to take a long time for this to happen, so in the meantime, my modules are useful/usable (and they solve the two issues posted as part of this issue, rather than just the TED issue).

One of the reasons that I didn't add them as patches was that I was using them as part of my project application review for getting full project creation rights.

estoyausente’s picture

Category:Support request» Feature request

Yes, @markconroy my comment isn't for your work (ty for do it). But it's a little bit sad that we have to create a new module for this "stupid" thing.

Regards!

markconroy’s picture

Well like I say, the code is there now, and I have no problem with video_filter maintainers adding it to video_filter. Just means if they don't have time to do it, it's still usuable in the short term.

Thanks.