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 Answer 1

3

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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