Using peertube oembed in moodle

Hi All,
I’m new here. I’m rolling out a peertube installation for a school. Peertube works fine!
I’m trying to make an integration with Moodle, following the documentation I’ve found on PeerTube documentation. I 've found that the Moodle oembed plugin with the peertube scheme should make it possible to embed the video the Moodle way, linking to the share URL similar as YT

It doesn’t unfortunately.

I added extra peertube urls to scheme to end up with

{« schemes »: [
« peertubeurl/videos/watch/",
« peertubeurel/* »,
« url »: « peertubeurl/services/oembed »,
« discovery »: true
The video player appears, but no preview, no video.

Is there anyone here that got this to work and wants to share the magic?

Kind regards

PS: sorry I can’t post my exact code. As a new user, my post van only contain 2 urls, I understand 100% why.

I’m interested too.
@koenr, did you find a way to do it ?
Does anyone have a solution ?

Unfortunately not. I didn’t spend more time on it since I couldn’t find it anyway and since then the installation is idling.
But I would be very happy to know the solution! If there is something to test, let me know.

1 Like

Hi everyone, I’ve found a trick to integrate Peertube videos in H5P and BigBlueButton, whereas it used to constantly fail. It may or may not help you. Instead of using the « share link » URL to embed the video, I used the « download link » URL. I actually spoke about that in one of my videos
Update me if it did the trick for you :thinking:

Yes, I found that already, but it is not the right way to do things: the share link should work. For staff training purpose, adding a video is done by « add video and paste the share link », not a different way for every platform.

To add to this discussion: as far as I could debug, the oEmbed link, generated by Peertube seems to me OK. I think the Moodle oEmbed-filter is the problem. I can’t get it to work at all. I created a Moodle bug at [CONTRIB-9143] oEmbed filter failing on 4.0? - Moodle Tracker. If anyone has more info, please contribute.

1 Like

Hello, after a few tests, I think I’ve found the problem.
In the documentation, there is a space to delete in the scheme (see capture below).

Then, exploring the code of the plugin, I’ve seen that other suppliers lists a lot more url. For example for vimeo :


So I’ve added the url scheme with « w » to the one listed in the doc :


And it works ! (under Moodle v4).
I’ve never found (like the doc of oEmbed plugin says) where to deactivate Youtube and Vimeo Media Embeding in Moodle settings.

A last wish could be to have somewhere an option to choose which info to send through this method (because personnaly I like to hide channel name, IP warning, etc.) to have a clean embed, and here, everything is displayed over the player :

This is already possible.
In the Peertube sharing popup, you have advanced option at the bottom:

Hi John, you’re right, but this settings only applies when you use the iframe code.
If you use the oEmbed fonctionnality (in my case copying/pasting only the url of the video), there is some defaults parameters applied, but I can’t customize it like I do with the iframe.

So an idea could be a new section in the administration backoffice of Peertube (or in a configuration file, because once set up, it won’t probably be changed very often) where an administrator can customize the infos broadcast with oEmbed.

Oops sorry. I forgot what oEmbed is. Know I understand.

There was a similar issue for wordpress here (in french), with a solution:

I don’t know if such a solution is possible with Moodle.

Thanks John, it could be an idea (I’m not a dev, so I have to investigate a little more).
But if I understand their workaround, they implement in Wordpress a little bit of code to « overpass » the settings of oembed.
I guess we could try to do the same inside Moodle to choose to hide some parameters brodcast by oembed (like they do to force the allowfullscreen).
Good advice, thanks :wink:

So I added the url with w like this:

"https:\/\/\/videos\/w\/*"],url": "https:\/\/\/services\/oembed","discovery":true}]

and unfortunately it doesn’t work (using the URL - it works always with the embed-code). The point of oembed is to not have to use the embed code.

As for spaces: there is also a space between discovery" and : which is not there in the other filters in the database.

Video and Youtube disabling in Moodle can be done in various locations.

  • In Mediaplayers: moodle/admin/settings.php?section=managemediaplayers
  • In moodle/admin/settings.php?section=mediasettingvideojs if you have VideoJS enabled
  • In Filters: moodle/admin/filters.php if you want to switch of a lot. This can be done on the course level too.

Did you manage to do anything with the oEmbed-filter (as in disable e.g. Youtube in other Moodle Mediaplayers and enable it in oEmbed-filter and it works? To my feeling, the Moodle oEmbed-filter doesn’t work anymore, but I didn’t get any feedback on [CONTRIB-9143] oEmbed filter failing on 4.0? - Moodle Tracker

Hi koenr,
You’re right, I’ve deleted other spaces too. Here are the code I’ve copied/pasted :


But I still get a strange behavior :
when I’m in edition mode on the Moodle page, I just have to paste the url, and then I save and display the page. The video loads as expected, and plays too. Good.
But if I exit the edition mode, and browse my course, the page loads in a popup window and after that, no way to play the video. But the thumbnail loads as expected, but nothing happens when I click the « play » triangle above the thumbnail.

So it seems that the oEmbed quite works (I get the player, the thumbnail, the real name of the video, etc.) but there is still this difference between edition and view mode of Moodle.

In both case, the iframe works as expected.

I will try to disable Youtube/Vimeo embed to see if it changes something (but I’ve to wait the return of my collegue).

Thanks to investigate with me on this.

Hm, then you got further then me, Erik. For me it doesn’t work at all.
That inspires me to try it on a fresh Moodle install…
Kind regards

Hi koenr,
I keep investigating on Peertube integration in Moodle.
In Moodle v4, the plugin oembed filter (not updated since 3 years now) seems to be replaced by the Media player section in the Site administration :

If I read the doc, I guess we have to developp our own Media player (related to our Peertube instance from where we want to embed video) and add it to the list.

Here is the doc : Media players - MoodleDocs
I’m not a dev but I will ask my colleague to look at it.

To be continued…

Hi Eric, the Oembed-filter is set up as a text filter, rather then a media-player. I think it should still work.
Someone did some work on it to get it going and posted a pull request with a lot of modifications: Ensure compatibility with Moodle 4.0 & update Unit tests by Badatos · Pull Request #7 · PoetOS/moodle-filter_oembed · GitHub
I’m on holiday at the moment, but when back at work, I’m going to give those modifications a try. That said, I can’t generate any error messages with Oembed - it just doesn’t do anything …
As you say, to be continued. Giving up is a recipe for failure :slight_smile:

1 Like

Hi @koenr, thanks for your info.
Let me know if this PR fix the problem (even if the request seems frozen since 5 months…).

Just to let you know if you use also H5P activities in Moodle : we have made a lot of testing, and it seems that HLS url (https://…/download/streaming-playlists/hls/…-1080-fragmented.mp4) doesn’t work well inside H5P (very long loading time, and strange behavior with the video’s duration not always recognized).
Instead, if you transcode also in Webtorrent, those url (https://…/download/videos/…-1080.mp4) works perfectly well.

So on our side, we have decided to manually trigger webtorrent transcoding when we want to make H5P activities.

So I installed the patched version from GitHub - Badatos/moodle-filter_oembed: oEmbed Filter for Moodle, checked my provider settings and it doesn’t work :frowning:

I added my findings again to [CONTRIB-9143] oEmbed filter fails on 4.0 - Moodle Tracker

We don’t use much H5P, so I don’t think I can help with that. It’s funny behaviour you describe :frowning: It makes it even more difficult for end users.