MG 2.3 Embeding media already hosted on server

Senkusha

Member
I just purchased the Media Gallery hoping to offer a better viewing option for my members. I have a large media collection already hosted on my server. Is there a way I can just embed these files, like a pointer, instead of having to reupload the content to my server again?
 
Okay, I found an answer to this. After going back and forth with Chat GPT to get some configuration assistance, this is what you need to do.

Go to the Admin Control Panel -> Content -> Edit code media sites. I used the following:
  • Media site ID: local_media
  • Site title: YOUR_SITE_TITLE
  • Site URL: https://YOUR_SITE_URL
  • Show this site on the list of 'supported' sites shown to visitors: True
  • Enabled: True
  • Match URLs: https://YOUR_SITE_URL_WITH_VIDEO_DIRECTORY/{$id}.mp4
  • Embed template:
<video controls width="100%" preload="metadata">
<source src="https://
YOUR_SITE_URL_WITH_VIDEO_DIRECTORY/{$id}.mp4" type="video/mp4">
Your browser does not support HTML5 video.
</video>

Then you can embed locally hosted MP4 files to YOUR_SITE_URL_WITH_VIDEO_DIRECTORY in the Media Gallery.
You can also directly embed these videos within posts:

I also ensured my local .htaccess file had support for *.mp4 files:
# Force correct MIME type for MP4
AddType video/mp4 .mp4
# Allow cross-origin requests for videos (needed for some embeds)
<IfModule mod_headers.c>
<FilesMatch "\.(mp4)$">
Header set Access-Control-Allow-Origin "*"
</FilesMatch>
</IfModule>

I've been pulling my hair out for a week to get this to work. Hopefully, this little guide will help somebody. 😊
 
Back
Top Bottom