Moodle

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

Details

  • Type: Improvement Improvement
  • Status: Open Open
  • Priority: Minor Minor
  • Resolution: Unresolved
  • 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

Activity

Hide
Nadav Kavalerchik added a comment -

of course, i almost forgot...
please add the following strings to your local forum.php language file.

$string['post_multimedia']= 'add some multimedia';
$string['post_multimedia_audio']= ' audio response only';
$string['post_multimedia_video']= ' video respon';

Show
Nadav Kavalerchik added a comment - of course, i almost forgot... please add the following strings to your local forum.php language file. $string['post_multimedia']= 'add some multimedia'; $string['post_multimedia_audio']= ' audio response only'; $string['post_multimedia_video']= ' video respon';
Hide
Nadav Kavalerchik added a comment -

for some internal TRACKER reason the ">" is changed to "&gt" in the code i suggested above.

so here is a new paste of the code ( i hope it is displayed correctly)

//--------------- 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--------------------

Show
Nadav Kavalerchik added a comment - for some internal TRACKER reason the ">" is changed to "&gt" in the code i suggested above. so here is a new paste of the code ( i hope it is displayed correctly) //--------------- 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--------------------
Hide
Nadav Kavalerchik added a comment -

thank you Miki (from Shenkar, Israel) for pointing that out to me

Show
Nadav Kavalerchik added a comment - thank you Miki (from Shenkar, Israel) for pointing that out to me
Hide
Nadav Kavalerchik added a comment -

riffly.com seems to be out of business
we are now using : "record-it"
http://tracker.moodle.org/browse/MDL-21990

Show
Nadav Kavalerchik added a comment - riffly.com seems to be out of business we are now using : "record-it" http://tracker.moodle.org/browse/MDL-21990

People

Vote (3)
Watch (1)

Dates

  • Created:
    Updated: