Video component with Play & Pause button

I have created a video component that initially show play button in middle and upon clicking on it the pause button appears which slides to the bottom corner of the video while playing the video simultaneously.

When the video completes it goes to the initial state of the icon which is play button… For this I’ve set the delay as per the length of the video

But the problem I’m currently facing is that, if the user pause the video in between and then play it the delay timer does not work properly.

For better understanding, please play the slide in the give link

Please let me know if there’s any solution for this type of problem.

Thanks in advance!