Miro
Miro

Reputation: 135

Controlling video buffering via Youtube API

I'm using Android Youtube API and I was wondering if there is a way to control video buffering. I'm specifically interested in the possibility of pausing the buffering and resuming it later on with the idea to download video gradually by chunks.

Any kind of help or workarounds highly appreciated.

Upvotes: 2

Views: 3015

Answers (3)

Miro
Miro

Reputation: 135

For all it's worth, I didn't find a way to achieve this using YouTube API and I don't think there is one (correct me if I'm wrong).

I ended up abandoning YouTube API completely and solving the problem in an adhoc way - the app determines the actual location of the video file and downloads it progressively to a temporary file using standard means, which gives it full control over the connection. The data is read and fed to the media player simultaneously as it's being downloaded, performing second-level local buffering.

Upvotes: 1

Azmisov
Azmisov

Reputation: 7243

The YouTube API has a method stopVideo() that you may be able to use. Unlike the pause() method, it will stop downloading the video. I'm not sure if you can resume the video afterwards, but at least it stops buffering.

Upvotes: 1

user2030471
user2030471

Reputation:

You can look at the following methods available with a YouTubePlayer.

pause()

play()

seekToMillis (int milliSeconds)

seekRelativeMillis (int milliSeconds)

Upvotes: 1

Related Questions