How to run plyr in Summernote?

20 Views Asked by At

I recently introduced Summernote as a editor in admin part of Wordpress like website. Videos are played to the end user by plyr. I am able to insert the html inside Summernote editing area but I am not able to get the video to be displayed. If I save such content and display it to the end user the video is there and everything works fine.

In this jsfiddle https://jsfiddle.net/radek/sbrLvpgy/9/ I have plyr inside Summernote. Plyr is loaded and does something but the video in not working. (I did not manage to get youtube video playing by plyr in jsfiddle. )

if(true){
  $(document).ready(function() {
      $('#summernote').summernote({
      });
  });
}
const players = Array.from(document.querySelectorAll('.js-player')).map((p) => new Plyr(p));

change the condition from true to false to see the difference.

I managed to get it working once - to get plyr youtube video working in Summernote but I am not able to make it work now.

The same video is playing in Summernote if I use standard Summernote way how to insert video - https://jsfiddle.net/radek/zve0y6so/4/

Could someone help me ?

0

There are 0 best solutions below