Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Feb 2009
    Posts
    90
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Help with auto video embedding php script

    1) Project Details:

    I have a php script that will take a youtube link from the text in my blog and embed a player instead.

    I would like to be able to do this with other video links such as facebook and other popular sites

    I have found a good php class to do this but can't implement this into how I need it to work.

    My current working script is this:

    PHP Code:

    //youtube embed video


    function parseYoutubeUrls($message$width = -1$height = -1)
      {
        
    // defaults
        
    if($width == -1) { $width 425; }
        if(
    $height == -1) {  $height round((344/425) * $width); }

        
    // get all urls in text
        
    $regexp "/<a\s+.*?href=[\"\']?([^\"\' >]*)[\"\']?[^>]*>(.*)<\/a>/i";
        if(
    preg_match_all($regexp$message$matchesPREG_SET_ORDER))
        {
          
    // check each url
          
    foreach($matches as $match)
          {
            
    // replace all youtube urls with embedded flash player
            
    if(preg_match_all("/www.youtube.com/",$match[1],$hit))
            {
              
    $parsedUrl parse_url($match[1]);
              
    parse_str($parsedUrl["query"], $query);
              
    $videoId = ($query['v']);
              
    $replace '<div align="center"><p><object width="'.$width.'" height="'.$height.'"><param name="movie" value="http://www.youtube.com/v/'.$videoId.'&hl=sv&fs=1&rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/'.$videoId.'&hl=sv&fs=1&rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="'.$width.'" height="'.$height.'"></embed></object></p></div>';
              
    $message str_replace($match[0],$replace$message);
            }
          }
        }
        return (
    $message);
      }

    //youtube embed video finish 

    The class I have found is this: http://www.phpclasses.org/package/70...ote-sites.html

    and I believe this will work

    The working youtube script can be seen here www.djhandsfree.co.uk

    My blog is built around this package here: http://mybloggie.mywebland.com/

    The only files that need modifying within this package are with the includes folder being files: functions.php and in the parent folder view.php and viewmode.php

    Other links I have used so far to help me are:
    http://codingrecipes.com/php-convert...d-vimeo-player
    http://stackoverflow.com/questions/6...h-video-player
    http://www.marcusnyberg.com/2009/10/...d-flash-player




    2) Payment method/ details (Paypal, check? Timeline?):

    Payment by Paypal - please quote a price and I will see if it's within my budget

    Thanks

  • #2
    New to the CF scene
    Join Date
    Oct 2011
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts
    My price is 30$, but I only can get western union payements.
    Portfolio: wassgha.t15.org
    Email: Wassgha@gmail.com


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •