sees_all1 Posted December 6, 2010 Share Posted December 6, 2010 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 thoughtHave some respect for someone more forgetful than yourself ♪♪♪♪ And I'm not doneAnd I won't be till my head falls off ♪♪ Link to comment Share on other sites More sharing options...
sees_all1 Posted December 10, 2010 Author Share Posted December 10, 2010 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 thoughtHave some respect for someone more forgetful than yourself ♪♪♪♪ And I'm not doneAnd I won't be till my head falls off ♪♪ Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now