Making Pretty Photo + Dailymotion videos works
  • Hi,

    first, sorry for my english ( i'm french )...and thanks to S.Caron for this plugin !

    I needed to use Dailymotion videos with Pretty Photo but it's not yet implemented so i had a few code lines into the plugin, if it can help...

    It works with the url of the dailymotion page, i.e :

    The plugin modifications :

    Edit the "_getFileType" function ( near line 600 / 610 ), add a "else if" condition :
    else if (itemSrc.match(/dailymotion\.com\/video/i)) {
    return 'dailymotion';

    so, the function look like this now :

    function _getFileType(itemSrc){
    if (itemSrc.match(/youtube\.com\/watch/i)) {
    return 'youtube';
    }else if (itemSrc.match(/dailymotion\.com\/video/i)) {
    return 'dailymotion';
    }else if (itemSrc.match(/vimeo\.com/i)) {
    return 'vimeo';
    }else if(itemSrc.indexOf('.mov') != -1){
    return 'quicktime';
    }else if(itemSrc.indexOf('.swf') != -1){
    return 'flash';
    }else if(itemSrc.indexOf('iframe') != -1){
    return 'iframe';
    }else if(itemSrc.indexOf('custom') != -1){
    return 'custom';
    }else if(itemSrc.substr(0,1) == '#'){
    return 'inline';
    return 'image';

    Then on the open event $ ( near line 150 / 160 ) find the fadein function $pp_pic_holder.fadeIn...
    In the "switch" instruction add a "case" :

    case 'dailymotion':
    correctSizes = _fitToViewport(movie_width,movie_height); // Fit item to viewport
    // Remove url's beginning
    var videoid = pp_images[set_position].replace(/http:\/\/www\.dailymotion\.com\/video\//gi, '');
    // "Explode" the end of the string to catch the video id
    var spt = videoid.split('_');
    // Video id is index 0
    movie = '' + spt[0] + '?width=&theme=none&iframe=0&additionalInfos=0&autoPlay=1&hideInfos=0';
    toInject = settings.flash_markup.replace(/{width}/g,correctSizes['width']).replace(/{height}/g,correctSizes['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);

    You can edit the line "movie = 'http://www..." to set your video options like "autoPlay" or something else.

    It works fine for me so i hope it can help...

  • minor modification below
  • Thanks for this; it worked, but with a minor modification:

    at the end of the case 'dailymotion', it's better to inject in an iframe_markup to respect Dailymotion embed player:

    toInject = settings.iframe_markup.replace(/{width}/g,correctSizes['width']).replace(/{height}/g,correctSizes['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);

    instead of

    toInject = settings.flash_markup.replace(/{width}/g,correctSizes['width']).replace(/{height}/g,correctSizes['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Login with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter