- Posts: 16
How To / General
[Solved] Embedded video not showing in wrapper
- David Alcock
- Topic Author
- Offline
- New Member
-
Less
More
11 years 2 months ago - 11 years 2 months ago #1
by David Alcock
[Solved] Embedded video not showing in wrapper was created by David Alcock
I am a recent convert to Joomdle and I love it. Finally we can really make Moodle attractive! All appears to be installed correctly after following guide. System check is green. Everything appears to work apart from the fact that I cannot get any vidoes that are in Moodle to appear embedded in Joomdle. This goes for embedded YouTube or my own videos; all are okay. Embedding works in Moodle, and if I put the same video in a Joomla article I have got it to work there also (after making required back end changes). But all I can get when looking at my Moodle course through a Joomla wrapper is a link to launch the video in a player. I don't want that, I want to see it embedded in the wrapper. Presumably I need to change a setting. Can someone please advise?
Oh, and yes I did enable the iframe setting during the Joomdle installation procedure, so it isn't tha.
Thanks
Oh, and yes I did enable the iframe setting during the Joomdle installation procedure, so it isn't tha.
Thanks
Last edit: 11 years 2 months ago by Antonio Durán.
The topic has been locked.
- David Alcock
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 16
11 years 2 months ago - 11 years 2 months ago #2
by David Alcock
Replied by David Alcock on topic Embedded video not showing in wrapper
Doing a bit more detective work on this issue, I see that the latest version of Moodle is not inserting media (videos) in an iframe, it is using a built in facility, span class media plugin. If I remember right (and no, I'm no expert at all as you have probably already realised) I think that is new to html5. I am wondering if that is the cause of my problem. Anyone know? I am going to test by ripping out the video inserted using this media controller and code it in to an iframe instead, see if that solves it.
Last edit: 11 years 2 months ago by David Alcock.
The topic has been locked.
- David Alcock
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 16
11 years 2 months ago #3
by David Alcock
Replied by David Alcock on topic Embedded video not showing in wrapper
Bingo, that solved it. I ignored the ability to embed using Moodle Media installation method and simply created an iframe. Now I can run YourTube or my own videos within the Joomdle wrapper.
That raises the question of whether we can look forward to Joomdle updating to take into account the latest way that Moodle wants to "help" us embed videos?
Now I've got a bit of editing to do!!
That raises the question of whether we can look forward to Joomdle updating to take into account the latest way that Moodle wants to "help" us embed videos?
Now I've got a bit of editing to do!!
The topic has been locked.
- Chris
-
- Offline
- Moderator
-
11 years 2 months ago #4
by Chris
Replied by Chris on topic Embedded video not showing in wrapper
Happy to hear you have it working. To be sure what you are asking for, you have not added the videos using the Moodle media manager and instead just included some html directly to add the videos?
It is likely that we would need to search and replace code based on configuration settings. It would be useful to know exactly what you have done to immediately replicate your environment to be sure.
It is likely that we would need to search and replace code based on configuration settings. It would be useful to know exactly what you have done to immediately replicate your environment to be sure.
The topic has been locked.
- David Alcock
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 16
11 years 2 months ago - 11 years 2 months ago #5
by David Alcock
Replied by David Alcock on topic Embedded video not showing in wrapper
It's the other way round, Chris. If I code in an iframe and show videos from there it works fine. But if I use Moodle media manager it works perfectly to show embedded videos in Moodle but they only appear as a link in a Joomdle wrapper.
I have found that I can get youtube videos to show embedded in a Joomdle wrapper by ensuring that I use Moodle media manager and search for the youtube using the youtube file picker. That works fine.
But I still can't embed one of my own mp4 movies and get it to play in the wrapper, it only shows as a link. Click on the link and it launches the player in a pop-up, but I want it in the wrapper.
I have inspected the element in the Joomdle wrapper and it tells me "failed to load resource". That happens in Chrome, Firefox and IE, so it isn't a browser issue. and it doesn't happen looking at the video on Moodle either. Therefore I suspect I have got an incorrect setting somewhere in Joomdle. But, like I say, it works for YouTube and I have a green system check. Does a video file need to be in a certain location for Joomdle to be able to find it? Might I have Moodle media set up to use a relative address for video files rather than absolute? Is that possible and if so is it possible to change it?
Next test: I have just changed the format of the video from mp4 to wmv and I get exactly the same results, failed to load resource.
I'm getting closer:
It is certainly down to not being able to access the video file. I have created a folder within the Moodle site and put my videos in that. I then used Moodle media manager to select those videos from the new folder. I was able to view them in Moodle AND in the joomdle wrapper. Therefore the problem is something to do with either where my repository is sitting OR Moodle not moving the video from the "draft" location once I have finished editing the Moodle label or page in which the video is embedded.
I have found that I can get youtube videos to show embedded in a Joomdle wrapper by ensuring that I use Moodle media manager and search for the youtube using the youtube file picker. That works fine.
But I still can't embed one of my own mp4 movies and get it to play in the wrapper, it only shows as a link. Click on the link and it launches the player in a pop-up, but I want it in the wrapper.
I have inspected the element in the Joomdle wrapper and it tells me "failed to load resource". That happens in Chrome, Firefox and IE, so it isn't a browser issue. and it doesn't happen looking at the video on Moodle either. Therefore I suspect I have got an incorrect setting somewhere in Joomdle. But, like I say, it works for YouTube and I have a green system check. Does a video file need to be in a certain location for Joomdle to be able to find it? Might I have Moodle media set up to use a relative address for video files rather than absolute? Is that possible and if so is it possible to change it?
Next test: I have just changed the format of the video from mp4 to wmv and I get exactly the same results, failed to load resource.
I'm getting closer:
It is certainly down to not being able to access the video file. I have created a folder within the Moodle site and put my videos in that. I then used Moodle media manager to select those videos from the new folder. I was able to view them in Moodle AND in the joomdle wrapper. Therefore the problem is something to do with either where my repository is sitting OR Moodle not moving the video from the "draft" location once I have finished editing the Moodle label or page in which the video is embedded.
Last edit: 11 years 2 months ago by David Alcock. Reason: More investigation
The topic has been locked.
- David Alcock
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 16
11 years 2 months ago #6
by David Alcock
Replied by David Alcock on topic Embedded video not showing in wrapper
I have still not solved this issue, but I have worked out something that is a bit of a workaround.
In summary, and as a final test of whether I did something wrong, I created a brand new Joomla site. No changes at all, even used the default theme. Set up a brand new Moodle site within a sub-directory of the Joomla site. Again, basic configuration. I then installed Joomdle to connect the two. I set up a dummy course in Moodle and embedded a youtbue video without a problem. Then embedded an uploaded mp4 file into whatever is the default location/repository that Moodle uses. I was able to see that mp4 in Moodle but NOT in Joomdle wrapper. What's more, after about half an hour of uploading the file I could no longer access it in Moodle or see it displayed in Moodle. I think I remember reading that Moodle creats a temporary store of the uploaded file in a "draft" location while you are using it, then puts it somewhere else. Is suspect that is causing a problem for some reason. Either it is not moving it to a long term place or it is doing so but not updating the location information in my page or label.
So, the solution:
Within the Moodle site I have added a simple folder (using ftp) and uploaded my mp4 files. I have then used the html5 tags for inserting a video. Provide the source link to the video in my new folder and bingo, it works. The downside is that I will have to do this for every video that I want to use. I also suspect that the folder is not secure. But that's not a problem, I cam replace the videos if needed. The good news is that I can now see my videos in Moodle AND, even more importantly, in Joomdle!
If anyone can tell me whether I am right in my diagnosis, or if you think I have understood something wrong, please do tell me. Also, if anyone can recommend a Moodle plugin/extension that will enable videos to be inserted more easily without all the manual labour I would be please to hear your recommendation.
In summary, and as a final test of whether I did something wrong, I created a brand new Joomla site. No changes at all, even used the default theme. Set up a brand new Moodle site within a sub-directory of the Joomla site. Again, basic configuration. I then installed Joomdle to connect the two. I set up a dummy course in Moodle and embedded a youtbue video without a problem. Then embedded an uploaded mp4 file into whatever is the default location/repository that Moodle uses. I was able to see that mp4 in Moodle but NOT in Joomdle wrapper. What's more, after about half an hour of uploading the file I could no longer access it in Moodle or see it displayed in Moodle. I think I remember reading that Moodle creats a temporary store of the uploaded file in a "draft" location while you are using it, then puts it somewhere else. Is suspect that is causing a problem for some reason. Either it is not moving it to a long term place or it is doing so but not updating the location information in my page or label.
So, the solution:
Within the Moodle site I have added a simple folder (using ftp) and uploaded my mp4 files. I have then used the html5 tags for inserting a video. Provide the source link to the video in my new folder and bingo, it works. The downside is that I will have to do this for every video that I want to use. I also suspect that the folder is not secure. But that's not a problem, I cam replace the videos if needed. The good news is that I can now see my videos in Moodle AND, even more importantly, in Joomdle!
If anyone can tell me whether I am right in my diagnosis, or if you think I have understood something wrong, please do tell me. Also, if anyone can recommend a Moodle plugin/extension that will enable videos to be inserted more easily without all the manual labour I would be please to hear your recommendation.
The topic has been locked.
- Chris
-
- Offline
- Moderator
-
11 years 2 months ago #7
by Chris
Replied by Chris on topic Embedded video not showing in wrapper
Hi there,
The problem you are describing is not just related to videos but also images. Now that you have described the scenario in full, I can confirm that this is a known problem in Moodle in that the file path includes draftfile.php instead of pluginfile.php after saving. I believe Moodle uses draffile.php while uploading and in the initial edit mode and after saving Moodles moves/changes the file path to pluginfile.php. However, in some cases, I do not know which, the path stays as draftfile.php and in other cases it changes. I did not explore further nor attempt to truly understand the issue but advised our client of the problem and they addressed it internally. The impact, if I recall, is that when the file path is draftfile.php the image/video does not get displayed (Joomla or Moodle).
I did try manually change the file path but that did not work as it set it back to draftfile.php. You can find a few Moodle trackers on this:
tracker.moodle.org/browse/MDL-26782
tracker.moodle.org/browse/MDL-48371
and a solution, that I have not tested moodle.org/mod/forum/discuss.php?d=185839
Apparently the bug was first reported way back in 2011 and was re-reported again for the Moodle wiki. Perhaps an old bug has re-emerged?
The problem you are describing is not just related to videos but also images. Now that you have described the scenario in full, I can confirm that this is a known problem in Moodle in that the file path includes draftfile.php instead of pluginfile.php after saving. I believe Moodle uses draffile.php while uploading and in the initial edit mode and after saving Moodles moves/changes the file path to pluginfile.php. However, in some cases, I do not know which, the path stays as draftfile.php and in other cases it changes. I did not explore further nor attempt to truly understand the issue but advised our client of the problem and they addressed it internally. The impact, if I recall, is that when the file path is draftfile.php the image/video does not get displayed (Joomla or Moodle).
I did try manually change the file path but that did not work as it set it back to draftfile.php. You can find a few Moodle trackers on this:
tracker.moodle.org/browse/MDL-26782
tracker.moodle.org/browse/MDL-48371
and a solution, that I have not tested moodle.org/mod/forum/discuss.php?d=185839
Apparently the bug was first reported way back in 2011 and was re-reported again for the Moodle wiki. Perhaps an old bug has re-emerged?
The topic has been locked.
- David Alcock
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 16
11 years 2 months ago #8
by David Alcock
Replied by David Alcock on topic Embedded video not showing in wrapper
Chris, yes I felt I was on the right lines with my diagnosis. I have applied the fix in the link you gave (fix is written below for the future benefit of others) and it has helped but not provided a solution. That is, the video does now show up in Moodle and also the file shows up in the repository. I will wait an hour or two to see if it vanishes again!
However, the video still does not show up embedded in the Joomdle wrapper, just as a link to launch the player. Now that Moodle is displaying the code and retaining it I have been able to take this a bit further....
If I add a video from Moodle media manager (simply clicking on the add media ikon in the text editor Moodle creates the following code
<p><a href="http://urlofvideo.mp4">ppdintro.mp4
That appears as nothing but a link to Joomdle, which I am not surprised about.
If I change the code to
<video src="http://urlofvideo.mp4">ppdintro.mp4
Then the video does show up in the Joomdle wrapper. Again, I find myself wondering if I am missing something obvious and doing something wrong, but I don't understand why Moodle would put a video inside an <a> </a> tag for this job, specially since <video> </video> appears to be fairly established now due to html5.
If I am totally missing the point, please someone tell me. Until then I am going to be changing the default Moodle code in each instance. I'm not smart enough to know how to change this in the back end so that it uses <video> every time by default, but if someone knows how to do that I will give it a try. I will also take a look at some Moodle extensions/plugins to see if there is anything out there to over-ride Moodle in this task.
Thanks for your help, Chris!
The fix that enabled Moodle to retain the mp4 file but not display in Joomdle wrapper:
I made this change to filelib.php approximately line 752, begining of function "file_rewrite_urls_to_pluginfile", you'll see $wwwroot = $CFG->wwwroot;
I changed it to
$wwwroot = parse_url($CFG->wwwroot,PHP_URL_PATH);
$text = str_ireplace("$CFG->wwwroot", "$wwwroot", $text);
However, the video still does not show up embedded in the Joomdle wrapper, just as a link to launch the player. Now that Moodle is displaying the code and retaining it I have been able to take this a bit further....
If I add a video from Moodle media manager (simply clicking on the add media ikon in the text editor Moodle creates the following code
<p><a href="http://urlofvideo.mp4">ppdintro.mp4
That appears as nothing but a link to Joomdle, which I am not surprised about.
If I change the code to
<video src="http://urlofvideo.mp4">ppdintro.mp4
Then the video does show up in the Joomdle wrapper. Again, I find myself wondering if I am missing something obvious and doing something wrong, but I don't understand why Moodle would put a video inside an <a> </a> tag for this job, specially since <video> </video> appears to be fairly established now due to html5.
If I am totally missing the point, please someone tell me. Until then I am going to be changing the default Moodle code in each instance. I'm not smart enough to know how to change this in the back end so that it uses <video> every time by default, but if someone knows how to do that I will give it a try. I will also take a look at some Moodle extensions/plugins to see if there is anything out there to over-ride Moodle in this task.
Thanks for your help, Chris!
The fix that enabled Moodle to retain the mp4 file but not display in Joomdle wrapper:
I made this change to filelib.php approximately line 752, begining of function "file_rewrite_urls_to_pluginfile", you'll see $wwwroot = $CFG->wwwroot;
I changed it to
$wwwroot = parse_url($CFG->wwwroot,PHP_URL_PATH);
$text = str_ireplace("$CFG->wwwroot", "$wwwroot", $text);
The topic has been locked.
- David Alcock
- Topic Author
- Offline
- New Member
-
Less
More
- Posts: 16
11 years 2 months ago - 11 years 2 months ago #9
by David Alcock
Replied by David Alcock on topic Embedded video not showing in wrapper
It's the tags that Moodle media manager uses that is causing the problem. If I embed a movie it uses <a> </a> as the tag. If I change that to <video> </video> and also change href to src, then Joomdle will read it and display it. Therefore I read that as a Joomdle issue, don't you? I can see that some might say it is Moodle's fault for not using <video>, but the mp4 can be seen in Moodle and so whatever Moodle is doing behind the scenes is working for Moodle but not for Joomdle. I wonder if Joomdle can be made to read the <a> tag as Moodle appears to when that tag is applied to a video?
Last edit: 11 years 2 months ago by David Alcock.
The topic has been locked.
- Antonio Durán
-
- Offline
- Moderator
-
Less
More
- Posts: 7926
11 years 2 months ago #10
by Antonio Durán
Replied by Antonio Durán on topic Embedded video not showing in wrapper
Hi David.
Thanks for all the info. I have set up a new local test site with latest Joomla and Moodle, but have not been able to reproduce the problem.
I think the easiest thing, if possible, would be for you to provide access so I can see exactly how you have set up vides, and what is happening, so I can try to reproduce it locally. You can send info to development@joomdle.com
Thanks for all the info. I have set up a new local test site with latest Joomla and Moodle, but have not been able to reproduce the problem.
I think the easiest thing, if possible, would be for you to provide access so I can see exactly how you have set up vides, and what is happening, so I can try to reproduce it locally. You can send info to development@joomdle.com
The topic has been locked.