How to Play .MP4 in Moodle (huge training files)

How to Play .MP4 in Moodle (huge training files)

by Christian Nheil Sebastian -
Number of replies: 5

Hi.

I'm running moodle in a LAN. Reason for this is, we live in a remote island where internet speed is unreliable. May I please ask help on how to play an .mp4 from a network drive?

This works on a regular html:

<video controls="">
  <source src="z:\Life.mp4" type="video/mp4">
  I'm sorry; your browser doesn't support HTML5 video in WebM with VP8/VP9 or MP4 with H.264.
</video>


But when I use the code above inside Moodle I keep getting this:


Average of ratings: -
In reply to Christian Nheil Sebastian

Re: How to Play .MP4 in Moodle (huge training files)

by Colin Fraser -

Hi Chris, whatever "this" is;..............................<got cut short..>


OK these errors are usually from three sources:

1. The network, via Moodle, is not capable of actually running the video. I know, sounds strange but the resources required by Moodle and large videos slows the network considerably. 

2. Manually inserting the code is not always a good way of dealing with videos inside a PHP environment, and I really have no idea why. Have tried it, but it seems to come unstuck often so likely I am doing something wrong, but it just comes unstuck. BTW, my PHP skills are erm... problematic anyway but I do know a little about HTML.

3. Not trusting the Moodle native video handler to work. Why are you manually inserting code? What size restrictions do you have on files inside your Moodle? 

The thing I thought of straight away was why are you trying to embed large videos into Moodle? Wouldn't you be better off creating another website inside your server to act as a repository for your videos?  You can have as many web sites on your server as it can support, not just one, and just create a link to the video from the Moodle. As long as it is a site in it's own right, doesn't matter. You might set your Moodle network up to as many sites as you want really. If you don't know how to do this, and you are using either Apache or NginX look at this web page it will provide a simple way to virtualize your sites. IIS is a bit different, but it too is not that difficult. 

Average of ratings: Useful (1)
In reply to Colin Fraser

Re: How to Play .MP4 in Moodle (huge training files)

by Christian Nheil Sebastian -

Thank you for  responding Colin. Really helpful information. I appreciate it. I tried to use Plex as video repository but it's becoming complicated. I found this topic:

https://moodle.org/mod/forum/discuss.php?d=198843

This is very similar to my case.

In the end what I did was just, create an html that would open and play the video and link that html file inside Moodle.


In reply to Christian Nheil Sebastian

Re: How to Play .MP4 in Moodle (huge training files)

by Justin Hunt -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

Chris,

It sounds like it should work as desired really. We could not see the whole error in that first post and that would have helped us give a better answer. 

Moodle will handle MP4 playback out of the box, so I do not think you need to insert video tags yourself on the page, nor create a unique html file. It should just be enough to insert a link to that MP4 file on the page. But the network server files will need to be accessible via a web browser. It sounds like you have a web server set up. So it should just be a matter of linking to the file in the html area and letting Moodle do the rest.

eg

<a href="http://192.168.1.100/videos/Myfile.mp4">Myfile.mp4</a>
Average of ratings: Useful (1)
In reply to Justin Hunt

Re: How to Play .MP4 in Moodle (huge training files)

by Christian Nheil Sebastian -

Hi Justin,


Thank you for responding. Yes, you are correct. I am running Moodle in XAMMP and the video files are in a NAS drive. The video files are 500MB to 1GB. 

I tried

 <a href="http://XXX.XX.XX.XXX/Mood/Life.MP4">Life.MP4</a> and I got this message in Chrome, Firefox and Edge.

Error

Thank you for looking into this.

In reply to Christian Nheil Sebastian

Re: How to Play .MP4 in Moodle (huge training files)

by Justin Hunt -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

So thats kind of clear and not clear at all. But it is what it says. 

Either the file can not be accessed on the network, or its not a format that plays in a web browser. Some MP4's are more equal than others.

If you just paste that URL into the browser address bar in Chrome, does it play back or do you get an error? If its an error, then that would indicate the URL can not be resolved for some reason. If its a player or it tries to download the file, then the URL is ok.

If it plays back the plot thickens. This could yet be a format thing, or it could be CORS thing.

Lets remove some variables. This is a link to an MP4 file I use for testing.
https://drive.google.com/file/d/1cLyRcALATWiVTt7YW0PX3ewk70o6durT/view?usp=sharing

Download this and put it on your NAS server. This will have no format issues and should play back just peachy, if the URL resolves ok and if there are no CORS issues.

And it just has to be said:  500MB  - 1GB is no good. They should be converted to an optimal size and/or format for the web. If the videos are really really long, they should be split into multiple shorter videos. Something like Plex might stream and encode it for you on the fly I suppose. But otherwise I think you should re-consider your strategy perhaps.


Average of ratings: Useful (3)