How to detect when video finish on Webview tag load url "youtube"


#1

Hello for all
I am creating app using webview tag to load URL “youtube”.
how to detect when video finish?
i want: when the video finish => reload webview
please help me ,how to do it.
thank you!

example webview:

< webview id =“wv1” src=“https://www.youtube.com/watch?v=X1QS3Z421xo” >

video has id=‘movie_player’


#2

i found in the webview have Event: ‘media-paused’ to solve this issue for one video.

var webview = document.querySelector(’#wv1’);
webview.addEventListener(“media-paused”, function(){
webview.reload();
});

but in case have a list videos. i want : when the list video play finish => reload webview.
how to do it. please help me.
thank you!
example webview:

< webview id =“wv1” src=“https://www.youtube.com/watch?v=X1QS3Z421xo&list=UUPKdY0xt4Urm7yPFUE8af0g” >