Hi, I have a problem with the Reacta Stream component. When I pass the ID in the src property, the player does not fetch the video itself. The ID is passed from the other component as a property. It looks like this:
First component:
function VideoList() {
// ... //
const [videoID, setVideoID] = useState('')
const seeDetails = (file) => {
setVideoID(file.videoID)
}
return (
<>
<section>
<h2>
All video
</h2>
<ul className='grid grid-cols-4'>
{video.map((file) => (
<li
key={file.name}
onClick={(e) => seeDetails(file)}
>
<img
src={encodeURI(file.cover)}
alt={file.name}
/>
</li>
))}
</ul>
</section>
<DetailsVideo
videoID={videoID}
/>
</>
)
}
Second component:
const DetailsVideo = ({ videoID }) => {
const videoRef = createRef(null)
const playVideo = () => {
videoRef.current.play()
}
return (
<>
<Stream
src={videoID}
streamRef={videoRef}
controls
/>
<div className='flex'>
<button
onClick={playVideo}
type='button'
>
Watch
</button>
</div>
</>
)
}
All the video data is stored in the database. I also tried in the src property such a notation:
<Stream src={`https://iframe.videodelivery.net/${videoID}`} streamRef={videoRef} controls />
But in the response the component generates such code:
<iframe src="https://iframe.videodelivery.net/https://iframe.videodelivery.net/852a3fuc72m4cc2ab0934960a0e9ffd8d330da3?preload=metadata" ...
When I use the <iframe src={`https://iframe.videodelivery.net/${videoID}} tag instead of the React component…
Everything works as expected.
I get additional errors in the console:
Source map error:
Error: request failed with status 404
URL source: https://embed.videodelivery.net/embed/sdk-iframe-integration.fla9.latest.js?video=iframe.videodelivery.net
URL source map: sdk-iframe-integration.fla9.86f0598.js.mapXHRGEThttps://videodelivery.net/iframe.videodelivery.net/metadata/playerEnhancementInfo.json
[HTTP/2 404 Not Found 38ms]XHRGEThttps://videodelivery.net/iframe.videodelivery.net/manifest/video.mpd?parentOrigin=http://localhost:3000
[HTTP/2 404 Not Found 51ms]