Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

175
Vistas
Adjusting video src to URL parameter

I'd like to set the src to my video according to the URL parameter (after the ?)
Here's what I've got so far:

<video></video>
<script>
document.getElementsByTagName("video").src="###";

I need help with setting the ### src value to the correct value like so:
realistic example

https://website.com/player?@#$%

src="https://areallylongaddress.com/videosourcefolder/@#$%";

simpler example

https://website.com/player?intro_video

src="https://areallylongaddress.com/videosourcefolder/intro_video";

essentially, a strip of code that sets the video src to a fixed string value (areallylongaddress.com), then adds the url parameter to the end

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

If i understand you correctly u want to set the src of the video to the url parameter(query string). Usually query strings are link this - "https://website.com/player?srcName=intro_video" So all u need to do is

const queryString = window.location.search;
// querySting = ?srcName=intro_video
const urlParams = new URLSearchParams(queryString);

const src_name = urlParams.get('src_name');
console.log(src_name);
//prints "intro_video"
document.getElementsByTagName("video").src=src_name;

Edit -

      //main Html form where u go to https://website.com/player?folders/vkxq2f.mp4 page
    let vid_URL = "https://files.catbox.moe/vkxq2f.mp4";
    let vid_name = vid_URL.split('/').at(-1);
    console.log(vid_name);
    //here you do something like onclick(window.href=`https://website.com/player?video=${vid_name}`)

    //Then in player.html
    document.getElementsByTagName("video").src = new URLSearchParams(window.location.search).get('video');

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda