Skip to content

Commit

Permalink
feat: add ref to replay video
Browse files Browse the repository at this point in the history
  • Loading branch information
fbaiodias committed Apr 17, 2018
1 parent a111c19 commit 89d295f
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/video-recorder.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ export default class VideoRecorder extends Component {
})

if (window.URL) {
this.videoTag.srcObject = stream
this.cameraVideo.srcObject = stream
} else {
this.videoTag.src = stream
this.cameraVideo.src = stream
}

// there is probably a better way
Expand Down Expand Up @@ -266,7 +266,7 @@ export default class VideoRecorder extends Component {
}

startRecording () {
captureThumb(this.videoTag).then(thumbnail => {
captureThumb(this.cameraVideo).then(thumbnail => {
this.thumbnail = thumbnail

this.recordedBlobs = []
Expand Down Expand Up @@ -400,6 +400,7 @@ export default class VideoRecorder extends Component {
return (
<CameraView key='replay'>
<Video
innerRef={el => (this.replayVideo = el)}
src={window.URL.createObjectURL(this.state.videoBlob)}
autoPlay
loop
Expand All @@ -411,13 +412,7 @@ export default class VideoRecorder extends Component {
if (this.state.isCameraOn) {
return (
<CameraView key='camera'>
<Video
innerRef={video => {
this.videoTag = video
}}
autoPlay
muted
/>
<Video innerRef={el => (this.cameraVideo = el)} autoPlay muted />
</CameraView>
)
}
Expand Down

0 comments on commit 89d295f

Please sign in to comment.