To answer your initial question: it depends. If you have an application server, then you can use server-side code to generate your HTML and you can subsequently fill the src
accordingly.
However, if doing this with server-side code is not an option, then you can achieve this using client-side code.
Passing the src
It's advisable to pass the video info using a URL parameter rather than a hash parameter:
<li><a href="stream.html?src=video1">video1</a></li>
<li><a href="stream.html?src=video2">video2</a></li>
Getting a URL parameter
This is how you can get the value of a parameter, assuming that it exists:
window.location.search.substring(1).split("&").map(item => item.split("=")).filter(item => (item[0] === "src"))[0][1]
Make sure that you have an id for the video in the second HTML
<video id="my-video">
Let's implement a function that fills the src
function fillSrc() {
let param = window.location.search.substring(1).split("&").map(item => item.split("=")).filter(item => (item[0] === "src"));
if (param.length) { //the param exists
document.getElementById("my-video").src = param[0][1];
}
}
Last but not least, run the function on load
Modify your body
tag and make sure that this function runs:
<body onload="fillSrc">
<!-- some stuff -->
<video id="my-video">
<!-- some stuff -->
</body>