How To Customize YouTube Embed Player?
This article explains how to customize a YouTube embed player by
using YouTube defined parameters. Nowadays most of the web developers using
embed <iframe> tag for displaying videos, this improves your
web project playback experience. You can stop displaying related videos using
the rel parameter or removing the YouTube logo on player by using modestbranding
parameter, hope this will enrich your web project experience.
autoplay
Description:- This parameter specifies whether the initial video will
automatically start to play when the player loads.
Supported values are 0 or 1.
The default value is 0.
Supported values are 0 or 1.
The default value is 0.
<iframe src="https://www.youtube.com/embed/HIsKF943vTk?autoplay=1" frameborder="0" allowfullscreen width="570" height="315" > </iframe>
rel
Description:- This parameter indicates whether the player should show related videos when playback of the initial video ends.Supported values are 0 and 1.
The default value is 1.
<iframe src="https://www.youtube.com/embed/HIsKF943vTk?rel=0" frameborder="0" allowfullscreen width="570" height="315"> </iframe>
showinfo
Description:- Supported values are 0 and 1.
Setting the parameter's value to 0 causes the
player to not display information like the video title and uploader before the
video starts playing.
If the player is loading a playlist, and you explicitly set
the parameter value to 1, then, upon loading, the player will also display
thumbnail images for the videos in the playlist.
Note that this functionality
is only supported for the AS3 player.
<iframe src="https://www.youtube.com/embed/HIsKF943vTk?showinfo=0" frameborder="0" allowfullscreen width="570" height="315"> </iframe>
controls
Description:- This parameter indicates whether the video player controls
are displayed. For IFrame embeds that load a Flash player, it also defines when
the controls display in the player as well as when the player will load.
Supported values are!
controls=0 – Player controls do not display in the
player. For IFrame embeds, the Flash player loads immediately.
controls=1 (default) – Player controls display in the
player. For IFrame embeds, the controls display immediately and the Flash
player also loads immediately.
controls=2 – Player controls display in the player. For
IFrame embeds, the controls display and the Flash player loads after the user
initiates the video playback.
Note:- The parameter values 1 and 2 are
intended to provide an identical user experience, but controls=2 provides
a performance improvement over controls=1 for IFrame embeds.
Currently, the two values still produce some visual differences in the player,
such as the video title's font size. However, when the difference between the
two values becomes completely transparent to the user, the default parameter
value may change from 1 to 2.
<iframe src="https://www.youtube.com/embed/HIsKF943vTk?controls=0" frameborder="0" allowfullscreen width="570" height="315"> </iframe>
modestbranding
Description:- This parameter lets you use a YouTube player that does not
show a YouTube logo. Set the parameter value to 1 to prevent the
YouTube logo from displaying in the control bar.
Supported values are 0 and 1. While 0 is default value.
Note that a small YouTube text
label will still display in the upper-right corner of a paused video when the
user's mouse pointer hovers over the player.
<iframe src="https://www.youtube.com/embed/HIsKF943vTk?modestbranding=1" frameborder="0" allowfullscreen width="570" height="315"> </iframe>
color
Description:- This parameter specifies the color that will be used in the
player's video progress bar to highlight the amount of the video that the
viewer has already seen.
Valid parameter values are red and white,
and, by default, the player uses the color red in the video progress bar.
Note:- Setting the color parameter to white will disable the modestbranding option.
<iframe src="https://www.youtube.com/embed/HIsKF943vTk?color=white" frameborder="0" allowfullscreen width="570" height="315"> </iframe>
cc_load_policy
Description:- Setting the parameter's value to 1 causes closed
captions to be shown by default, even if the user has turned captions off. The
default behavior is based on user preference and the default value is 0.
<iframe src="https://www.youtube.com/embed/HIsKF943vTk?cc_load_policy=1" frameborder="0" allowfullscreen width="570" height="315"> </iframe>
disablekb
Description:- Setting the parameter's value to 1 causes the
player to respond to keyboard controls. The default value is 0, which
means that keyboard controls are disabled.
Supported keyboard controls are!
Spacebar:- Play / Pause
Arrow Left:- Jump back 10% in the current video
Arrow Right:- Jump ahead 10% in the current video
Arrow Up:- Volume up
Arrow Down:- Volume Down
<iframe src="https://www.youtube.com/embed/HIsKF943vTk?disablekb=1" frameborder="0" allowfullscreen width="570" height="315"> </iframe>
iv_load_policy
Description:- Setting the parameter's value to 1 causes video
annotations to be shown by default, whereas setting to 3 causes video
annotations to not be shown by default. The default value is 1.
<iframe src="https://www.youtube.com/embed/HIsKF943vTk?iv_load_policy=3" frameborder="0" allowfullscreen width="570" height="315"> </iframe>
end
Description:- This parameter specifies the time, measured in seconds from
the start of the video, when the player should stop playing the video. The
parameter value is a positive integer.
Note that the time is measured from the beginning of the
video and not from either the value of the start player parameter or
the startSeconds parameter, which is used in YouTube Player API functions
for loading or queueing a video.
<iframe src="https://www.youtube.com/embed/HIsKF943vTk?end=10" frameborder="0" allowfullscreen width="570" height="315"> </iframe>
fs
Description:- Setting this parameter to 0 prevents the
fullscreen button from displaying in the player. The default value is 1,
which causes the fullscreen button to display.
<iframe src="https://www.youtube.com/embed/HIsKF943vTk?fs=0" frameborder="0" allowfullscreen width="570" height="315"> </iframe>
loop
Description:- In the case of a single video player, a setting of 1causes
the player to play the initial video again and again. In the case of a playlist
player (or custom player), the player plays the entire playlist and then starts
again at the first video.
Supported values are 0 and 1, and the default
value is 0.
<iframe src="https://www.youtube.com/embed/HIsKF943vTk?loop=1" frameborder="0" allowfullscreen width="570" height="315"> </iframe>
Note:- This parameter has limited support in the AS3 player and in IFrame embeds, which could load either the AS3 or HTML5 player. Currently, the loop parameter only works in the AS3 player when used in conjunction with the playlist parameter. To loop a single video, set the loop parameter value to 1 and set the playlist parameter value to the same video ID already specified in the Player API URL!
https://www.youtube.com/v/VIDEO_ID?
version=3
&loop=1
&playlist=VIDEO_ID
version=3
&loop=1
&playlist=VIDEO_ID
start
Description:- This parameter causes the player to begin playing the video
at the given number of seconds from the start of the video. The parameter value
is a positive integer. Note that similar to the seekTo function, the
player will look for the closest keyframe to the time you specify. This means
that sometimes the play head may seek to just before the requested time,
usually no more than around two seconds.
<iframe src="https://www.youtube.com/embed/HIsKF943vTk?start=10" frameborder="0" allowfullscreen width="570" height="315"> </iframe>
Recommended Parameters
You can use multiple parameters in following way.
<iframe src="https://www.youtube.com/embed/HIsKF943vTk?rel=1&modestbranding=1&showinfo=0" frameborder="0" allowfullscreen width="570" height="315">
</iframe>
Some Other Parameters Are Listed Below
autohide
Description:- This parameter indicates whether the video controls will
automatically hide after a video begins playing. This parameter has been
deprecated for HTML5 players, which display or hide the video progress bar and
player controls automatically (autohide=1).
Supported values are!
2 (default) – If the player has a 16:9 or 4:3 aspect
ratio, the video progress bar and player controls display or hide
automatically. Otherwise, those controls are visible throughout the video.
1 – Regardless of the player's dimensions, the video
progress bar and player controls display or hide automatically.
0 – Regardless of the player's dimensions, the video
progress bar and player controls are visible throughout the video.
The interface language is used for tooltips in the player and also affects the default caption track.
enablejsapi
Description:- Setting the parameter's value to 1 enables the
player to be controlled via IFrame or JavaScript Player API calls.
The default value is 0, which means that the player cannot be controlled
using those APIs.
h1
Descriptions:- Sets the player's interface language. The parameter value is
an ISO 639-1 two-letter language code or a fully specified locale.
For example, fr and fr-ca are both valid values. Other
language input codes, such as IETF language tags (BCP 47) might also be handled
properly.
The interface language is used for tooltips in the player and also affects the default caption track.
Note that YouTube might select a different caption track
language for a particular user based on the user's individual language
preferences and the availability of caption tracks.
list
Description:- The list parameter, in conjunction with the listType parameter,
identifies the content that will load in the player.
1. If the listType parameter value issearch, then the list parameter
value specifies the search query.
2. If the listType parameter value isuser_uploads,
then the list parameter value identifies the YouTube channel whose
uploaded videos will be loaded.
3. If the listType parameter value is playlist, then
the list parameter value specifies a YouTube playlist ID. In the
parameter value, you need to prepend the playlist ID with the letters PL as
shown in the example below.
https://www.youtube.com/embed?
listType=playlist
&list=PLC77007E23FF423C6
listType=playlist
&list=PLC77007E23FF423C6
Note:- If you specify values for the list and listType parameters,
the IFrame embed URL does not need to specify a video ID.
listType
Description:- The listType parameter, in conjunction with the list parameter,
identifies the content that will load in the player. Valid parameter values areplaylist, search,
and user_uploads.
If you specify values for the list and listType parameters, the
IFrame embed URL does not need to specify a video ID.
origin
Description:- This parameter provides an extra security measure for the
IFrame API and is only supported for IFrame embeds.
If you are using the IFrame
API, which means you are setting the enablejsapi parameter value to 1,
you should always specify your domain as the origin parameter value.
playerapiid
Description:- This setting is used in conjunction with the JavaScript API.
The value can be any alphanumeric string.
playlist
Description:- This parameter specifies a comma-separated list of video IDs
to play. If you specify a value, the first video that plays will be the VIDEO_ID specified
in the URL path, and the videos specified in the playlist parameter will
play thereafter.
playsinline
Description:- This parameter controls whether videos play inline or
fullscreen in an HTML5 player on iOS.
Valid values are!
0 > This value causes fullscreen playback. This is currently
the default value, though the default is subject to change.
1 > This value causes inline playback for UIWebViews created
with the allowsInlineMediaPlayback property set to TRUE.
theme
Description:- This parameter indicates whether the embedded player will
display player controls (like a play button or volume control) within a dark or
light control bar. This parameter has been deprecated for HTML5 players, which
always use the dark theme.
Valid parameter values are dark and light, and, by default, the
player will display player controls using the dark theme.
Conclusion
These are the every possible parameters you can use with YouTube Player. Be sure to make possible changes for the required parameters as I have mentioned above in descriptions of each parameter. Be honest and wise and share this article to your friends and comment below.
Thanks for sharing tip to embed you tube player. I must say you have very deep knowledge on different technology. You might get something interesting here.
ReplyDelete