Hello Friends,

Welcome To Infinitbility!

This article will help you to know when user view full video using video-react package.

Many times we want to know user watch full video or not then video-react package provide onEnded call back function.

Note: this article only for those developer who are using video-react library.

Let’s start today’s article How to detect video completed in video react

Video React also provide subscribeToStateChange but it’s now work for me and this article alternative solution for this.

Video React package provide Player component to show video player and also provide onEnded on player to detect video end or not.

Let’s understand with example…

  • Import your required packages
import { Player } from "video-react";
import "video-react/dist/video-react.css";
  • Video React onEnded Example

You have to just onEnded props on Player component and it will invoke when video end.

<Player onEnded={() => console.log("video End") } >

Thanks for reading…