Template:VideoGallery/doc: Difference between revisions

From Dolphin Emulator Wiki
Jump to navigation Jump to search
mNo edit summary
 
(25 intermediate revisions by 3 users not shown)
Line 1: Line 1:
This template uses the [[Template:EmbedVideo|embed video]] plugin to randomly select 3 videos from a predefined list and show them as thumbnails. The rest of the videos are returned as plain text links (through the call of a variable).
This template uses the [[Template:EmbedVideo|embed video]] plugin to create a video gallery. If the page have more than 3 videos, this template will automatically randomly select 3 videos to show as thumbnails and the rest of the videos will be returned as plain text links.


==Usage==
== Usage ==
The video gallery template should be called in the following way:
The video gallery template should be called in the following way:
*<code><nowiki>{{VideoGallery|<number of videos></nowiki><br>
<pre>{{VideoGallery
:<nowiki>|vid1=<video ID>|cap1=<title>|srv1=<service></nowiki><br>
|vid1=<video ID>|cap1=<title>
:<nowiki>|vid2=<video ID>|cap2=<title>|srv2=<service></nowiki><br>
|vid2=<video ID>|cap2=<title>
:<nowiki>|vid3=<video ID>|cap3=<title>|srv3=<service></nowiki><br>
|vid3=<video ID>|cap3=<title>
:<nowiki>...</nowiki><br>
 
:<nowiki>|vidN=<video ID>|capN=<title>|srvN=<service></nowiki><br>
[...]
:}}</code>
 
|vidN=<video ID>|capN=<title>
}}</pre>
where
where
*<code>Number of videos</code> should be the number of video entries. N also should be always equal to this parameter.
*<code>Video ID</code> is the ID of the video that you are embedding (like the bold part in this URL: <nowiki>http://www.youtube.com/watch?v=</nowiki>'''VqNcksMfAjM''').
*<code>Video ID</code> is the ID of the video that you are embedding (like the bold part in this URL: <nowiki>http://www.youtube.com/watch?v=</nowiki>'''VqNcksMfAjM''').
*<code>Title</code> (optional) is the caption for the video. If no caption is entered or if the parameter is omitted, the template will return the video URL as title.
*<code>Title</code> (optional) is the caption for the video. If no caption is entered or if the parameter is omitted, the template will return the video URL as title.
*<code>Service</code> (optional) can be used to override the host site for that video, the default is YouTube.


==Examples==
== Examples ==
*We have 12 videos and their corresponding IDs and title. So, <code>&lt;Number of videos&gt;</code> should be 12. Then, every video ID and the corresponding title goes in one line:
=== Basic usage ===
<code><nowiki>{{VideoGallery|12</nowiki><br>
*We have 2 videos and their corresponding IDs and title. So, every video ID and their corresponding title goes in one line:
<nowiki>|vid1=sam9lDWDvXE|cap1=Xenoblade JP HD Gameplay 1A (Dolphin Emulator @ 720p)</nowiki><br>
<pre>{{VideoGallery
<nowiki>|vid2=vKjjS8SRG9I|cap2=Xenoblade JP HD Gameplay 1B (Dolphin Emulator @ 720p)</nowiki><br>
|vid1=sam9lDWDvXE|cap1=Xenoblade JP HD Gameplay 1A (Dolphin Emulator @ 720p)
<nowiki>|vid3=f_0IbQrezTo|cap3=Xenoblade JP HD Gameplay 2 (Dolphin Emulator @ 720p)</nowiki><br>
|vid2=vKjjS8SRG9I|cap2=Xenoblade JP HD Gameplay 1B (Dolphin Emulator @ 720p)
<nowiki>|vid4=_an7OMeK2nA|cap4=Xenoblade JP HD Gameplay 3 (Dolphin Emulator @ 720p)</nowiki><br>
}}</pre>
<nowiki>|vid5=wjzv0KtDXOA|cap5=Xenoblade JP HD Gameplay 4 (Dolphin Emulator @ 720p)</nowiki><br>
 
<nowiki>|vid6=tJtCp8rPXWg|cap6=Xenoblade PAL HD Intro  (Dolphin Emulator @ 1080p)</nowiki><br>
:The above example produces this:
<nowiki>|vid7=_VLNa9PKT0Y|cap7=Xenoblade PAL HD Gameplay 1 (Dolphin Emulator @ 720p)</nowiki><br>
{{VideoGallery
<nowiki>|vid8=dp3QnvFn_Hc|cap8=Xenoblade PAL HD Gameplay 2 (Dolphin Emulator @ 720p)</nowiki><br>
|vid1=sam9lDWDvXE|cap1=Xenoblade JP HD Gameplay 1A (Dolphin Emulator @ 720p)
<nowiki>|vid9=EzSDE3NOq_Y|cap9=Xenoblade PAL HD Gameplay 1 - Near start of game (Dolphin Emulator @ 720p)</nowiki><br>
|vid2=vKjjS8SRG9I|cap2=Xenoblade JP HD Gameplay 1B (Dolphin Emulator @ 720p)
<nowiki>|vid10=oGcSdu3t8CQ|cap10=Xenoblade PAL HD Gameplay 2 - Continuation of Gameplay 1 (Dolphin Emulator @ 720p)</nowiki><br>
}}<div style="clear:left;"></div>
<nowiki>|vid11=5Ywd5T5y91E|cap11=Xenoblade PAL HD - A protective mother (Dolphin Emulator @ 720p)</nowiki><br>
<nowiki>|vid12=3Fvdc_LuWB4|cap12=Xenoblade Intro HD 1080p (Dolphin)</nowiki><br>
<nowiki>}}</nowiki></code>


The above example produces this:
=== Behavior with multiple videos ===
{{VideoGallery|12
*This time, we have 12 videos, so, the template will show only 3 random thumbnails and the other videos will be displayed as plain text links. Just add every video ID and their corresponding title in a separate line, like before:
<pre>{{VideoGallery
|vid1=sam9lDWDvXE|cap1=Xenoblade JP HD Gameplay 1A (Dolphin Emulator @ 720p)
|vid1=sam9lDWDvXE|cap1=Xenoblade JP HD Gameplay 1A (Dolphin Emulator @ 720p)
|vid2=vKjjS8SRG9I|cap2=Xenoblade JP HD Gameplay 1B (Dolphin Emulator @ 720p)
|vid2=vKjjS8SRG9I|cap2=Xenoblade JP HD Gameplay 1B (Dolphin Emulator @ 720p)
Line 47: Line 45:
|vid11=5Ywd5T5y91E|cap11=Xenoblade PAL HD - A protective mother (Dolphin Emulator @ 720p)
|vid11=5Ywd5T5y91E|cap11=Xenoblade PAL HD - A protective mother (Dolphin Emulator @ 720p)
|vid12=3Fvdc_LuWB4|cap12=Xenoblade Intro HD 1080p (Dolphin)
|vid12=3Fvdc_LuWB4|cap12=Xenoblade Intro HD 1080p (Dolphin)
}}<div style="clear:left"></div>
}}</pre>
Please note that the remaining videos that haven't been chosen aren't here. Part of the functionality of this script is adding a list with links to the other videos that are available, and this list can be "embedded" in any part of the page by using the command <code><nowiki>{{#var:videolinks}}</nowiki></code>. In the place that you call the videolinks variable you get this:
 
{{#var:videolinks}}
:The above example produces this:
{{VideoGallery
|vid1=sam9lDWDvXE|cap1=Xenoblade JP HD Gameplay 1A (Dolphin Emulator @ 720p)
|vid2=vKjjS8SRG9I|cap2=Xenoblade JP HD Gameplay 1B (Dolphin Emulator @ 720p)
|vid3=f_0IbQrezTo|cap3=Xenoblade JP HD Gameplay 2 (Dolphin Emulator @ 720p)
|vid4=_an7OMeK2nA|cap4=Xenoblade JP HD Gameplay 3 (Dolphin Emulator @ 720p)
|vid5=wjzv0KtDXOA|cap5=Xenoblade JP HD Gameplay 4 (Dolphin Emulator @ 720p)
|vid6=tJtCp8rPXWg|cap6=Xenoblade PAL HD Intro  (Dolphin Emulator @ 1080p)
|vid7=_VLNa9PKT0Y|cap7=Xenoblade PAL HD Gameplay 1 (Dolphin Emulator @ 720p)
|vid8=dp3QnvFn_Hc|cap8=Xenoblade PAL HD Gameplay 2 (Dolphin Emulator @ 720p)
|vid9=EzSDE3NOq_Y|cap9=Xenoblade PAL HD Gameplay 1 - Near start of game (Dolphin Emulator @ 720p)
|vid10=oGcSdu3t8CQ|cap10=Xenoblade PAL HD Gameplay 2 - Continuation of Gameplay 1 (Dolphin Emulator @ 720p)
|vid11=5Ywd5T5y91E|cap11=Xenoblade PAL HD - A protective mother (Dolphin Emulator @ 720p)
|vid12=3Fvdc_LuWB4|cap12=Xenoblade Intro HD 1080p (Dolphin)
}}
 
 
 
 
=== Videos from different services ===
* This time, we have 2 videos from different services. The default is YouTube, for other services we need to add an additional <code>|srvN=</code> parameter (see [[Template:VideoGallery#Notes|notes]] for more details). Then, add every video ID, their corresponding title (and server) in a separate line, like before:
<pre>{{VideoGallery
|vid1=sam9lDWDvXE|cap1=Xenoblade JP HD Gameplay 1A (Dolphin Emulator @ 720p)
|srv2=dailymotion|vid2=x1ji36n_gremlins-gizmo-videogame-hd-on-dolphin-emulator_videogames|Gremlins game
}}</pre>
 
: The above example produces this:
{{VideoGallery
|vid1=sam9lDWDvXE|cap1=Xenoblade JP HD Gameplay 1A (Dolphin Emulator @ 720p)
|srv2=dailymotion|vid2=x1ji36n_gremlins-gizmo-videogame-hd-on-dolphin-emulator_videogames|cap2=Gremlins game
}}


==Notes==
== Notes ==
* This template should be used ONLY if the page that you pretend including this have more than 3 video links. Calling this template with less than 3 videos are prone to cause a lot of parser errors in the page that included this template
* If the template was called with more than 3 videos, every time that you access or refresh the page, you'll randomly get another 3 video thumbnails.
* At moment YouTube is the only service supported, so the entry <code>|srvN=</code> should ALWAYS be omitted, and the template will automatically fall back to YouTube. Trying to use other services that hadn't been implemented yet will just return you a red link to a template that doesn't exist.
* The maximum number of videos that can be included with this template is limited to 50 (3 thumbnails + 47 links), if you include more than 50 videos, the template will ignore the additional videos and you'll probably get loop errors in the page.
* Every time that you access or refresh the page, you'll randomly get another 3 video thumbnails.
* By default, this template accepts only videos from YouTube, however, you can include a <code>|srvN=</code> tag before <code>|vidN=</code> entry to link videos from another service (videos from multiple services can be included in the same gallery). Specifying a service that aren't supported will just return a red link. The supported services and the corresponding parameter that should be used in <code>|srvN=</code> are listed at [[Template:EmbedVideo#Supported_Services|EmbedVideo: Supported Services]].
*If you want to add more content after calling the template, you should use a <code>&lt;div style="clear:left"&gt;&lt;/div&gt;</code> right after embedding this template to avoid any issue you could get with floating elements.

Latest revision as of 07:56, 3 July 2019

This template uses the embed video plugin to create a video gallery. If the page have more than 3 videos, this template will automatically randomly select 3 videos to show as thumbnails and the rest of the videos will be returned as plain text links.

Usage

The video gallery template should be called in the following way:

{{VideoGallery
|vid1=<video ID>|cap1=<title>
|vid2=<video ID>|cap2=<title>
|vid3=<video ID>|cap3=<title>

[...]

|vidN=<video ID>|capN=<title>
}}

where

  • Video ID is the ID of the video that you are embedding (like the bold part in this URL: http://www.youtube.com/watch?v=VqNcksMfAjM).
  • Title (optional) is the caption for the video. If no caption is entered or if the parameter is omitted, the template will return the video URL as title.

Examples

Basic usage

  • We have 2 videos and their corresponding IDs and title. So, every video ID and their corresponding title goes in one line:
{{VideoGallery
|vid1=sam9lDWDvXE|cap1=Xenoblade JP HD Gameplay 1A (Dolphin Emulator @ 720p)
|vid2=vKjjS8SRG9I|cap2=Xenoblade JP HD Gameplay 1B (Dolphin Emulator @ 720p)
}}
The above example produces this:


Behavior with multiple videos

  • This time, we have 12 videos, so, the template will show only 3 random thumbnails and the other videos will be displayed as plain text links. Just add every video ID and their corresponding title in a separate line, like before:
{{VideoGallery
|vid1=sam9lDWDvXE|cap1=Xenoblade JP HD Gameplay 1A (Dolphin Emulator @ 720p)
|vid2=vKjjS8SRG9I|cap2=Xenoblade JP HD Gameplay 1B (Dolphin Emulator @ 720p)
|vid3=f_0IbQrezTo|cap3=Xenoblade JP HD Gameplay 2 (Dolphin Emulator @ 720p)
|vid4=_an7OMeK2nA|cap4=Xenoblade JP HD Gameplay 3 (Dolphin Emulator @ 720p)
|vid5=wjzv0KtDXOA|cap5=Xenoblade JP HD Gameplay 4 (Dolphin Emulator @ 720p)
|vid6=tJtCp8rPXWg|cap6=Xenoblade PAL HD Intro  (Dolphin Emulator @ 1080p)
|vid7=_VLNa9PKT0Y|cap7=Xenoblade PAL HD Gameplay 1 (Dolphin Emulator @ 720p)
|vid8=dp3QnvFn_Hc|cap8=Xenoblade PAL HD Gameplay 2 (Dolphin Emulator @ 720p)
|vid9=EzSDE3NOq_Y|cap9=Xenoblade PAL HD Gameplay 1 - Near start of game (Dolphin Emulator @ 720p)
|vid10=oGcSdu3t8CQ|cap10=Xenoblade PAL HD Gameplay 2 - Continuation of Gameplay 1 (Dolphin Emulator @ 720p)
|vid11=5Ywd5T5y91E|cap11=Xenoblade PAL HD - A protective mother (Dolphin Emulator @ 720p)
|vid12=3Fvdc_LuWB4|cap12=Xenoblade Intro HD 1080p (Dolphin)
}}
The above example produces this:



Videos from different services

  • This time, we have 2 videos from different services. The default is YouTube, for other services we need to add an additional |srvN= parameter (see notes for more details). Then, add every video ID, their corresponding title (and server) in a separate line, like before:
{{VideoGallery
|vid1=sam9lDWDvXE|cap1=Xenoblade JP HD Gameplay 1A (Dolphin Emulator @ 720p)
|srv2=dailymotion|vid2=x1ji36n_gremlins-gizmo-videogame-hd-on-dolphin-emulator_videogames|Gremlins game
}}
The above example produces this:


Notes

  • If the template was called with more than 3 videos, every time that you access or refresh the page, you'll randomly get another 3 video thumbnails.
  • The maximum number of videos that can be included with this template is limited to 50 (3 thumbnails + 47 links), if you include more than 50 videos, the template will ignore the additional videos and you'll probably get loop errors in the page.
  • By default, this template accepts only videos from YouTube, however, you can include a |srvN= tag before |vidN= entry to link videos from another service (videos from multiple services can be included in the same gallery). Specifying a service that aren't supported will just return a red link. The supported services and the corresponding parameter that should be used in |srvN= are listed at EmbedVideo: Supported Services.