0xced / XCDYouTubeKit

YouTube video player for iOS, tvOS and macOS
MIT License
2.92k stars 627 forks source link

Start Playing the video from specific time(like from 50th second). #327

Closed akash-mastercreationz closed 7 years ago

akash-mastercreationz commented 7 years ago

Can we play the viodeo from specific time .(like if the last played video was stoped at 40th second and when the user plays the same video after some time, it will start from 40th second)

SoneeJohn commented 7 years ago

@akash-mastercreationz if you're using AVPlayer then you can use the -seekToTime: method

0xced commented 7 years ago

You can try this:

XCDYouTubeVideoPlayerViewController *videoPlayerViewController = [[XCDYouTubeVideoPlayerViewController alloc] initWithVideoIdentifier:videoIdentifier];
videoPlayerViewController.moviePlayer.initialPlaybackTime = 40;

If it doesn’t work, try setting the initialPlaybackTime when receiving XCDYouTubeVideoPlayerViewControllerDidReceiveVideoNotification.