1

I am adding a video in a Rich Text field through file button in toolbar. I want to play these video in iframe. How can I do this..?

Or is there anyother option or plugin by which I can upload video which and add in richtext filed anywhere I want and show this in iframe on frontend.

Brad Bell
  • 67,440
  • 6
  • 73
  • 143
Mohit Prajapati
  • 291
  • 1
  • 7

2 Answers2

1

If you want to upload and host the video on your site's server, then I would create a field with an Asset field type and restrict the type to Video. Without further details, it's hard to understand why you'd want to handle it within a Rich Text field.

Since you're hosting the video, you don't need an iframe. Just use the HTML5 <video> tag...

{% for video in entry.FIELDNAME %}
<video width="320" height="240" controls>
<source src="{{ video.getUrl }}" type="video/mp4">
</video>

Your servers will be handling the bandwidth for video delivery though; which is why most people post to YouTube or Vimeo and use the iframe to pass it through. To do that, you'd use the include that Brad mentioned.

Jeff Fulton
  • 103
  • 1
  • 9
  • I have text content above the video and below the video so i think if i can handle this with the Rich Text so need to create an extra field for video asset. – Mohit Prajapati Oct 05 '17 at 07:42
0

In your Rich Text field settings, if you select the "Standard" Redactor config that ships with a fresh Craft install (maps to the .json files in craft/config/redactor), it has the "Video" plugin selected by default.

enter image description here

That will add a Video button to your Rich Text field toolbar.

enter image description here

Clicking it will let you embed iframe code that you can output on the front-end of your site.

enter image description here

Brad Bell
  • 67,440
  • 6
  • 73
  • 143