Click here to Skip to main content
15,125,299 members
Articles / Web Development
Tip/Trick
Posted 2 Feb 2011

Stats

90.2K views
26 bookmarked

YouTube® playback customization options

Rate me:
Please Sign up or sign in to vote.
4.75/5 (21 votes)
14 Feb 2015CPOL1 min read
Customize YouTube® video playback by adding web query parameters

Following examples demonstrate YouTube playback customization technique by adding web query parameters to the video URL (i.e. the links to YouTube video items).

Setting the video playback starting point

Setting the video playback starting point by specifying the offset-time in minutes and seconds from the beginning of video clip (in this example, it is set to 1min:10 sec, which will force the player to start the sample car video at "German Cars" fragment):
 
http://www.youtube.com/watch?v=NGRgHj9hsqw&t=1m10s[^],
 
where parameter "NGRgHj9hsqw" represents the actual video item ID in YouTube classification system; this is the mandatory part of YouTube URL string. Parameter &t=1m10s specifies the video playback starting point. Alternatively, it could be coded in the following format: #t=1m10s

Shortening video URL

Entire URL with added web query could be shortened by using, for example, Bit.ly service and look like: http://bit.ly/CarGer[^]); all customization options will be preserved in the short URL.

Full Screen Mode

Playback in a Full Screen mode: http://www.youtube.com/v/NGRgHj9hsqw[^], where NGRgHj9hsqw represents the video id.

Autoplay

Playback Autoplay option in a full-screen mode is set to "OFF" by default. In order to turn it "ON", add the parameter "&autoplay=1" to the end of the URL web query.

Loop

Playback Loop (number of video re-plays) could be specified by adding the following parameter: “&loop=2” to the end of the query to play the video twice or “&loop=3” to replay it three times and so on.

Related Videos option On/Off

Turn “OFF” the "Related Video" option to filter-off "extras" from the video port by adding “&rel=0” to the end of the web query.

 

Embedded YouTube Player (click on image to open DEMO)

Sample screen shot of embedded YouTube Player

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

DrABELL
Software Developer (Senior)
United States United States
Dr. Alexander Bell is a seasoned full-stack Software Engineer (Win/Web/Mobile). He holds PhD in Electrical and Computer Engineering, authored 37 inventions and published 300+ technical articles. Currently focused on multiple Android/Mobile development projects and Big Data' Machine Learning, AI, IoT. Alex participated in App Innovation Contests (AIC 2102/2013) with multiple winning submissions. Sample portfolio apps and publications:

  1. Publications by A. Bell
  2. Educational Web Portal
  3. Engineering Calculator VOLTA
  4. Aggregate Product function extends SQL
  5. Use SQL to generate large data sequence
  6. HTML5/CSS3 graphic enhancement: buttons, inputs
  7. Advanced CSS3 Styling of HTML5 SELECT Element
  8. enRoute: Real-time NY City Bus Tracking Web App
  9. YouTube™ API for ASP.NET
  10. HTML5 Tables Formatting: Alternate Rows, Color Gradients, Shadows

Comments and Discussions

 
GeneralRe: To the member "brutuscat"- 1. I am giving you a second warni... Pin
DrABELL29-Mar-11 9:29
professionalDrABELL29-Mar-11 9:29 
GeneralRe: To the member "brutuscat"- 1. You are wrong on your assumpti... Pin
DrABELL29-Mar-11 6:20
professionalDrABELL29-Mar-11 6:20 
GeneralRe: The reason and the point are that you are not adding any val... Pin
brutuscat29-Mar-11 4:39
Memberbrutuscat29-Mar-11 4:39 
GeneralReason for my Vote of 5 Very good share and nice highlightin... Pin
RaviRanjanKr3-Nov-11 23:17
professionalRaviRanjanKr3-Nov-11 23:17 
GeneralReason for my vote of 5 This probably exists in some documen... Pin
JH6420-Jun-11 14:40
MemberJH6420-Jun-11 14:40 
GeneralRe: Thanks a bunch! Pin
DrABELL20-Jun-11 16:00
professionalDrABELL20-Jun-11 16:00 
GeneralReason for my vote of 5 Good tip! Very good share, I never k... Pin
Ed Nutting6-Jun-11 0:30
MemberEd Nutting6-Jun-11 0:30 
GeneralRe: Thanks a bunch, Ed! I am totally agree with you. And, btw, a... Pin
DrABELL6-Jun-11 6:23
professionalDrABELL6-Jun-11 6:23 
GeneralReason for my vote of 1 There is a thing called Documentatio... Pin
brutuscat29-Mar-11 0:50
Memberbrutuscat29-Mar-11 0:50 
GeneralRe: What is the point of your message and the reason for such un... Pin
DrABELL29-Mar-11 4:25
professionalDrABELL29-Mar-11 4:25 
Generalnice ,my 5+ Pin
Monjurul Habib5-Mar-11 8:27
professionalMonjurul Habib5-Mar-11 8:27 
GeneralRe: Thanks a lot! Pin
DrABELL8-Mar-11 18:18
professionalDrABELL8-Mar-11 18:18 
GeneralReason for my vote of 5 nice,my5 Pin
Monjurul Habib5-Mar-11 8:26
professionalMonjurul Habib5-Mar-11 8:26 
GeneralReason for my vote of 5 Good one dude Pin
thatraja5-Mar-11 4:01
professionalthatraja5-Mar-11 4:01 
GeneralRe: Many thanks! :) Pin
DrABELL5-Mar-11 5:13
professionalDrABELL5-Mar-11 5:13 
GeneralThanks! Pin
DrABELL21-Feb-11 18:01
professionalDrABELL21-Feb-11 18:01 
GeneralThis is awesome! Pin
Edin Kalabić21-Feb-11 12:41
MemberEdin Kalabić21-Feb-11 12:41 
General<i>More on this topic, covering the embedded YouTube player:... Pin
DrABELL3-Feb-11 7:23
professionalDrABELL3-Feb-11 7:23 
GeneralReason for my vote of 5 you really hacked it! By the way nic... Pin
GPUToaster™2-Feb-11 19:30
MemberGPUToaster™2-Feb-11 19:30 
Reason for my vote of 5
you really hacked it! By the way nice tip.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.