December 6, 201015 yr 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 ♪♪
December 10, 201015 yr Author 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 ♪♪
Create an account or sign in to comment