Extension talk:YouTube (Iubito)

From MediaWiki.org
Jump to: navigation, search

how do I add a link for the youTube in the navigation menu[edit]

Well ... I followed your instructions and there weren't any errors. However, how do I add a link for the youTube in the navigation menu at my wiki so my members know it even exists?

Full URL should also work[edit]

Is there a way users can also use the full URL of a Youtube video? People are not used to deleting part of a YouTube URL. The way to do this could be:

IF $input string starts with "http:", THEN use this as the embed code directly - ELSE (do as you have done).--Matt57 05:24, 21 October 2006 (UTC)

More Parameters[edit]

If you want to add some parameters like

<youtube>ID|width|height|style</youtube>

use the following code instead of the one provided before (just replace this one procedure):

 # The callback function for converting the input text to HTML output
  function renderYouTube($input) {
        $params = explode ("|", $input);
        $id = $params[0];
        $width = 425;
        $height = 350;
        $addStyle = '';
        if (count($params) > 1) {
           $width = $params[1];
           if (count($params) > 2) {
              $height = $params[2];
              if (count($params) > 3) {
                 $addStyle = ' style="'. $params[3] . '"';
                 }
              }
           }
        $output='<object width="'.$width.'" height="'.$height.'"' . $addStyle . '>'
                .'<param name="movie" value="http://www.youtube.com/v/'.$id.'">'
                .'</param><param name="wmode" value="transparent"></param>'
                .'<embed src="http://www.youtube.com/v/'.$id
                .'" type="application/x-shockwave-flash" wmode="transparent"'
                .' width="'.$width.'" height="'.$height.'"' 
                . $addStyle . '></embed></object>';
 
        return $output;
 }

Anywhere on your page, you just type the following information:

<youtube>VideoID</youtube>

Where the "VideoID" is the code follows after "watch?v="
In the following case, it is WZpeeRSk-0A

url http://www.youtube.com/watch?v=WZpeeRSk-0A

Good-luck!

--Kohyin 23:16, 24 January 2007 (UTC)

YouTube opens up in new window[edit]

This works great embedding the YouTube video except when hitting the PLAY arrow, a new window opens up to the full YouTube page versus playing the video embedded in the page as your sample does. Am I doing something wrong or has something changed?

Thanks! -Larry


FYI, I copied the .php codes from the article page not from the discussion page, and I use the simplified sintax as I mentioned above. My videos are running as they should.--Kohyin 07:35, 30 January 2007 (UTC)

If you click on the big "play" button in the middle of the video, it works OK. I also noticed that if you click on the small "play" button on bottom/left, it opens a new page. This bottom/left button works well to pause/replay after starting the video with the big middle button. --82.255.133.227 06:54, 17 May 2007 (UTC)

Revvr[edit]

Would it be possible to modify this extension, to play videos from the revver site?--Rovo 22:31, 14 February 2007 (UTC)

Tabe of Contents broken by this extension[edit]

Hi all...anyone noticed that if you use this extension in a page that has a Table of Contents that the section link to the one below the section that has the video in it actually ends up going to the section with the video in it? (clear as mud?) The work around is to a a single character after the video. ChuckMcB

That's not very clear. I didn't noticed any problem on my wiki. Can you explain better ? --82.255.133.227 06:54, 17 May 2007 (UTC)

XSS Vulnerability Example[edit]

For an example of how this extension is vulnerable to XSS attacks, consider the following:

<youtube>" id="deleteme">
<script type="text/javascript">
var dm=document.getElementById('deleteme');
dm.parentNode.removeChild(dm);
alert('XSS Attack Here!');
</script>
<embed style="display:none</youtube>

--Jimbojw 16:31, 27 March 2007 (UTC)

This is now fixed !
Thanks for the concrete example of what is a XSS vulnerability. I've heard this word before but can't get an example of what it is.
--Iubito 06:55, 17 May 2007 (UTC)
That's why the warning template links to the wikipedia article that explains it... -- Duesentrieb 00:06, 18 May 2007 (UTC)
The fix was bogus -- validation was done against a variable that doesn't exist, and never failed. Fixed properly with validation on the right variable plus proper, safe by default output. Note similar fix to Extension:YouTube (emijrp). Thanks to Andy Webber for reporting the bug remaining in both. --brion 18:44, 9 July 2008 (UTC)

Sizing[edit]

Would it be possible to change the size of the youtube video with a code? I am unable to find a way to do this thusfar and it would immensely useful. --Entropy 16:14, 6 July 2007 (UTC)

Parameters not documented[edit]

This isn't documented very well.

Of the 4 parameters, ID, width, height and Style. I don't know what Style does.

Can someone explain?

Judging from [1] I think 'style' is the Flash version required to be installed in the persons PC?

  • Also did you know if you add '&autoplay=1' after the ID then it autoplays? :-))

--Quatermass 18:47, 2 October 2007 (UTC)


YouTube button[edit]

Is there a way to add a YouTube-button to the other editing buttons (Such as "Bold text", "External link" and "Horizontal line") that automaticly creates the text "<youtube>Insert YouTube-URL here</youtube>" in the editor?

/Abbedabb 15:17, 25 August 2008 (UTC)

(better late than never? maybe...) you want to read http://www.mediawiki.org/wiki/Customizing_edit_toolbar#How_do_I_add_more_buttons_on_the_edit_page.3F it explains how to add edit buttons to the edit toolbar. arod 17 March 2010

failles ?[edit]

le code n'a plus de failles ?

W3 Validation[edit]

Any plans to make this code valid W3? specifically, see http://www.alistapart.com/articles/flashsatay about how to create flash without using the non-standard "embed" tag.

Thanks, arod, 2010-3-16

Extension doesn't seem to work well with templates.[edit]

This is a template I have on my wiki:

<div class="youtubevideo"> <youtube>{{{1}}}</youtube> If you can't see this video for whatever reason, [[youtube:{{{1}}}|try watching it on YouTube]].</div>

I type in {{youtubevideo|8HA_eJUlOKo}} (goes to this video) and get the "bad video ID!" message. After some poking around, I type in {{subst:youtubevideo|8HA_eJUlOKo}}, save the page and re-edit, and find that the "{{{1}}}" inside the <youtube> tag didn't convert!

Is there something special I need to do in order to get the template to work?

SPECIAL NOTE: The [[youtube:{{{1}}}]] bit is an interwiki link I made for my wiki. 4.249.183.235 22:01, 2 September 2010 (UTC)