0

I am using react-player to play video in an app. And it comes with default width which is not responsive. I used some css but it does not work.

import ReactPlayer from 'react-player';

<ReactPlayer url="https://www.youtube.com/watch?v=ysz5S6PUM-U" style={{ width: '100%' }} />

please tell me a way i can change its width and height

Kritish Bhattarai
  • 1,501
  • 15
  • 20

3 Answers3

2

you can do like this .

  <ReactPlayer
          className='react-player'
          url='https://www.youtube.com/watch?v=ysz5S6PUM-U'
          width='100%'
          height='100%'
        />
Arpit Vyas
  • 2,118
  • 1
  • 7
  • 18
1

https://codesandbox.io/s/vv19l17wj3?file=/src/index.js

<ReactPlayer url="https://www.youtube.com/watch?v=ysz5S6PUM-U" width= '100%'/>

try to use width props

Anh Tuan
  • 1,113
  • 5
  • 12
1
<ReactPlayer 
     url='https://www.youtube.com/watch?v=CJj_T-GmtWM&t=1s'
     width= '150%'
/>

now if you use the height It will not work.