Moodle 2.1 - Uploaded SWF files will not play in forum posts, but will in other parts of Moodle.

Moodle 2.1 - Uploaded SWF files will not play in forum posts, but will in other parts of Moodle.

by Sam Mudle -
Number of replies: 3

I'd like for students to upload their movies in SWF format in forum posts.  If I create an assignment activity I can post the SWF with the Moodle Media button just fine.

However, if I or a student tries to post the same SWF in a forum, then the SWF filter seems to generate the code just fine, except that the movie won't play.

Is there a restriction in forum posts as to uploading and playing SWFs?  We use Camtasia and the SWF format is really compact and easy to play in the browser.

Average of ratings: -
In reply to Sam Mudle

Re: Moodle 2.1 - Uploaded SWF files will not play in forum posts, but will in other parts of Moodle.

by Mary Cooch -
Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Testers Picture of Translators

Hi there - didn't you ask this question before? Go to site admin>security>site policies and tick "enable trusted content" and then go to define roles>student and edit so that the moodle/site:trustcontent is permitted. NB - there are security issues with this so do be aware of that.

In reply to Mary Cooch

Re: Moodle 2.1 - Uploaded SWF files will not play in forum posts, but will in other parts of Moodle.

by Sam Mudle -

Hi, I did enable trusted content and add it for users.  Once I did that, then the filter's replace the content with the proper OBJECT flash embedding HTML.

Ok, I narrowed the problem down. 

For some reason, Moodle treats Moodle Media uploads as a downloadable attachment.

If I extract the data attribute from the OBJECT tag, it looks like this:

http://www.moodleserver.com/pluginfile.php/237/mod_page/content/3/mammyblue2.swf

..and this plays inline flash SWF movies fine.  I can simply paste this url into the address bar and the browser will full screen play the movie. However, forum posts have a data attribute that looks like this:

http://www.moodleserver.info/pluginfile.php/248/mod_forum/post/90/mammyblue2.swf

The problem is that PLUGINFILE.PHP is telling the browser that the SWF file is to be downloaded.... if I just put that URL into the browser address bar it won't play it, it will ask to be downloaded.  So I have to figure out why PLUGINFILE.PHP wants to serve the media as a download.

In reply to Sam Mudle

Re: Moodle 2.1 - Uploaded SWF files will not play in forum posts, but will in other parts of Moodle.

by Michael Stapleton -
Jeremy, Did you ever figure this out? I have similar but different situation. I would like to manage my SWF files by placing them in a Moodle Database Activity. In concept it works well in that my clients can manage the Add concept in the database but do not want to deal with other methods of bringing the file into Moodle. I also prefer the database method because everything is in one place and I can review the items from time to time as being the most recent version. The problem is that I also want to embed the SWF in the page so the user does not have to download it to watch it. I tried Moodle Media but I don't get the option to insert a URL in there. It only allows linking to Server, Recent... or uploading the SWF. The other option is by going into the HTML editor and inserting an iFrame tag. Again, that works just fine (the SWF plays embedded on the page) as long as I upload the SWF in the course as a "FILE" resource, click Options>Display>Open and then use the URL for that SWF in the iFrame. This is the URL in this scenario.: http://teachremote.com/courses/pluginfile.php/408/mod_resource/content/1/Sample%20SWF%20for%20Testing.swf If I instead go to the database first, upload the SWF to it and then copy that link then when I open the page the SWF wants to download instead of play as an embed?? This is the URL in this scenario.http://teachremote.com/courses/pluginfile.php/404/mod_data/content/5/Sample%20SWF%20for%20Testing.swf Because my first priority is being able to embed I will stick to the upload as a File Resource method for now unless someone sees the errors of my ways.