Jump to content

Need Help with Javascript in HTML5


sees_all1

Recommended Posts

Writing a HTML5 / Javascript application, where I need to change the source of a VIDEO element. Is there a way to change both the video's source and alternate in Javascript?

 

Darn Mozilla for not supporting MP4... <_<

99 dungeoneering achieved, thanks to everyone that celebrated with me!

 

♪♪ Don't interrupt me as I struggle to complete this thought
Have some respect for someone more forgetful than yourself ♪♪

♪♪ And I'm not done
And I won't be till my head falls off ♪♪

Link to comment
Share on other sites

I ended up using this code.

 

var myVideo = document.createElement('video');
myVideo.id='vid1';

var source = document.createElement('source');
source.type = 'video/mp4';
source.src = 'someRandomVideo.mp4';
myVideo.appendChild(source);

source = document.createElement('source');
source.type = 'video/ogg';
source.src = 'sameRandomVideo.ogg';
myVideo.appendChild(source);

99 dungeoneering achieved, thanks to everyone that celebrated with me!

 

♪♪ Don't interrupt me as I struggle to complete this thought
Have some respect for someone more forgetful than yourself ♪♪

♪♪ And I'm not done
And I won't be till my head falls off ♪♪

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.