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

180
Views
pass multiple local storage videos to react js popup video player

i created onclick react grid video player using ag-grid. after that passing json data to grid.

after passing json data my ag-grid look like this

Now i passed only one local storage video to react video player(Play button )

import myData from "../video.mp4"
   ....
   ....
    <DialogContent>
        <iframe width="560" height="315" src={myData} allowFullScreen></iframe>
        </DialogContent>

src={myData} is represent video.mp4 in my local storage , Now how to i pass multiple videos to react video player using json file

my json file structure like this :

{
  "users": [
    {
      "id": 1,
      "name": "Hari",
      "email": "anbu@gmail.com",
      "phone": "9876543210",
      "dob": "/home/fraction/Music/agGrid-crudOperation/src/video1.mp4"
    },
    {
      "name": "Hari",
      "email": "anbu@gmail.com",
      "phone": "9876543210",
      "dob": "/home/fraction/Music/agGrid-crudOperation/src/video2.mp4",
      "id": 5
    }
  ]
}

i tried to pass video url using map method but its didnt work me. how to pass multiple videos through json file in react js

for more code details refer here

Any suggestion and answer are heartly appreciated thanks in advance..

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Guessing the local storage meant here is the repository folder where videos are present.

The main reason for why it does not work is because videos are not served for your frontend.

I would suggest having a server side setup and serve each video with an url. Then simply refer to that url in your frontend, rather than embedding the whole mp4 within your frontend.

The import myData from "../video.mp4" which works because of webpack simply embedded the whole video binary within your frontend javascript during compilation.

For multiple videos case, the reason why it does not work is simply they are not require or import in your javascript, so they are not embedded to your frontend code.

If you really want to have frontend reading your local files, you may use File System Access API and take a look at this reference, and this is full guide of the API.

If you want to use the map(), you may change the json to something like this, with dob as your video url.

{
  "users": [
    {
      "id": 1,
      "name": "Hari",
      "email": "anbu@gmail.com",
      "phone": "9876543210",
      "dob": "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
    },
    {
      "name": "Hari",
      "email": "anbu@gmail.com",
      "phone": "9876543210",
      "dob": "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4",
      "id": 5
    }
  ]
}

Then in your iframe, use the dob url for the video

<iframe width="420" height="315"
            src={dob}>
</iframe>
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!