Skip to content

Commit 1aa821f

Browse files
Make sure the correct device id is forwarded to constraints
1 parent dbaf650 commit 1aa821f

File tree

6 files changed

+25
-42
lines changed

6 files changed

+25
-42
lines changed

app/components/Stopwatch/index.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import React from 'react';
88

99
import { FormattedMessage } from 'react-intl';
1010

11-
import ReactFitText from 'react-fittext';
11+
import { Textfit } from 'react-textfit';
1212

1313
import messages from './messages';
1414

@@ -19,14 +19,16 @@ const formattedSeconds = (sec) => {
1919
return `${Math.floor(sec / 60)}:${secDisplay.slice(-2)}`;
2020
};
2121

22+
2223
function Stopwatch(props) {
24+
2325
return (
2426
<CenteredSection>
25-
<ReactFitText compressor={0.5}>
26-
<div>
27-
<TimeDisplay>{formattedSeconds(props.intervalsElapsed)}</TimeDisplay>
28-
</div>
29-
</ReactFitText>
27+
<TimeDisplay>
28+
<Textfit mode="single">
29+
{formattedSeconds(props.intervalsElapsed)}
30+
</Textfit>
31+
</TimeDisplay>
3032

3133
<ControlGroup>
3234
{(props.intervalsElapsed !== 0

app/components/Stopwatch/stopwatchStyles.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const CenteredSection = styled.div`
77
`;
88

99
export const TimeDisplay = styled.h1`
10-
padding: 0;
10+
padding: 0 20px;
1111
margin: 0;
1212
color: #fff;
1313
`;

app/containers/Timer/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import { resetTimer, startTimer, stopTimer, addLap } from './actions';
1414

1515
import { makeSelectIntervalsElapsed } from './selectors';
1616

17-
class Timer extends React.PureComponent {
17+
class Timer extends React.PureComponent { // eslint-disable-line react/prefer-stateless-function
1818

1919
render() {
2020
return (

app/containers/WebcamDisplay/index.js

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ export class WebcamDisplay extends React.PureComponent { // eslint-disable-line
4040
startVideo(deviceId) {
4141
const constraints = {
4242
video: { width: 1280, height: 720 },
43-
deviceId,
43+
deviceId: { exact: deviceId },
4444
};
4545

46-
navigator.mediaDevices.getUserMedia(constraints)
46+
navigator.mediaDevices.getUserMedia({ video: constraints })
4747
.then(this.startVideoCb.bind(this))
4848
.catch(this.setNewError.bind(this));
4949
}
@@ -57,7 +57,7 @@ export class WebcamDisplay extends React.PureComponent { // eslint-disable-line
5757
startWebcams() {
5858
this.state.devices.forEach((device) => {
5959
if (device.kind === 'videoinput') {
60-
this.startVideo(device.id);
60+
this.startVideo(device.deviceId);
6161
}
6262
});
6363
}
@@ -86,20 +86,9 @@ export class WebcamDisplay extends React.PureComponent { // eslint-disable-line
8686
);
8787
}
8888

89-
const timerResizeProps = {
90-
top: false,
91-
right: false,
92-
bottom: false,
93-
left: false,
94-
topRight: true,
95-
bottomRight: true,
96-
bottomLeft: true,
97-
topLeft: true,
98-
}
99-
10089
return (
10190
<div>
102-
<DragResize initialWidth="150" initialHeight="150" x={window.innerWidth - 150} y={0} isResizable={timerResizeProps} lockAspectRatio={true}>
91+
<DragResize initialWidth="150" initialHeight="150" x={window.innerWidth - 150} y={0} lockAspectRatio>
10392
<Timer />
10493
</DragResize>
10594

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,14 +244,14 @@
244244
"minimist": "1.2.0",
245245
"react": "15.4.1",
246246
"react-dom": "15.4.1",
247-
"react-fittext": "^0.0.7",
248247
"react-helmet": "3.2.2",
249248
"react-intl": "2.1.5",
250249
"react-redux": "4.4.6",
251250
"react-rnd": "^4.2.2",
252251
"react-router": "3.0.0",
253252
"react-router-redux": "4.0.6",
254253
"react-router-scroll": "0.4.1",
254+
"react-textfit": "^0.1.9",
255255
"redux": "3.6.0",
256256
"redux-immutable": "3.0.8",
257257
"redux-saga": "0.14.0",

yarn.lock

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2179,18 +2179,12 @@ debug@2.2.0, debug@^2.1.1, debug@^2.2.0, debug@~2.2.0:
21792179
dependencies:
21802180
ms "0.7.1"
21812181

2182-
debug@2.6.3:
2182+
debug@2.6.3, debug@^2.1.3, debug@^2.6.0, debug@^2.6.1, debug@^2.6.3:
21832183
version "2.6.3"
21842184
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.3.tgz#0f7eb8c30965ec08c72accfa0130c8b79984141d"
21852185
dependencies:
21862186
ms "0.7.2"
21872187

2188-
debug@^2.1.3, debug@^2.6.0, debug@^2.6.1, debug@^2.6.3:
2189-
version "2.6.6"
2190-
resolved "https://registry.yarnpkg.com/debug/-/debug-2.6.6.tgz#a9fa6fbe9ca43cf1e79f73b75c0189cbb7d6db5a"
2191-
dependencies:
2192-
ms "0.7.3"
2193-
21942188
decamelize@^1.0.0, decamelize@^1.1.1, decamelize@^1.1.2:
21952189
version "1.2.0"
21962190
resolved "https://registry.yarnpkg.com/decamelize/-/decamelize-1.2.0.tgz#f6534d15148269b20352e7bee26f501f9a191290"
@@ -4839,14 +4833,14 @@ js-tokens@^3.0.0:
48394833
version "3.0.1"
48404834
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-3.0.1.tgz#08e9f132484a2c45a30907e9dc4d5567b7f114d7"
48414835

4842-
js-yaml@3.6.1, js-yaml@^3.5.1:
4836+
js-yaml@3.6.1:
48434837
version "3.6.1"
48444838
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.6.1.tgz#6e5fe67d8b205ce4d22fad05b7781e8dadcc4b30"
48454839
dependencies:
48464840
argparse "^1.0.7"
48474841
esprima "^2.6.0"
48484842

4849-
js-yaml@^3.4.3, js-yaml@^3.7.0, js-yaml@^3.8.2:
4843+
js-yaml@^3.4.3, js-yaml@^3.5.1, js-yaml@^3.7.0, js-yaml@^3.8.2:
48504844
version "3.8.4"
48514845
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.8.4.tgz#520b4564f86573ba96662af85a8cafa7b4b5a6f6"
48524846
dependencies:
@@ -5641,10 +5635,6 @@ ms@0.7.2:
56415635
version "0.7.2"
56425636
resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.2.tgz#ae25cf2512b3885a1d95d7f037868d8431124765"
56435637

5644-
ms@0.7.3:
5645-
version "0.7.3"
5646-
resolved "https://registry.yarnpkg.com/ms/-/ms-0.7.3.tgz#708155a5e44e33f5fd0fc53e81d0d40a91be1fff"
5647-
56485638
multipipe@^0.1.2:
56495639
version "0.1.2"
56505640
resolved "https://registry.yarnpkg.com/multipipe/-/multipipe-0.1.2.tgz#2a8f2ddf70eed564dff2d57f1e1a137d9f05078b"
@@ -6655,7 +6645,7 @@ process-nextick-args@~1.0.6:
66556645
version "1.0.7"
66566646
resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3"
66576647

6658-
process@^0.11.0, process@~0.11.0:
6648+
process@^0.11.0, process@^0.11.9, process@~0.11.0:
66596649
version "0.11.10"
66606650
resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182"
66616651

@@ -6809,10 +6799,6 @@ react-dom@15.4.1:
68096799
loose-envify "^1.1.0"
68106800
object-assign "^4.1.0"
68116801

6812-
react-fittext@^0.0.7:
6813-
version "0.0.7"
6814-
resolved "https://registry.yarnpkg.com/react-fittext/-/react-fittext-0.0.7.tgz#4866d0930507152a8fc77e32619731453a9e383f"
6815-
68166802
react-helmet@3.2.2:
68176803
version "3.2.2"
68186804
resolved "https://registry.yarnpkg.com/react-helmet/-/react-helmet-3.2.2.tgz#1fc4646cbc5d26246ab45d5a84b504ed639810e6"
@@ -6888,6 +6874,12 @@ react-side-effect@1.0.2:
68886874
dependencies:
68896875
fbjs "0.1.0-alpha.10"
68906876

6877+
react-textfit@^0.1.9:
6878+
version "0.1.9"
6879+
resolved "https://registry.yarnpkg.com/react-textfit/-/react-textfit-0.1.9.tgz#0837d283bbf77b795ec2453276fddfc8ab49ea92"
6880+
dependencies:
6881+
process "^0.11.9"
6882+
68916883
react-transform-catch-errors@^1.0.2:
68926884
version "1.0.2"
68936885
resolved "https://registry.yarnpkg.com/react-transform-catch-errors/-/react-transform-catch-errors-1.0.2.tgz#1b4d4a76e97271896fc16fe3086c793ec88a9eeb"

0 commit comments

Comments
 (0)