Skip to content

Commit

Permalink
Fixed issue within Safari
Browse files Browse the repository at this point in the history
  • Loading branch information
jfederico committed Aug 18, 2017
1 parent 8e5714d commit 6e60dce
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 43 deletions.
77 changes: 40 additions & 37 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,43 +78,46 @@ function atto_recordrtc_params_for_js($elementid, $options, $fpoptions) {
function atto_recordrtc_strings_for_js() {
global $PAGE;

$PAGE->requires->strings_for_js(array('audiortc',
'videortc',
'gumabort_title',
'gumabort',
'gumnotallowed_title',
'gumnotallowed',
'gumnotfound_title',
'gumnotfound',
'gumnotreadable_title',
'gumnotreadable',
'gumoverconstrained_title',
'gumoverconstrained',
'gumsecurity_title',
'gumsecurity',
'gumtype_title',
'gumtype',
'insecurealert_title',
'insecurealert',
'browseralert_title',
'browseralert',
'startrecording',
'recordagain',
'stoprecording',
'recordingfailed',
'attachrecording',
'norecordingfound_title',
'norecordingfound',
'nearingmaxsize_title',
'nearingmaxsize',
'uploadprogress',
'uploadfailed',
'uploadfailed404',
'uploadaborted',
'annotationprompt',
'annotation:audio',
'annotation:video'),
'atto_recordrtc');
$strings_for_js = array('audiortc',
'videortc',
'gumabort_title',
'gumabort',
'gumnotallowed_title',
'gumnotallowed',
'gumnotfound_title',
'gumnotfound',
'gumnotreadable_title',
'gumnotreadable',
'gumoverconstrained_title',
'gumoverconstrained',
'gumsecurity_title',
'gumsecurity',
'gumtype_title',
'gumtype',
'insecurealert_title',
'insecurealert',
'browseralert_title',
'browseralert',
'startrecording',
'recordagain',
'stoprecording',
'recordingfailed',
'attachrecording',
'norecordingfound_title',
'norecordingfound',
'nearingmaxsize_title',
'nearingmaxsize',
'uploadprogress',
'uploadfailed',
'uploadfailed404',
'uploadaborted',
'annotationprompt',
'annotation:audio',
'annotation:video',
'nowebrtc',
'nowebrtc_title'
);
$PAGE->requires->strings_for_js($strings_for_js, 'atto_recordrtc');
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ M.atto_recordrtc.commonmodule = {

// Show alert and close plugin if browser does not support WebRTC at all.
check_has_gum: function() {
if (!navigator.mediaDevices.getUserMedia) {
if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {
Y.use('moodle-core-notification-alert', function() {
new M.core.alert({
title: M.util.get_string('nowebrtc_title', 'atto_recordrtc'),
Expand Down Expand Up @@ -113,6 +113,7 @@ M.atto_recordrtc.commonmodule = {
}
},


// Capture webcam/microphone stream.
capture_user_media: function(mediaConstraints, successCallback, errorCallback) {
window.navigator.mediaDevices.getUserMedia(mediaConstraints).then(successCallback).catch(errorCallback);
Expand Down
Loading

0 comments on commit 6e60dce

Please sign in to comment.