Embed youtube Url

Discussion in 'PHP' started by Om ji Kesharwani, Oct 24, 2010.

  1. #1
    Om ji Kesharwani, Oct 24, 2010 IP
  2. max2010

    max2010 Greenhorn

    Messages:
    81
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #2
    something like this:

    <?php
    $youtubeurl= (this comes from your db);
    $width=(set the video width);
    $height=(set the video height);
    ?>

    <object width="<?php echo $width; ?>" height="<?php echo $height; ?>" data="<?php echo $youtubeurl; ?>" type="application/x-shockwave-flash">
    <param name="allowScriptAccess" value="never" />
    <param name="allowNetworking" value="internal" />
    <param name="wmode" value="transparent" />
    <param name="movie" value="<?php echo $youtubeurl; ?>" />
    <embed src="<?php echo $youtubeurl; ?>" type="application/x-shockwave-flash" width="<?php echo $width; ?>" height="<?php echo $height; ?>" allowscriptaccess="never" allownetworking="internal" wmode="transparent" />
    </object>

    If you need to purify user text too, you can take a look at this cool library: http://htmlpurifier.org/
     
    max2010, Oct 24, 2010 IP
  3. Om ji Kesharwani

    Om ji Kesharwani Peon

    Messages:
    211
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for reply but its not working:
    I tried by setting

    <?php
    $youtubeurl="http://www.youtube.com/watch?v=En4aZkij_q4&feature=rec-LGOUT-exp_fresh+div-1r-5-HM";
    $width=200;
    $height=200;
    ?>

    <object width="<?php echo $width; ?>" height="<?php echo $height; ?>" data="<?php echo $youtubeurl; ?>" type="application/x-shockwave-flash">
    <param name="allowScriptAccess" value="never" />
    <param name="allowNetworking" value="internal" />
    <param name="wmode" value="transparent" />
    <param name="movie" value="<?php echo $youtubeurl; ?>" />
    <embed src="<?php echo $youtubeurl; ?>" type="application/x-shockwave-flash" width="<?php echo $width; ?>" height="<?php echo $height; ?>" allowscriptaccess="never" allownetworking="internal" wmode="transparent" />
    </object>
     
    Om ji Kesharwani, Oct 24, 2010 IP
  4. max2010

    max2010 Greenhorn

    Messages:
    81
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #4
    try to change the url like this:

    $youtubeurl="http://www.youtube.com/v/En4aZkij_q4";
     
    max2010, Oct 24, 2010 IP