javascript - Destroying the HTML video player? -
i want play video on embedded game of mine , when video ends, want disappear seamlessly go intro game (can't insert video game in engine i'm working in). how can this? currently, have this:
<html> <head> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <div class = "container"><span> <iframe src='...' /> <video autoplay> <source src="intro.mp4" type="video/mp4"> </video> </span></div> <script> var video = document.getelementsbytagname('video')[0]; video.onended = function(e) { # don't know put in here }; </script> </body></html>
one way can giving exact same size game's element , video.
then hide game inline css display: none;
when page starts, , once video ends can hide video , display game.
var game = document.getelementbyid("..."); var video = document.getelementbyid("..."); game.style.display = "none"; video.onended = function(e) { video.style.display = "none"; // or if want destroy permanently // video.parentnode.removechild(video); // video = null; game.style.display = ""; };
Comments
Post a Comment