Skip to content

Commit

Permalink
MDL-60848 atto_recordrtc: changed HTML of attached recordings
Browse files Browse the repository at this point in the history
This was done so the user can then click on the recording and
add subtitles etc - the same behaviour as 'atto_media'.
  • Loading branch information
mdjnelson committed Apr 13, 2018
1 parent b5a3388 commit c8520ca
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 33 deletions.
3 changes: 0 additions & 3 deletions lib/editor/atto/plugins/recordrtc/lang/en/atto_recordrtc.php
Expand Up @@ -26,9 +26,6 @@

$string['allowedtypes'] = 'Allowed types';
$string['allowedtypes_desc'] = 'Which recording buttons should appear in Atto';
$string['annotationprompt'] = 'What should the annotation appear as?';
$string['annotation:audio'] = 'Audio annotation';
$string['annotation:video'] = 'Video annotation';
$string['attachrecording'] = 'Attach recording';
$string['audioandvideo'] = 'Audio and video';
$string['audiobitrate'] = 'Audio bitrate';
Expand Down
5 changes: 1 addition & 4 deletions lib/editor/atto/plugins/recordrtc/lib.php
Expand Up @@ -104,10 +104,7 @@ function atto_recordrtc_strings_for_js() {
'uploadprogress',
'uploadfailed',
'uploadfailed404',
'uploadaborted',
'annotationprompt',
'annotation:audio',
'annotation:video'
'uploadaborted'
);

$PAGE->requires->strings_for_js($strings, 'atto_recordrtc');
Expand Down
Expand Up @@ -292,16 +292,22 @@ M.atto_recordrtc.commonmodule = {

// Generates link to recorded annotation to be inserted.
create_annotation: function(type, recording_url) {
var linkText = window.prompt(M.util.get_string('annotationprompt', 'atto_recordrtc'),
M.util.get_string('annotation:' + type, 'atto_recordrtc'));
var html = '';
if (type == 'audio') {
html = "<audio controls='true'>";
} else { // Must be video.
html = "<video controls='true'>";
}

// Return HTML for annotation link, if user did not press "Cancel".
if (!linkText) {
return undefined;
} else {
var annotation = '<a target="_blank" href="' + recording_url + '">' + linkText + '</a>';
return annotation;
html += "<source src='" + recording_url + "'>" + recording_url;

if (type == 'audio') {
html += "</audio>";
} else { // Must be video.
html += "</video>";
}

return html;
},

// Inserts link to annotation in editor text area.
Expand Down

Large diffs are not rendered by default.

Expand Up @@ -292,16 +292,22 @@ M.atto_recordrtc.commonmodule = {

// Generates link to recorded annotation to be inserted.
create_annotation: function(type, recording_url) {
var linkText = window.prompt(M.util.get_string('annotationprompt', 'atto_recordrtc'),
M.util.get_string('annotation:' + type, 'atto_recordrtc'));
var html = '';
if (type == 'audio') {
html = "<audio controls='true'>";
} else { // Must be video.
html = "<video controls='true'>";
}

// Return HTML for annotation link, if user did not press "Cancel".
if (!linkText) {
return undefined;
} else {
var annotation = '<a target="_blank" href="' + recording_url + '">' + linkText + '</a>';
return annotation;
html += "<source src='" + recording_url + "'>" + recording_url;

if (type == 'audio') {
html += "</audio>";
} else { // Must be video.
html += "</video>";
}

return html;
},

// Inserts link to annotation in editor text area.
Expand Down
Expand Up @@ -290,16 +290,22 @@ M.atto_recordrtc.commonmodule = {

// Generates link to recorded annotation to be inserted.
create_annotation: function(type, recording_url) {
var linkText = window.prompt(M.util.get_string('annotationprompt', 'atto_recordrtc'),
M.util.get_string('annotation:' + type, 'atto_recordrtc'));
var html = '';
if (type == 'audio') {
html = "<audio controls='true'>";
} else { // Must be video.
html = "<video controls='true'>";
}

// Return HTML for annotation link, if user did not press "Cancel".
if (!linkText) {
return undefined;
} else {
var annotation = '<a target="_blank" href="' + recording_url + '">' + linkText + '</a>';
return annotation;
html += "<source src='" + recording_url + "'>" + recording_url;

if (type == 'audio') {
html += "</audio>";
} else { // Must be video.
html += "</video>";
}

return html;
},

// Inserts link to annotation in editor text area.
Expand Down

0 comments on commit c8520ca

Please sign in to comment.