Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-19192

enable audio and video replies in forum's posts (patch)

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Inactive
    • Affects Version/s: 1.9
    • Fix Version/s: None
    • Component/s: Forum
    • Labels:
      None

      Description

      enable Audio and/or Video embedded in replays when posting to forum's discussions.
      by using the Riffly.com service. - (that enable free use + adds or very low price add free service)
      API : http://riffly.com/api/include_javascript
      SERVICES : http://riffly.com/plans

      the player is a flash player for recording and for playback.
      audio / video stream (file) is saved on FMS at Riffly.com
      and has a unique id by which it is saved and playback later.

      ============================================================
      to patch....

      inside the file "mod/forum/post_forum.php" just after the lines:

      $mform->addElement('static', 'groupinfo', get_string('group'), $groupname);
      }

      add the following code:

      //-------------------------------------------------------------------------------
      // Riffly Audio / Video recording

      echo <<<RIFFLYSUBMIT
      <script type="text/javascript" src="http://free-video-comments-at.riffly.com/static/js/api/1/web.js"></script>
      <script type="text/javascript">
      function rifflyFinishedRecording (riffly_id, riffly_type)

      { document.getElementById('riffly_id').value = riffly_id; document.getElementById('riffly_type').value = riffly_type; }

      </script>
      RIFFLYSUBMIT;

      $avpost = "<span style=\"direction:ltr !important; font-weight: bold;font-size: 14px; float:right;\"><a href=\"javascript:void(0);\" ";
      $avpost .= "onclick=\"rifflyShowRecorder('recorder_container', 'video', 'rifflyFinishedRecording');\">";
      $avpost .= "<img src=\"http://free-video-comments-at.riffly.com/static/images/api/1/riffly-webcam.png\" border=0 width=20 height=20>".get_string('post_multimedia_video','forum')." </a> ?? ";
      $avpost .= "<a href=\"javascript:void(0);\" onclick=\"rifflyShowRecorder('recorder_container', 'audio', 'rifflyFinishedRecording');\">";
      $avpost .= "<img src=\"http://free-video-comments-at.riffly.com/static/images/api/1/riffly-mic.png\" border=0 width=20 height=20>".get_string('post_multimedia_audio','forum')." </a></span><br/><br/>";
      $avpost .= "<div id=\"recorder_container\"></div>";

      $mform->addElement('static', 'description', get_string('post_multimedia','forum') , $avpost);

      $mform->addElement('hidden', 'riffly_id',null, 'id="riffly_id"');
      $mform->setType('riffly_id', PARAM_TEXT);
      $mform->addElement('hidden', 'riffly_type',null,'id="riffly_type"');
      $mform->setType('riffly_type', PARAM_TEXT);

      //-------------------------------------------------------------------------------

      and inside the file "mod/forum/post.php" just after the lines :

      if ($fromform = $mform_post->get_data()) {

      please add the following code:

      //--------------- RIFFLY Audio/Video Embed before Post->message ---------------------

      $fromform->riffly_id = $_POST['riffly_id'];
      $fromform->riffly_type = $_POST['riffly_type'];

      // Audio / Video Player (Riffly)
      if (!empty($fromform->riffly_id)) {
      if ($fromform->riffly_type == 'audio')

      { $preriffly = "<embed src=\"http://riffly.com/p/$fromform->riffly_id\" width=\"400\" height=\"100\" type=\"application/x-shockwave-flash\" flashvars=\"type=audio&autostart=false\" allowscriptaccess=\"always\" allowfullscreen=\"true\"></embed>"; }

      else

      { $preriffly = "<embed src=\"http://riffly.com/p/$fromform->riffly_id\" width=\"400\" height=\"320\" type=\"application/x-shockwave-flash\" flashvars=\"type=video&autostart=false\" allowscriptaccess=\"always\" allowfullscreen=\"true\"></embed>"; }

      $fromform->message = $preriffly.'<br />'.$fromform->message;
      }
      //--------------RIFFLY END--------------------

      that is it !
      you are ready to go

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Votes:
                3 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: