Coder Social home page Coder Social logo

moodle-swf-embed's Introduction

Embed SWF in moodle

Workaround for using flash files (sfw) in a moodle course. A client-side javascript library is used to load embed the resource in a moodle Page. Embedded video is not supported; flash video files should be converted to a supported format (such as mp4).

Requirements

  • swf.js This library (partially) supports Flash applets (technically this free version supports ActionScript 2.0; more details swf2js.com).

Procedure

  1. Upload the swf2js.js file to your moodle course. Currently swf2js is not hosted at a CDN and improper mimetypes results in Cross-Origin Read Blocking (CORB) in the browser. More info at the chromium project. The file itself can be set to be invisible to students.
  2. Note down the moodle resource URL. This will be in the following form: https://<moodleSite>/pluginfile.php/<contextId>/mod_resource/content/<itemId>/swf2js.js
  3. Upload the swf file to your moodle course. As with the javascript library this can be set invisible for students.
  4. Note down the moodle resource URL. Again this will take the following form: https://<moodleSite>/pluginfile.php/<contextId>/mod_resource/content/<itemId>/<filename>.swf
  5. Create a Page.
  6. Edit the HTML of the page content (toolbar toggle -> Edit HTML source).
  7. Copy the contents of embed.html into the HTML source.
  8. Replace the replace_with_moodle_url_for_swf2js.js (line 1) with the URL to the swf2js-file.
  9. Replace the replace_with_moodle_url_for_swf_file (line 6) with the URL to the swf-file;

Source

<script src="replace_with_moodle_url_for_swf2js.js"
        type="text/javascript"></script>
<script type="text/javascript">
    window.onload = () => {
        swf2js.load(
            'replace_with_moodle_url_for_swf_file',
            {
                "tagId": "player"
            }
        )
    }
</script>
<div id="player" style="height: 100pc; max-height: 900px;"></div>

moodle-swf-embed's People

Contributors

kooi avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.