Skip to content

Network events

Pierfrancesco Soffritti edited this page Jun 30, 2018 · 7 revisions

The documentation has been moved in the readme of the project. This wiki is outdated.


This library is capable of handling network events, using an internal BroadcastReceiver. You can choose to use it or not when you are initializing the player.

Call YouTubePlayerView.initialize(..., true) to let the library register its BroadcastReceiver or call YouTubePlayerView.initialize(..., false) if you prefer to use your own.

Using the internal BroadcastReceiver is the easiest and recommended way to handle network events. The library is capable of handling cases in which the connection goes off and the playback can't continue, or cases in which the connection goes off while the player is in the process of initialization.

For example, if the player is playing but it has to stop because the connection is off, once the connection is back the player automatically resumes the playback from where it left off. Otherwise if the player was paused, when the connection is back it just stays paused while resuming the buffering of the video.

If you want to use your own BroadcastReceiver make sure to cover all this scenarios, in order to provide a consistent user experience.