A Rad
A Rad

Reputation: 11

Set ytPlayer start and end time

I'am using YouTube JavaScript Player API.
I want to play a youtube video from and end it at a specific time. In other words The youtube videos is too long and I want to play A small section of the video programmatically.

I tried to use these two methods

    [self.inlinePlayer loadVideoById:videoId startSeconds:5.0 endSeconds:10.0 suggestedQuality:kYTPlaybackQualityAuto];

    [self.inlinePlayer cueVideoById startSeconds:5.0 endSeconds:10.0 suggestedQuality:kYTPlaybackQualityAuto];

This let the video start from the startSeconds but does not do any effect for the endSeconds. Is there is any way to do this programmatically?

Upvotes: 1

Views: 1514

Answers (2)

not_a_bot
not_a_bot

Reputation: 2362

The YouTube JavaScript Player API was deprecated back in January of this year, so it's likely that it won't work the way you expect it to. You should be using the IFrame API instead.

Upvotes: 0

Rastislav Struhár
Rastislav Struhár

Reputation: 125

look at https://developers.google.com/youtube/js_api_reference#Functions

loadVideoById({
    'videoId': 'bHQqvYy5KYo',
    'startSeconds': 5,
    'endSeconds': 60,
    'suggestedQuality': 'large'
});

Upvotes: 1

Related Questions