Playing with HTML 5: The Video Tag

I was playing with HTML5 again. Today, I was trying to use the new tag <video> to embed the intro video of the game Planetarian. I tried a few times using JS to detect the end of the video but only realized the correct way of doing it is as follows.

var video = document.getElementsByTagName(‘video’)[0];
video.addEventListener(“ended”, function() { //Do stuff here after end of video }, false);

According to online resources, this code should work in Chrome, Firefox as well as IE9! =D

Unfortunately, I just uninstalled IE9, so I haven’t tested it on IE9. =P

Intro Video of My Online Planetarian

Intro Video in My Online Planetarian


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s