Skip to content

Commit

Permalink
Fixed #227 as well as main demo file "index.html"
Browse files Browse the repository at this point in the history
  • Loading branch information
muaz-khan committed Mar 18, 2017
1 parent 2240f35 commit 51285c3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
var mediaElement = document.createElement('video');
var source = document.createElement('source');
source.src = location.href + 'uploads/' + fName.replace(/"/g, '');
source.src = document.location.origin + '/uploads/' + fName.replace(/"/g, '');
source.type = 'video/webm; codecs="vp8, vorbis"';
mediaElement.appendChild(source);
Expand Down
45 changes: 20 additions & 25 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ <h2 class="header">
</div>

<div style="margin-top: 10px;">
<video controls muted></video>
<video id="recording-player" controls muted></video>
</div>
</section>

Expand Down Expand Up @@ -246,22 +246,9 @@ <h2 class="header">
</script>

<script>
function intallFirefoxScreenCapturingExtension() {
InstallTrigger.install({
'Foo': {
// URL: 'https://addons.mozilla.org/en-US/firefox/addon/enable-screen-capturing/',
URL: 'https://addons.mozilla.org/firefox/downloads/file/355418/enable_screen_capturing_in_firefox-1.0.006-fx.xpi?src=cb-dl-hotness',
toString: function() {
return this.URL;
}
}
});
}

var recordingDIV = document.querySelector('.recordrtc');
var recordingMedia = recordingDIV.querySelector('.recording-media');
var recordingPlayer = recordingDIV.querySelector('video');
var mediaContainerFormat = recordingDIV.querySelector('.media-container-format');
var recordingPlayer = document.querySelector('#recording-player');
var recordingMedia = document.querySelector('.recording-media');
var mediaContainerFormat = document.querySelector('.media-container-format');
var mimeType = 'video/webm';
var fileExtension = 'webm';
var type = 'video';
Expand Down Expand Up @@ -360,7 +347,15 @@ <h2 class="header">
},
onMediaCapturingFailed: function(error) {
if(error.name === 'PermissionDeniedError' && !!navigator.mozGetUserMedia) {
intallFirefoxScreenCapturingExtension();
InstallTrigger.install({
'Foo': {
// URL: 'https://addons.mozilla.org/en-US/firefox/addon/enable-screen-capturing/',
URL: 'https://addons.cdn.mozilla.net/user-media/addons/655146/enable_screen_capturing_in_firefox-1.1.001-fx.xpi?filehash=sha256%3Acb13851aaca148fcbd6672fc2dddfb9653c52a529588fb27ad018e834fbb3099',
toString: function() {
return this.URL;
}
}
});
}

commonConfig.onMediaStopped();
Expand Down Expand Up @@ -1026,8 +1021,8 @@ <h2 class="header">
function saveToDiskOrOpenNewTab(recordRTC) {
var fileName = 'RecordRTC-' + (new Date).toISOString().replace(/:|\./g, '-') + '.' + fileExtension;

recordingDIV.querySelector('#save-to-disk').parentNode.style.display = 'block';
recordingDIV.querySelector('#save-to-disk').onclick = function() {
document.querySelector('#save-to-disk').parentNode.style.display = 'block';
document.querySelector('#save-to-disk').onclick = function() {
if(!recordRTC) return alert('No recording found.');

var file = new File([recordRTC.getBlob()], fileName, {
Expand All @@ -1037,7 +1032,7 @@ <h2 class="header">
invokeSaveAsDialog(file, file.name);
};

recordingDIV.querySelector('#open-new-tab').onclick = function() {
document.querySelector('#open-new-tab').onclick = function() {
if(!recordRTC) return alert('No recording found.');

var file = new File([recordRTC.getBlob()], fileName, {
Expand All @@ -1048,8 +1043,8 @@ <h2 class="header">
};

// upload to PHP server
recordingDIV.querySelector('#upload-to-php').disabled = false;
recordingDIV.querySelector('#upload-to-php').onclick = function() {
document.querySelector('#upload-to-php').disabled = false;
document.querySelector('#upload-to-php').onclick = function() {
if(!recordRTC) return alert('No recording found.');
this.disabled = true;

Expand All @@ -1070,8 +1065,8 @@ <h2 class="header">
};

// upload to YouTube!
recordingDIV.querySelector('#upload-to-youtube').disabled = false;
recordingDIV.querySelector('#upload-to-youtube').onclick = function() {
document.querySelector('#upload-to-youtube').disabled = false;
document.querySelector('#upload-to-youtube').onclick = function() {
if(!recordRTC) return alert('No recording found.');
this.disabled = true;

Expand Down

0 comments on commit 51285c3

Please sign in to comment.