Skip to content

Commit

Permalink
* Add muted prop (default: undefined - since this is a HTML `bool…
Browse files Browse the repository at this point in the history
…ean` attribute) to allow specifying initial muted behavior.

* Add `playsInline` prop (default: `undefined` - since this is a HTML `boolean` attribute) to allow specifying playsinline behavior.

Resolves zzarcon#37
  • Loading branch information
dannya committed Jun 22, 2020
1 parent 1aea59e commit 45604be
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ interface Props {
children: RenderCallback;
controls?: boolean;
autoPlay?: boolean;
muted?: boolean;
playsInline?: boolean;
preload?: string;
}
```
Expand Down
6 changes: 5 additions & 1 deletion src/video.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ export interface VideoProps {
sourceType?: 'video' | 'audio';
controls?: boolean;
autoPlay?: boolean;
muted?: boolean;
playsInline?: boolean;
preload?: string;
poster?: string;
crossOrigin?: string;
Expand Down Expand Up @@ -258,7 +260,7 @@ export class Video extends Component<VideoProps, VideoComponentState> {

render() {
const {videoState, actions} = this;
const {sourceType, poster, src, children, autoPlay, controls, preload, crossOrigin} = this.props;
const {sourceType, poster, src, children, autoPlay, controls, muted, playsInline, preload, crossOrigin} = this.props;
const TagName = sourceType || 'video'; // otherwise ts complains about not being able to create React component from TagName

return children(
Expand All @@ -268,6 +270,8 @@ export class Video extends Component<VideoProps, VideoComponentState> {
src={src}
preload={preload}
controls={controls}
muted={muted}
playsInline={playsInline}
autoPlay={autoPlay}
onPlay={this.onPlay}
onPause={this.onPause}
Expand Down

0 comments on commit 45604be

Please sign in to comment.