MDL-60848 atto_recordrtc: changed HTML of attached recordings

This was done so the user can then click on the recording and
add subtitles etc - the same behaviour as 'atto_media'.
This commit is contained in:
Mark Nelson 2018-04-10 12:16:55 +08:00
parent b5a3388bb1
commit c8520ca45f
6 changed files with 48 additions and 36 deletions

View File

@ -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';

View File

@ -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');

View File

@ -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'));
// 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;
var html = '';
if (type == 'audio') {
html = "<audio controls='true'>";
} else { // Must be video.
html = "<video controls='true'>";
}
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.

View File

@ -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'));
// 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;
var html = '';
if (type == 'audio') {
html = "<audio controls='true'>";
} else { // Must be video.
html = "<video controls='true'>";
}
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.

View File

@ -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'));
// 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;
var html = '';
if (type == 'audio') {
html = "<audio controls='true'>";
} else { // Must be video.
html = "<video controls='true'>";
}
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.