Skip to content

Commit

Permalink
Merge pull request #38 from KamiHQ/check-getUserMedia
Browse files Browse the repository at this point in the history
improve check if browser supports getUserMedia
  • Loading branch information
thijstriemstra committed Jan 16, 2016
2 parents 04915dc + f02a14d commit 17cde65
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/js/videojs.record.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,12 +414,20 @@
this._deviceActive = false;

// cross-browser getUserMedia
this.getUserMedia = (
var getUserMediaFn =
navigator.getUserMedia ||
navigator.webkitGetUserMedia ||
navigator.mozGetUserMedia ||
navigator.msGetUserMedia
).bind(navigator);
navigator.msGetUserMedia;

if (getUserMediaFn) {
this.getUserMedia = getUserMediaFn.bind(navigator);
} else {
this.getUserMedia = function (constraints, successCallback, errorCallback) {
errorCallback(new Error('getUserMedia is not supported'));
};
}


// wait until player ui is ready
this.player().one('ready', this.setupUI.bind(this));
Expand Down

0 comments on commit 17cde65

Please sign in to comment.