Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

182
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda