Hello,
I am trying to insert videos using Elgg's default editor, CKEditor.
However, when I insert the video, it only saves on the backend and does not appear on the frontend.
I cannot embed the videos because there is a restriction on the iframe tag. So, how can I adapt this to my project?
I need this functionality, allowing CKEditor to enable this in any text field within the project.
Thank you very much.
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by RaĆ¼l Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
Overview:
I modified the
base.mjs
file located at/var/www/html/matrix/vendor/elgg/elgg/mod/ckeditor/views/default/ckeditor/config
to enable enhanced media embedding support, particularly for YouTube videos. This change ensures that embedded media is correctly displayed on both the backend and frontend.Steps Taken
In the
base.mjs
file, which is located at /vendor/elgg/elgg/mod/ckeditor/views/default/ckeditor/config, I added the following code to handle the CKEditor setup and improve media embedding functionality:Key Changes
mediaembed
plugin was added to handle YouTube videos, allowing videos to be embedded within the content directly by pasting a YouTube URL.With these changes, YouTube videos are now properly embedded and displayed both in the backend editor and on the frontend pages of the website.
You could also have a look at the oEmbed plugin https://elgg.org/plugins/2932901 it replaces urls in text with the embed code for that link.
So if you paste a youtube link it'll present the youtube video. Same for lots more platforms (X, Facebook, Vimeo, etc)
Hi Jerome!
I tried using the oEmbed plugin, but unfortunately, it didn’t work. Any link I tried to share wouldn’t display the content on the frontend in Elgg (even though it was rendered in the HTML).
The change I suggested above partially solved my problem. I can now add YouTube videos to Blog posts, but the video only appears for logged-in users, even when the post is marked as public.
So, I’m looking into how to fix this... but oEmbed isn’t working on my end.
Thanks!
@Thiago Reis
I'm sure the problem is in Htmlawed library.
This plugin solves this issue but I haven't tried it for Elgg 6.
Can you try it and give me feedback?
I just downloaded the plugin suggested by Nikolai and it seems to work with Elgg 6.
I added an iframe to embed a Bandcamp release into a post. Previously, it would only show the link, but now it shows the actual embed. This is very neat.
@elggnoob
Awesome! Thanks for testing.
Hello Nikolai !
I tested the Elgg Hooks plugin, and it started working!
Some observations about the module:
The Elgg Hooks plugin works with the code I suggested at the beginning of the post, also resolving the permission issues.
I’ll run some more tests and get back soon with additional information. For now, everything is going well...
Thank you so much for your support!
This is not a bug, but a feature ;-)
Direct link insertion should work with oEmbed plugin
Hello,
I did some testing and have a few questions:
Thinking long-term, what is the best way to embed videos in posts? My question is whether I should use iframe or the media embed feature in CKEditor. Isn’t using iframe considered insecure?
I used an iframe in a post, but the video breaks the layout on mobile devices. However, when using the editor's media embed feature, it works fine.
How can I incorporate an external CSS file to try to manipulate the video style, making it responsive and aligning it according to different screen resolutions?
The oEmbed plugin doesn’t work. I paste YouTube links directly into the editor, but the link is not converted into a video. It only works if I embed the video using an iframe, inserting the HTML code directly into the editor.
Thank you very much!
for point 4, when pasting the URL make sure it's NOT converted to a clickable link. If it is a link remove that (in the toolbar it's the link icon with the x).
Then try again. It should work.
- Previous
- 1
- 2
- Next
You must log in to post replies.