What is the difference between canplay and canplaythrough?

Asked

Viewed 37 times

4

Both events canplay and canplaythrough are similar, but what is the main difference between using one and the other?

  • 1

    The canplaythrough is fired when it is not only possible to touch the media, but to touch until the end without stopping.

1 answer

5


The difference is subtle, canplay indicates that an object is available to start the presentation/display. The event canplaythrough is triggered when enough content of that object is already in memory for the browser to be sure that it is possible to display the rest of the content without interruptions.

So if the user starts the presentation before canplaythrough have triggered it is possible that there are pauses due to the browser not being able to load the content in time to view the instance that the browser shows/touches. Whereas after the canplaythrough be fired the browser already has "everything you need" to display the content without interruptions.

  • Which is the best one for me to use? for example, to inform the user that the video is ready to play.

  • @But it depends a lot. It depends on the type of content (whether it is the type of content you only see a few seconds, or whether it is ideal to play without interruption); it depends on the quality of the users' connection and what kind of transparency the app/interface should give the user; etc

Browser other questions tagged

You are not signed in. Login or sign up in order to post.