Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

173
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!