This post explains how to embed YouTube Player and the parameters are available in the YouTube Player. YouTube player can be embedded using <iframe> and <object> tags. You can customise the YouTube player by appending YouTube parameters to the iframe URL.
Before embedding the YouTube player note that the player viewport (width and height) must be greater than 200px x 200px. The recommended player size is at least 480px x 270px. This to fully display the controls without shrinking.
Before embedding the YouTube player note that the player viewport (width and height) must be greater than 200px x 200px. The recommended player size is at least 480px x 270px. This to fully display the controls without shrinking.
YouTube embeds using <object> tag has been deprecated in January 2015, because embeds using <iframe> can intelligently use whichever embedded player HTML (<video>) the client supports.
Embed a YouTube player:
Define the <iframe> tag with the src url pointing to the YouTube video or player, specify height and width of the <iframe> and append the YouTube player parameters to the url.
Ex: <iframe width="580" height="289" src="http://www.youtube.com/embed/IB1NoiN_SR0?modestbranding=1&autoplay=1" frameborder="0" allowfullscreen>
</iframe>
</iframe>
Youtube player parameters:
autohide | 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:
|
autoplay | 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. |
cc_load_policy | 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. |
color | 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. |
controls | 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:
|
disablekb | 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:
|
enablejsapi | 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 (The JavaScript Player API has already been deprecated.) |
end | 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: The time is measured from the beginning of the video and not from either the value of the start player parameter or the start seconds parameter, which is used in YouTube Player API functions for loading or queueing a video. |
fs | 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. |
hl | Sets the player's interface language. The parameter value is an ISO 639-1 two-letter language code or a fully specified locale. The interface language is used for tooltips in the player and also affects the default caption track. |
iv_load_policy | 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. |
list | The list parameter, in conjunction with the listType parameter, identifies the content that will load in the player.
|
listType | The listType parameter, in conjunction with the list parameter, identifies the content that will load in the player. Valid parameter values are playlist, 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. |
loop | In the case of a single video player, a setting of 1 causes 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. |
modestbranding | 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. NOTE: 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. |
origin | 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 | This setting is used in conjunction with the JavaScript API. The value can be any alphanumeric string. |
playlist | 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 | This parameter controls whether videos play inline or fullscreen in an HTML5 player on iOS. Valid values are:
|
rel | 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. |
showinfo | 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. |
start | 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: 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. |
theme | 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. |
Examples of the YouTube embed with different parameters:
Remove YouTube Logo & Branding from Embedded code
<iframe width="580" height="289"
src="http://www.youtube.com/embed/IB1NoiN_SR0?modestbranding=1" frameborder="0"
allowfullscreen> </iframe>
Disable Related Videos
<iframe width="580" height="289"
src="http://www.youtube.com/embed/IB1NoiN_SR0?modestbranding=1&rel=0" frameborder="0"
allowfullscreen> </iframe>
Autoplay and loop youtube video
<iframe width="580" height="289"
src="http://www.youtube.com/embed/IB1NoiN_SR0?autoplay=1&loop=1" frameborder="0"
allowfullscreen> </iframe>
Remove YouTube Player Controls and Title
<iframe width="580" height="289"
src="http://www.youtube.com/embed/IB1NoiN_SR0?modestbranding=1&rel=0&controls=0&showinfo=0"
frameborder="0" allowfullscreen> </iframe>
Remove YouTube annotations
<iframe width="580" height="289"
src="http://www.youtube.com/embed/IB1NoiN_SR0?modestbranding=1&iv_load_policy=3"
frameborder="0" allowfullscreen> </iframe>
"Great dreams of great dreamers are always transcended. "
- A. P. J. Abdul Kalam
Related Topics
- Make seo trick for title tag using javascript
- Facebook Style Drop Down Log out Menu
- Dynamically adding HTML form field using jQuery
- Jquery image on click effects
- Send email with html template using php
- Share your website link to social media website
- Export html table data to csv file using JavaScript
- Login with facebook using codeigniter
- Ajax add,view and delete using mysqli
- PHP age calculator script
I would like to show just the video and nothing else: no title, logo, related videos etc. However, it seems it's not possible to hide both the title and logo.
ReplyDelete