Skip to content

Commit 6abb773

Browse files
committed
test: add <Video> story with controls
1 parent 1d5a628 commit 6abb773

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

src/Video/__story__/story.tsx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,31 @@ storiesOf('Generators/Video', module)
1818
{video}
1919
</div>
2020
}</Video>
21+
)
22+
.add('Control buttons', () =>
23+
<Video
24+
src={src}
25+
style={{
26+
width: 400,
27+
border: '1px solid tomato'
28+
}}
29+
render={({video, play, pause, seek, volume, mute, unmute}, state) =>
30+
<div>
31+
{video}
32+
<br />
33+
<button onClick={play}>Play</button>
34+
<button onClick={pause}>Pause</button>
35+
<button onClick={() => seek(state.time - 5)}>Seek -</button>
36+
<button onClick={() => seek(state.time + 5)}>Seek +</button>
37+
<button onClick={() => volume(state.volume - 0.05)}>Volume -</button>
38+
<button onClick={() => volume(state.volume + 0.05)}>Volume +</button>
39+
<button onClick={mute}>Mute</button>
40+
<button onClick={unmute}>Unmute</button>
41+
42+
<pre style={{fontFamily: 'monospace'}}>
43+
{JSON.stringify(state, null, 4)}
44+
</pre>
45+
</div>
46+
}
47+
/>
2148
);

src/Video/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import {Component, cloneElement, Children} from 'react';
22
import {h, noop} from '../util';
33
import renderProp from '../util/renderProp';
44

5-
export type TVideoEvent = (event, Audio?, IAudioState?) => void;
5+
export type TVideoEvent = (event, IVideo?, IVideoState?) => void;
66
export type TVideoRenderProp = (video: Video, state: IVideoState) => React.ReactElement<any>;
77

88
export interface IVideo {

0 commit comments

Comments
 (0)