YoutubeMessage.jsx 622 B

1234567891011121314151617
  1. export const YoutubeMessage = (item) => {
  2. const regYoutube = /http(?:s?):\/\/(?:www\.)?youtu(?:be\.com\/watch\?v=|\.be\/)([\w\-\_]*)(&(amp;)?‌​[\w\?‌​=]*)?/; //for youtube video
  3. return (
  4. <iframe
  5. width="280"
  6. height="160"
  7. style={{'maxWidth': "90%"}}
  8. src={`https://www.youtube.com/embed/`+ (item.text.match(regYoutube)[1])}
  9. title="YouTube video player"
  10. allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
  11. allowFullScreen>
  12. </iframe>
  13. )
  14. }