I thought this would be easier, but clearly I haven't touched JavaScript/HTML in a long time. I am closer with the following code to getting this to work, yet it seems like webpage still throws an error:
GET https://newapo.apo.nmsu.edu/media/skywatcher/dailyVids/[date]_24hr.webm net::ERR_ABORTED 404 (Not Found)
So the following seems to just not be working at the right 'time' as the alert that pops up is the correct string.
<script>
document.querySelector('#daily').src = document.querySelector('#daily').src.replace('[date]', finalDay);
alert(document.querySelector('#daily').src);
</script>
Later in my HTML code I want to use that finalDay as part of a dynamic link:
<div class="col-xs-6 col-sm-6">
<p> Video (Last 24Hours): </p>
<video width="800" controls="controls" preload="metadata">
<source id="daily" src ="{{ MEDIA_URL }}skywatcher/dailyVids/[date]_24hr.webm#t=0.5" type="video/webm">
</video>
</div>
This is in a Django template though this particular page is doing no server side items. In reality the src should be:
<source src ="{{ MEDIA_URL }}skywatcher/dailyVids/20220512_24hr.webm#t=0.5" type="video/webm">
So not sure, I thought I could use some special tag like {{ }} to have it show up but realized that is variables coming FROM the Django server. Hopefully I don't have to do a whole innerHTML call figuring out somehow what that source src id is etc...
Is there really no way to insert a JavaScript variable easily into HTML?
<source src="{{ MEDIA_URL}}skywatcher/dailyVids/[date]_24hr..."/>. Thendocument.querySelector('source').src = document.querySelector('source').src.replace('[date]', finalDay);