Skip to content

Commit

Permalink
feat: try to use video/webm;codecs=H264 and fix storybook
Browse files Browse the repository at this point in the history
  • Loading branch information
fbaiodias committed Nov 27, 2018
1 parent c0e9db3 commit d101187
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
11 changes: 7 additions & 4 deletions src/video-recorder.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,16 @@ const chunkSizeInMS = 250
const dataCheckInterval = 2000 / chunkSizeInMS

const getMimeType = () => {
let mimeType = 'video/webm;codecs=vp9'
let mimeType = 'video/webm;codecs=H264'
if (!window.MediaRecorder.isTypeSupported(mimeType)) {
mimeType = 'video/webm;codecs=vp8'
mimeType = 'video/webm;codecs=vp9'
if (!window.MediaRecorder.isTypeSupported(mimeType)) {
mimeType = 'video/webm'
mimeType = 'video/webm;codecs=vp8'
if (!window.MediaRecorder.isTypeSupported(mimeType)) {
mimeType = ''
mimeType = 'video/webm'
if (!window.MediaRecorder.isTypeSupported(mimeType)) {
mimeType = ''
}
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/video-recorder.stories.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react'
import { storiesOf } from '@storybook/react'
import styled, { injectGlobal } from 'styled-components'
import styled, { createGlobalStyle } from 'styled-components'
import VideoRecorder from './video-recorder'

injectGlobal`
const GlobalStyle = createGlobalStyle`
html, body, #root {
height: 100%;
margin: 0;
Expand Down Expand Up @@ -33,13 +33,15 @@ storiesOf('VideoRecorder', module)
.add('default', () => {
return (
<Wrapper>
<GlobalStyle />
<VideoRecorder onRecordingComplete={handleRecordingComplete} />
</Wrapper>
)
})
.add('isOnInitially', () => {
return (
<Wrapper>
<GlobalStyle />
<VideoRecorder
isOnInitially
onRecordingComplete={handleRecordingComplete}
Expand Down

0 comments on commit d101187

Please sign in to comment.