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
1import { Player } from "video-react";2import "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.
1<Player onEnded={() => console.log("video End") } >2 ...3</Player>
Thanks for reading…
Follow me on Twitter
Join our email list and get notified about new content
No worries, I respect your privacy and I will never abuse your email.
Every week, on Tuesday, you will receive a list of free tutorials I made during the week (I write one every day) and news on other training products I create.