Copy link to clipboard
Copied
So I've run into some trouble in a larger project so I decided to troubleshoot but creating a smaller project and am still running into issues. Here's the situation. I want to have two buttons (button01 and button02) and one video object (generic_video). Click one button, and the source of the video changes to let's say a local video, somevideo.mp4. Click button02 and the video source changes to someothervideo.mp4. I have the buttons set up and named and a singular video component. My code would look like:
Hi.
This works for me:
function changeVideoSource()
{
document.getElementById("yourVideo").src="video.mp4";
}
this.yourButton.on("click", changeVideoSource);
Make sure you have permisssions to load the video from the folder where it is.
I would just place the video in the same folder as the index.html and use a simple relative path.
Regards,
JC
Copy link to clipboard
Copied
the first error i see is duplicate function names.
then all the "added" code should be removed. it's too late for that.
Copy link to clipboard
Copied
I've tried with just one button and one video component to see if I could set the button up so that the video starts with no source, then gets a source via the button.
Copy link to clipboard
Copied
and?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
what code are you using?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
again, it's too late for the added code.
Copy link to clipboard
Copied
I guess I just don't understand it being late.
Copy link to clipboard
Copied
it's added long before you click. ie, remove the added listener
Copy link to clipboard
Copied
Copy link to clipboard
Copied
I'm losing my mind. I have a simple button and a video component. The only code I have is the below and when I test it nothing happens.
this.Button01.addEventListener("click", fl_MouseClickHandler1.bind(this));
function fl_MouseClickHandlerf()
{
var videoURL = "C:\Users\mnarl\Desktop\interactive\videos\HABs_eng.mp4";
$("#generic_video")[0].src=videoURL;
}
Copy link to clipboard
Copied
your listener function doesn't match your function name.
Copy link to clipboard
Copied
D'oh! I changed it to match and still nothing...
this.Button01.addEventListener("click", fl_MouseClickHandler.bind(this));
function fl_MouseClickHandler()
{
var videoURL = "C:\Users\mnarl\Desktop\interactive\videos\HABs_eng.mp4";
$("#generic_video")[0].src=videoURL;
}
Copy link to clipboard
Copied
then you videi path/name is incorrect. open the developer console to confirm.
Copy link to clipboard
Copied
Path is correct. In the dev console src is blank.
Copy link to clipboard
Copied
what's the developer console show?
copy and paste here a screenshot.
Copy link to clipboard
Copied
Hi.
This works for me:
function changeVideoSource()
{
document.getElementById("yourVideo").src="video.mp4";
}
this.yourButton.on("click", changeVideoSource);
Make sure you have permisssions to load the video from the folder where it is.
I would just place the video in the same folder as the index.html and use a simple relative path.
Regards,
JC