tags:

views:

677

answers:

3

Hi!

I'm using the tags in HTML5 to play a video on a web browser... (and I'm very impressed with this new feature)

Is there the functionality to change the video being played through Javascript? Say when I select another video from a list, a Javascript function would be called which would contain something on the lines of MyVideo.VideoLocation = //location of new video to be played. Is this possible please?

Thanks and regards, Krt_Malta

A: 

The property to be used:

videoTag.src

If it doesn't auto-start playing after that:

videoTag.play()
Delan Azabani
+1  A: 

Webkit requires that you call "load()" after changing the source:

videoTag.src = "newVideo";
videoTag.load();
videoTag.play();

Apple has a useful tutorial.

Phil Crosby
A: 

The tutorial by Apple worked great for me, but I can only get it to play two videos in a row, how would one get it to play, for instance, four videos sequentially? Also, I am a javascript noob, please show all of the code from <'html> to <'/html> (!), whenever a small piece of code is shown I never know where to put it. Thanks much!

-Amber

amber