Please create an account or log in to build a reputation and unlock more editing privileges!!!
Talk:YouTube
This is useful, thanks, but how do I change other parameters like dimensions (widescreen aspect ratio) and add a full-screen button? -Torley
- Actually current version of the widget doesn't support these features. Do you know a page for developers where all these parameters are described? I'll be happy to add them. --Sergey Chernyshev 15:31, March 20, 2009 (UTC)
- The YouTube API should have something useful. -- Mkailash 00:24, December 27, 2009 (UTC)
The widget is extremely useful, thanks! Is there a way to embed the video in image markup style formatting? -- Mkailash 00:24, December 27, 2009 (UTC)
Contents |
Adding a way to link to certain part of YT clip
As per Youtubetime which appends #t=0m00s to a YT clip. Is it possible to add a var for to represent that in this widget? Thanks for the neat widget. --SomaticJourney 18:14, February 24, 2010 (UTC)
- Yes, it should be relatively easy to add - it's just start parameter: http://code.google.com/apis/youtube/player_parameters.html#start --Sergey Chernyshev 19:22, February 24, 2010 (UTC)
play list
how to add youtube playlist?
- there seems to be no way to do that - do you have documentation about that? --Sergey Chernyshev 20:30, October 4, 2010 (MDT)
Size of Video
Hoping that you could help me make the video embed smaller than the default! Great Widget BTW! --Coffeehound 21:50, January 21, 2011 (MST)
- Added width & height parameters - enjoy ;) --Sergey Chernyshev 22:05, January 21, 2011 (MST)
- Simply incredible! Thank you for the extremely fast reply and turn around! Works great for me now!--Coffeehound 07:44, January 22, 2011 (MST)
Set Video resolution
Would it be possible to add a video resolution button to the movie frame? So people have the option to choose to play the video in a higher resolution (it looks like the default settings are now such that the video will play in its lowest resolution, 360). Or would it be possible to select the highest resolution video available from youtube to play into a wiki page? Appreciated --Akettner 16:30, April 25, 2011 (MDT)
Setting to align widget left or right edge of a page?
Can you add a setting so that we can define the alignment of the widget. Currently its aligned to the left by default. It'd be nice if we can specify the location
Examples are:- {{#widget:YouTube|id=x7fw9Wvxq1k|height=21|width=400|left}..}
{{#widget:YouTube|id=x7fw9Wvxq1k|left|height=21|width=400}..} Wikimanz 22:07, November 5, 2011 (AST)
A better version
This uses the "new" format for YouTube embeds and adds a new "hd" parameter. If the user's browser is opted-in to the YouTube HTML5 trial, the embeds will use the HTML5 player.
<includeonly><iframe width="<!--{$width|escape:'html'|default:'425'}-->"
height="<!--{$height|escape:'html'|default:355}-->"
src="http://www.youtube.com/embed/<!--{$id|escape:'urlpathinfo'}-->?rel=0&hd=<!--{$hd|escape:'html'|default:'0'}-->"
frameborder="0" allowfullscreen></iframe></includeonly>
Remove everything from after the /noinclude tag and paste this in its place.
If your site uses HTTPS, change http to https in the source to prevent the insecure item warning. --BFeely 11:17, November 20, 2011 (AST)
Other options for YouTube player...
I had tweaked this player to be more option friendly (yet simple if options not wanted) a while ago... Let me share what I came up with: First, I created Widget:YouTube with the following code:
<noinclude><span style="color: #FF0000; font-weight: bold; font-size: 1.8em">Do not use this widget directly.</span> <span style="font-size: 1.3em; text-decoration: underline;">Please use '''[[Template:YouTube]]''' if you wish to embed a video on a page.</span></noinclude><includeonly><iframe width="<!--{$width|default:'640'}-->" height="<!--{$height|default:480}-->" src="http://www.youtube.com/embed/<!--{$id|escape:'urlpathinfo'}-->?version=3&autohide=<!--{$autohide|default:'2'}-->&autoplay=<!--{$autoplay|default:'0'}-->&loop=<!--{$loop|default:'0'}--><!--{$playlist}-->" frameborder="0"></iframe></includeonly>
Then, I created a template I called Template:YouTube to allow others to use the widget and have the widget be able to auto-categorize some things with the following code:
<noinclude>__NOTOC__
== Credits ==
This widget allows you to add YouTube video player to your wiki page.
It was created by [http://www.mediawikiwidgets.org/User:Yaron_Koren Yaron Koren].
Modifications for {{SITENAME}} made by {{User|technical_13|ShoeMaker}}
== Using this widget ==
{{YouTube|id=#|width=###|height=###|id2=#|id3=#| ..snip.. |id9=#|autohide=#|autoplay=#|loop=#|hd=#}}
* '''id''' is the 11 digit alpha-numeric id-code from the URL of the video.
** '''id2''' - '''id9''' are the 11 digit alpha-numeric id-code from the URL of the videos to create a playlist.
* '''width''' will be limited to the range of ''320'' - '''640''' - ''800''. (Exception is if hd is set)
* '''height''' will be limited to the range of ''240'' - '''480''' - ''600''. (Exception is if hd is set)
* '''hd''' may be set to ''1'' OR ''2'' to over-ride the normal 800×600 ''width'' & ''height'' limits.
** Setting ''hd'' to ''1'' defaults video size to 1280×720 (720p).
** Setting ''hd'' to ''2'' defaults video size to 1920×1080 (1080p).
* '''autoplay''' may be set to 1 if you want the video to start playing as soon as it is loaded.
** <span style="font-size: .8em"><span style="color: #FF0000;">WARNING</span>: May be not desirable for most viewers.</span>
* '''autohide'''
** May be set to ''0'' to have the controls always visible.
** May be set to ''1'' to have the video progress bar and the player controls slide out of view a couple of seconds after the video starts playing.
** Set to '''2''' by default for the video progress bar to fade out while the player controls (play button, volume control, etc.) remain visible.
** May be set to ''3'' to completely remove the controls. <span style="font-size: .8em;">(This is <span style="color: #FF0000;">NOT</span> recommended.)</span>
*** <span style="font-size: .7em;">Setting this to ''3'' is actually setting '''''controls''''' to ''0''.</span>
* <span style="color: #FF0000;">WARNING</span>: The following may not work in all instances. Currently only works for people loading with HTML5 and not AS3 viewers.
** '''loop''' may be set to ''1'' if you want the video(s) to play over and over and over again in an infinite loop.<!--
//* AS3 stuffs currently not working
* <span style="color: #FF0000;">WARNING</span>: May not work in all instances. Currently only works for people loading with AS3 and not HTML5 viewers.
** '''rel''' may be set to ''1'' if you wish your viewers to be subjected to '''rel'''ated videos screens at the end of the presentation.
** '''modestbranding''' may be set to ''1'' to prevent the "YouTube" logo from showing up on the control bar.
** '''annotation''' may be set to ''0'' to turn off any video annotations so that they will not be shown.
** '''showinfo''' may be set to ''0'' to cause the player to not display information like the video title and uploader before the video starts playing. -->
<span style="font-size: 1.4em;">* '''Bold''' </span><span style="font-size: 1.2em;">values are the default settings.<br />* Do <span style="color: #FF0000; font-weight: bold; font-size: 1.3em;">not</span> include arguments not needed. Most videos will simply work best using only '''{{YouTube|id=#}}'''.</span>
[[Category:Widget templates]]
== Coding ==
</noinclude><includeonly>{{#ifeq:{{{align|no}}}|no||<div style="float: {{{align}}};">}}{{#widget:YouTube|id={{{id}}}|width={{#ifeq:{{{hd|0}}}|1|{{{width|1280}}}|{{#ifeq:{{{hd|0}}}|2|{{{width|1920}}}|{{#ifexpr:{{{width|640}}}<320|320|{{#ifexpr:{{{width|640}}}>800|800|{{{width|640}}}}}}}}}}}|height={{#ifeq:{{{hd|0}}}|1|{{{height|720}}}|{{#ifeq:{{{hd|0}}}|2|{{{height|1080}}}|{{#ifexpr:{{{height|480}}}<240|240|{{#ifexpr:{{{height|480}}}>600|600|{{{height|480}}}}}}}}}}}|autohide={{#ifexpr:{{{autohide|2}}}<0|&autohide{{=}}2|{{#ifeq:{{{autohide|2}}}|0|&autohide{{=}}0|{{#ifeq:{{{autohide|2}}}|1|&autohide{{=}}1|{{#ifeq:{{{autohide|2}}}|2|&autohide{{=}}2|{{#ifeq:{{{autohide|2}}}|3|&controls{{=}}0|&autohide{{=}}2}}}}}}}}}}|autoplay={{#ifeq:{{{autoplay|0}}}|1|1|0}}|rel={{#ifeq:{{{rel|0}}}|1|1|0}}|modestbranding={{#ifeq:{{{modestbranding|1}}}|0|0|1}}|annotation={{#ifeq:{{{annotation|1}}}|0|3|1}}|showinfo={{#ifeq:{{{showinfo|1}}}|0|0|1}}|loop={{#ifeq:{{{loop|0}}}|1|1|0}}|{{#ifeq:{{{id2|}}}|||playlist=&playlist{{=}}{{{id2}}}{{#ifeq:{{{id3|}}}|||,{{{id3}}}{{#ifeq:{{{id4|}}}|||,{{{id4}}}{{#ifeq:{{{id5|}}}|||,{{{id5}}}{{#ifeq:{{{id6|}}}|||,{{{id6}}}{{#ifeq:{{{id7|}}}|||,{{{id7}}}{{#ifeq:{{{id8|}}}|||,{{{id8}}}{{#ifeq:{{{id9|}}}|||,{{{id9}}}}}}}}}}}}}}}}}}}}}{{#ifeq:{{{align|no}}}|no||</div>}}[[Category:Pages with YouTube videos{{#ifeq:{{{hd|0}}}|1|/HD|}}]]</includeonly>
Feel free to use my template and widget code and adjust however you like to best suit your needs.
-- ShoeMaker (Contributions • Message) 11:25, May 10, 2012 (AST)