mirror of
https://github.com/mehotkhan/BandersnatchInteractive.git
synced 2025-07-27 17:23:22 +00:00
assets/scripts.js: Improve handling of pre-specified video src
Fixes behavior if HTML is edited to indicate the video source.
This commit is contained in:
parent
7e26ff3ddb
commit
2c987cd81e
1 changed files with 8 additions and 2 deletions
|
@ -309,18 +309,24 @@ window.onload = function() {
|
|||
var video_selector = document.getElementById("video");
|
||||
var video_source_selector = document.getElementById("video-source");
|
||||
var file_selector = document.getElementById("file-selector");
|
||||
function startPlayback() {
|
||||
file_selector.style.display = 'none';
|
||||
playSegment(null);
|
||||
video_selector.play();
|
||||
}
|
||||
if (video_source_selector.getAttribute("src") == '') {
|
||||
console.log('no video');
|
||||
file_selector.style.display = 'table';
|
||||
document.getElementById("wrapper-video").style.display = 'none';
|
||||
} else {
|
||||
startPlayback();
|
||||
}
|
||||
document.getElementById('fileinput').addEventListener('change', function () {
|
||||
var file = this.files[0];
|
||||
var fileUrl = URL.createObjectURL(file);
|
||||
video_selector.src = fileUrl;
|
||||
video_selector.play();
|
||||
file_selector.style.display = 'none';
|
||||
document.getElementById("wrapper-video").style.display = 'block';
|
||||
startPlayback();
|
||||
}, false);
|
||||
|
||||
video_selector.ontimeupdate = ontimeupdate;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue