Get Flickr Videos from URLs with jQuery

I liked the little flickr snippet I wrote for embedding galleries from urls so much that I decided to write another flickr centric plugin for grabbing videos from urls. This is one of those features that hasn’t got that much traction but it is pretty neat. Both of these plugin are pretty good for generating media based on user input. For instance, if a user writes a comment and pastes the link to a flickr gallery or video you can scrape the comment for those links and generate the content in the comment. Or not. Use as you may! I don’t care :P

Note: You will need an flickr API key and secret to use this plugin. You can get an API key by logging into your Yahoo/flickr account and heading here: More information on the flickr API can be found here:

Optional Settings

  • url (string Default: '')
    Is the flickr url of the video you’d like to display
  • key (string Default: '')
    The API key , provided by flickr, to use with the API
  • secret (string Default: '')
    The API secret, provided by flickr, to use with the API
  • height (number in px Default: 400)
    Is height of the gallery
  • width (number in px Default: 600)
    Is width of the gallery
  • bgcolor (hex code Default: #000000)
    Is background color of the video player


Fork this Fiddle


 * Flickr Video Plugin
 * @author Darcy Clarke
 * Copyright (c) 2012 Darcy Clarke
 * Dual licensed under the MIT and GPL licenses.

    $.fn.flickrVideo = function(options){
        var settings = $.extend({
            url : '',
            height :  400,
            width : 600,
            bgcolor : '#000000',
            key : '',
            secret : ''
            }, options),
            method = '',
            format = 'json',
            collection = this;
        id = settings.url.match(/\/photos\/(.*)/)[1].split('/')[1];
            url: ''+method+'&format='+format+'&api_key='+settings.key,
            dataType: 'jsonp',
            data: {'photo_id':id},
            type: 'GET',
            jsonpCallback: 'jsonFlickrApi',
            success: function(data){
                if( === 'video'){
                    $(this).append('<object type="application/x-shockwave-flash" width="'+settings.width+'" height="'+settings.height+'" data="" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"><param name="flashvars" value="intl_lang=en-us&photo_secret=''&photo_id='+id+'"><param name="movie" value=""><param name="bgcolor" value="'+settings.bgcolor+'"><param name="allowFullScreen" value="true"><embed type="application/x-shockwave-flash" src="" bgcolor="'+settings.bgcolor+'" allowfullscreen="true" flashvars="intl_lang=en-us&photo_secret=''&photo_id='+id+'" height="'+settings.height+'" width="'+settings.width+'"></object>');
        return collection;

Github: jQuery Flickr Video Plugin
Suggestions, problems, feedback?
Check Out the Repo


[...] Get Flickr Videos from URLs with jQueryGet Flickr Galleries from URLs with jQueryCreative Animation Using CSS clip and rotate [...]

Leave a Reply: