YouTube dropped #t start time support in direct URL and embed videos?
Asked Answered
P

9

38

Recently, one could use #t=2m0s or #t=120 to set start time for direct links:

http://www.youtube.com/watch?v=Fk2bUvrv-Uc#t=2m30s

as well as for embed videos:

<iframe width="420" height="315" \
src="http://www.youtube.com/embed/Fk2bUvrv-Uc#t=2m30s" \
frameborder="0" allowfullscreen></iframe>

Now it seems YouTube dropped #t start time support and the above doesn't work anymore. How can I now place reference to videos with particular start time?

Pact answered 29/6, 2013 at 10:33 Comment(1)
+1 but not only for "embed videos" but for any URL reference. Your question could be made more general to cover all these cases, will be more easily googlable and will help more people :)Binucleate
R
57

Embed videos

Looks like a different parameter is used now - start=<number of seconds> (see this blog and documentation).

Example:

<iframe width="420" height="315" frameborder="0" allowfullscreen
        src="http://www.youtube.com/embed/Nc9xq-TVyHI?start=110&end=119"></iframe>

Direct links

For direct links, it is enough to simply replace # for &:

http://www.youtube.com/watch?v=Fk2bUvrv-Uc&t=2m30s
Residue answered 29/6, 2013 at 13:16 Comment(3)
Thanks. Though it would be better to find a way to use combined parameter with both minutes and seconds e.g. t=2m0s instead of seconds-only parameter e.g. t=120.Pact
I know but that's not up to you and me but the developers team from youtube :-)Residue
This does not work from comments on the youtube itself.Needlefish
M
15

You can use &t= instead of #t=

Moiety answered 21/8, 2014 at 20:0 Comment(0)
P
3

YouTube dropped #t start time support for embed videos. Now we need ether directly use start=N&end=M parameters in seconds according to their new API, or write some extra code witch transforms our old #t=(n)m(n)s notation into new API-compatible style.

Pact answered 20/12, 2013 at 9:21 Comment(0)
R
3

I was able to get the video clip to work based on the start and end, but the exact code needs to be as follows:

?start=x&end=y

where x is the start time in seconds and y the end time in seconds

if the '?' isn't present it doesn't work. Also the code needs to be placed directly after the URL WITHOUT any space or it doesn't work.

Rasla answered 29/5, 2014 at 20:40 Comment(0)
D
1

I had a large number of videos chapterised using this method with a JQuery plugin. I've adapted the plugin so that you can continue using the (n)m(n)s notation. You could change this fairly easily to grab the #t value from the URL instead of the data attribute that I'm storing it in.

(function( $ ) {    
    $.fn.videoChapters = function(iframeID) {
        if(typeof window.orig_video === 'undefined') {
            window.orig_video = [];
        }
        window.orig_video[iframeID] = $('#'+iframeID).clone();

        var chapterContainer = this;
        $(this).find('a').on('click', function(e) {
                e.preventDefault();
                $('#'+iframeID).remove();
                $(chapterContainer).prevAll('.video-iframe').first().find('h3').after(window.orig_video[iframeID]);

                var video = $('#'+iframeID);
                if(typeof window.video_source === 'undefined') {
                    window.video_source = [];
                }

                if(typeof window.video_source[iframeID] === 'undefined') {
                    window.video_source[iframeID] = $(video).attr('src');
                }
                /*  to use it with a normal anchor change this to something like the below, of course it will vary for URL
                 *  so it'd be better to use a regex, but I'll let someone else worry about that.
                 *
                 *   var str = $(e.target).attr('href').split('#t')[1];
                 *   var nstr = $(str).split("s")[0];
                 *   var mstr = $(nstr).split("m");
                 *   var min = Number(mstr[0]);
                 *   var sec = Number(mstr[1]);
                 *   
                 * */

                var seconds = $(e.target).data('seconds');

                /* youtube dropped old min/secs format, now we convert what's there to pure seconds */
                var splsec = seconds.split('m');
                var min = Number(splsec[0]);
                var sec = Number(splsec[1].split('s')[0]);

                min = min * 60;

                var total = min + sec; 

                var newSource = window.video_source[iframeID] + "?start="+total+"&autoplay=1&rel=0";
                $(video).attr('src', newSource);
        });

    };  
})( jQuery );
Derisive answered 14/11, 2013 at 4:7 Comment(0)
H
0

The start and end time using iframe embed code doesn't work from my test. What works for me is this code:

From:

http://www.youtube.com/embed/[VIDEOID]

To:

http://www.youtube.com/v/[VIDEOID]&start=[SECONDS]&end=[SECONDS]

<object width="640" height="385">
<param name="movie" value="http://www.youtube.com/v/[VIDEOID]&start=100&end=500" />
<param name="allowscriptaccess" value="always" />
<embed src="http://www.youtube.com/v/[VIDEOID]&start=100&end=500" type="application/x-shockwave-flash" allowscriptaccess="always" width="640" height="385" />
</object>
Hickok answered 7/5, 2014 at 10:46 Comment(0)
F
0

It seems to work (again?) with the #t= , at least for direct URLs. The stated URL: https://www.youtube.com/watch?v=Fk2bUvrv-Uc#t=2m30s works, that is: it jumps to 2min 30sec. I tested this on FF, Chrome, IE11. But probably better to use &t= , & is the common URL argument concatenating character.

Foliolate answered 6/7, 2016 at 21:3 Comment(1)
Did you test it for embed videos in iframes? It doesn't work for me.Pact
F
0

Use

/watch?v=<videoID>&t=<s>

with

<videoID>=id of the video
<t>=number of seconds to skip

Examples :

https://m.youtube.com/watch?t=58&v=9W35QxCZnK4

Video starts at 58 seconds or

https://www.youtube.com/watch?t=120&v=9W35QxCZnK4

Video starts at 2 minutes

Fen answered 4/6, 2020 at 12:53 Comment(0)
U
0

As of 2023-July, at least that I've noticed, Goolag youtube is now REWRITING the URL, when it contains the &t= key-pair usage.

For example: https://www.youtube.com/watch?v=-zvszeudn98&t=1m2s

...gets converted, after resolving the video, to: https://www.youtube.com/watch?v=-zvszeudn98&t=62s

No idea why they are doing that, other than to throw off viewers who aren't as good at time conversion math.

Universalism answered 9/7, 2023 at 5:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.