2

I have create a video player component in Sitecore jss/react. I have tried with react-player player plugin. It is working fine in disconnected mode but as soon as I deployed it in Sitecore, it is neither working in Sitecore Experience Editor nor on live site.

Is it possible to video component in Sitecore jss/react?

1

I have implemented a video component without using any react plugin. It supports both Youtube and Vimeo. The code snippet is very small. Please see below

<iframe
  width="100%"
  height="345"
  title="event-video"
  src={videoUrl}
/>

Here I retrieve the videoUrl from Sitecore Item which should be of the embedding type. You can also retrieve the videoUrl from a GraphQL. Below are examples of the urls

Youtube

https://www.youtube.com/embed/1YuN3POoNnQ

Vimeo

https://player.vimeo.com/video/421689971

To get the Embedded URL, you can retrieve it by clicking on Share button and then select the embed part. See screenshot below

enter image description here

| improve this answer | |
  • thanks for your help, it has saved my time. – amit kumar Jun 10 at 15:51
  • @amitkumar since it helped can you please upvote and approve the answer so that it benefits others also – Walid Rohiman Jun 25 at 15:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.