phenix-gum-configuration
Advanced tools
Comparing version 2017.2.0 to 2017.2.1
{ | ||
"name": "phenix-gum-configuration", | ||
"version": "2017.2.0", | ||
"version": "2017.2.1", | ||
"description": "Get-User-Media selection and configuration component", | ||
@@ -5,0 +5,0 @@ "main": "dist/bundle-min.js", |
@@ -107,3 +107,3 @@ import React from 'react'; | ||
if (!options.find((id) => id && id.toLowerCase() === defaultSource)) { | ||
if (!options.find((id) => id && id.toLowerCase() === defaultSource.toLowerCase())) { | ||
defaultSource = 'disabled'; | ||
@@ -117,3 +117,3 @@ } | ||
className={selectClassName} | ||
defaultValue={defaultSource || 'disabled'}> | ||
value={defaultSource || 'disabled'}> | ||
{renderSourcesOptions()} | ||
@@ -129,4 +129,4 @@ </select> | ||
typeOfSource: PropTypes.string.isRequired, | ||
defaultSource: PropTypes.string.isRequired, | ||
includeScreen: PropTypes.bool.isRequired, | ||
defaultSource: PropTypes.func.isRequired, | ||
onSourceSelect: PropTypes.func.isRequired | ||
@@ -133,0 +133,0 @@ }; |
@@ -42,3 +42,6 @@ import React from 'react'; | ||
componentDidUpdate(prevProps) { | ||
if (prevProps.aspectRatio !== this.props.aspectRatio || prevProps.resolution !== this.props.resolution || prevProps.frameRate !== this.props.frameRate) { | ||
if (prevProps.aspectRatio !== this.props.aspectRatio | ||
|| prevProps.resolution !== this.props.resolution | ||
|| prevProps.frameRate !== this.props.frameRate | ||
) { | ||
this.userMediaResolver = new UserMediaResolver(this.props.aspectRatio, this.props.resolution, this.props.frameRate); | ||
@@ -110,3 +113,3 @@ this.changeSelectedDevices(); | ||
setUserMedia(error, {userMedia, options}) { | ||
setUserMedia(error, {userMedia, options} = {}) { | ||
if (userMedia) { | ||
@@ -150,4 +153,4 @@ this.userMediaToDispose = userMedia; | ||
videoMediaStream={this.state.userMedia} | ||
defaultAudioSource={this.deviceOptions.audio.deviceId} | ||
defaultVideoSource={this.deviceOptions.video.deviceId} | ||
defaultAudioSource={this.deviceOptions.audio.deviceId || ''} | ||
defaultVideoSource={this.deviceOptions.video.deviceId || ''} | ||
onAudioSourceSelect={this.onAudioSourceSelect} | ||
@@ -154,0 +157,0 @@ onVideoSourceSelect={this.onVideoSourceSelect} /> |
@@ -198,12 +198,6 @@ /** | ||
let nextFrameRate = frameRate; | ||
const constraintName = getConstraintNameFromError(error); | ||
if (error && error.name === 'OverconstrainedError' && frameRate) { | ||
// Try without limiting the frame rate | ||
nextFrameRate = null; | ||
return getUserMediaWithOptions.call(this, deviceOptions, nextResolution, nextFrameRate, callback); | ||
} | ||
if (error && error.name === 'ConstraintNotSatisfiedError') { | ||
switch (error.constraintName) { | ||
if (error && (error.name === 'ConstraintNotSatisfiedError' || error.name === 'OverconstrainedError')) { | ||
switch (constraintName.toLowerCase()) { | ||
case 'width': | ||
@@ -215,7 +209,10 @@ case 'height': | ||
console.warn(`Unable to get user media with constraint ${error.constraintName}. Retrying with next closest resolution.`); | ||
console.warn(`Unable to get user media with constraint ${constraintName}. Retrying with next closest resolution.`); | ||
nextResolution = getNextResolution(resolution.height, resolution.aspectRatio); | ||
return getUserMediaWithOptions.call(this, deviceOptions, nextResolution, nextFrameRate, callback); | ||
case 'frameRate': | ||
case 'framerate': | ||
default: | ||
// Always try without frame rate if constraint name not defined | ||
if (!frameRate) { | ||
@@ -225,8 +222,6 @@ break; | ||
console.warn(`Unable to get user media with constraint ${error.constraintName}. Retrying without frame rate constraint.`); | ||
console.warn(`Unable to get user media with constraint ${constraintName}. Retrying without frame rate constraint.`); | ||
nextFrameRate = null; | ||
return getUserMediaWithOptions.call(this, deviceOptions, nextResolution, nextFrameRate, callback); | ||
default: | ||
break; | ||
} | ||
@@ -237,6 +232,18 @@ } | ||
return callback(error, null); | ||
return callback(error); | ||
}); | ||
} | ||
function getConstraintNameFromError(error) { | ||
if (error.constraintName) { | ||
return error.constraintName; | ||
} | ||
if (error.constraint) { | ||
return error.constraint; | ||
} | ||
return ''; | ||
} | ||
function getNextResolution(height, aspectRatio) { | ||
@@ -243,0 +250,0 @@ const aspectRatioHeights = getObjectValueInArray(aspectRatio, aspectRatios); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
943
648495