316 posts
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Has been part of the Envato Community for over 3 years
+2 more
SyamilMJ says

Basically I’m trying to add support for Screenr for the built-in oEmbed protocol using this:

wp_oembed_add_provider( '#http://(www\.)?screenr\.com/.*#i', 'http://www.screenr.com/api/oembed.json', true ); // Screenr

Now whenever I try to use, for example:

[embed width="560"]http://www.screenr.com/WbZs[/embed]

The embed code outputs just fine except that it doesn’t respect the defined width. The output for the above code is:

<iframe src="http://www.screenr.com/embed/udcs" frameborder="0" height="396" width="650"></iframe>

Is there any way I could fix this?

214 posts
  • Has referred 1+ members
  • Has collected 50+ items on Envato Market
  • Has been part of the Envato Community for over 5 years
  • Sells items exclusively on Envato Market
agusmu says
316 posts
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Has been part of the Envato Community for over 3 years
+2 more
SyamilMJ says

That works for other videos, but screenr just returns nothing. Here’s how I call it:

/*-----------------------------------------------------------------------------------*/
/* Video Wrapper - [video width=""] url [/video]
/*-----------------------------------------------------------------------------------*/

function aq_shortcode_video_wrapper($atts, $content = null) {

    global $wp_embed, $content_width;

    $defaults = array(
        'align' => '',
        'width'    => 590,
    );

    extract( shortcode_atts( $defaults, $atts ) );

    $content_width = $width;
    $embed_code = $wp_embed->autoembed($content);    

    //$embed_code = wp_oembed_get( $content, array('width' => $width)  );

    $output = '';

    if ($width)
        $output = '<div class="aq-video-wrapper radius3 cf '.$align.'" style="width:'.$width.'px;">' . $embed_code . '</div>';

    return $output;
}

add_shortcode( 'video', 'aq_shortcode_video_wrapper' );

Funnily, if you use $wp_embed->shortcode($id,$url) as explained in this tutorial, it will output the video but the width remains unchanged.

by
by
by
by
by
by