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

155
Views
play video one by in one in ReactPlayer using reactjs?

I have an array of allUrls[0] which contains the Urls at it each index. Through this code I'm able to play first video of it but the video is not playing next link.

import React, { useEffect, useState } from "react";
import { connect } from "react-redux";
import { Button } from "@material-ui/core";
import "./VideoEditorPreview.css";
import ImgCropper from "../Cropper/ImgCropper";
import { assetDownloadUrl } from "../../actions/asset";
import ReactPlayer from 'react-player'

const VideoEditorPreview = ({
  asset,
  dispatch,
  previewFile,
  VideoEditorPreviewWidth,
  VideoEditorPreviewHeight,
  showDia,
  setShowDia,
}) =>
{

  const [data, setData] = useState([])
  useEffect(() =>
  {
    if (data)
    {
      let items = JSON.parse(localStorage.getItem("timelineFrames"))
      setData([{ items: items[0].files }])
    }
  }, [])
  console.log(data);


//in this function I mapped the allUrls to get all the url
  const allUrls = data.map((item) =>
  {
    let a = []
    console.log(data[0].items);
    for (let index = 0; index < data[0].items.length; index++)
    {
      a.push(item.items[index].url);

    }
    return a
  })
  console.log(allUrls[0]); //its contain the list of url

//tried this function but didn't worked
  const nextVideo = allUrls.map((item) =>
  {
    for (let index = 0; index < allUrls[0].length; index++)
    {
      return (item + 1);

    }
  })
  console.log(nextVideo);


  return (
    <>

          <ReactPlayer id="vid" height="100%" width="100%" url={allUrls[0]}  controls />
          
    </>
  );
};

const mapStateToProps = (state) => ({
  asset: state.asset,
});
export default connect(mapStateToProps)(VideoEditorPreview);

I thought about adding next video button to it but I think I implemented in wrong way.

Image contains information about of allUrls[0]

about 4 years ago · Juan Pablo Isaza
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!