Skip to content

Commit 18503f7

Browse files
committed
Quick and simple demo page
1 parent 520ded9 commit 18503f7

File tree

5 files changed

+78
-43
lines changed

5 files changed

+78
-43
lines changed

demo/generateConfig.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ module.exports = ({ optimize, extractCss, hot, publicPath = '/' }) => {
4141
: 'style!' + cssString
4242
}, {
4343
test: /\.css$/,
44-
include: new RegExp(pkg.name + '/dist/'),
44+
include: [new RegExp(pkg.name + '/dist/'), new RegExp('reset-css')],
4545
loader: extractCss
4646
? ExtractTextPlugin.extract('style', 'css')
4747
: 'style!css'

demo/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
22
"name": "react-html5video-demo",
33
"dependencies": {
4-
"react-html5video": "file:../",
54
"react": "^15.4.0",
6-
"react-dom": "^15.4.0"
5+
"react-dom": "^15.4.0",
6+
"react-html5video": "file:../",
7+
"reset-css": "^2.2.0"
78
}
89
}

demo/src/components/App.css

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,30 @@
11
.component {
22
padding: 20px;
3-
border: 1px solid #222;
3+
font-family: Arial, 'Helvetica Neue', Helvetica, sans-serif;
4+
}
5+
6+
.header {
7+
margin-bottom: 20px;
8+
}
9+
10+
.title {
11+
font-size: 30px;
12+
margin-bottom: 5px;
13+
}
14+
15+
.link {
16+
color: #2492a8;
417
}
518

619
.video {
720
width: 634px;
821
height: 356px;
22+
margin: 0 auto;
23+
}
24+
25+
26+
.videoListItem {
27+
background-color: #efefef;
28+
padding: 20px;
29+
margin-bottom: 20px;
930
}

demo/src/components/App.js

Lines changed: 51 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,62 @@
1-
import React from 'react';
1+
import React, { Component } from 'react';
22
import { DefaultPlayer as Video } from 'react-html5video';
33
import 'react-html5video/dist/styles.css';
44
import styles from './App.css';
5-
import pkg from './../../../package.json';
5+
import 'reset-css/reset.css';
66
import vttEn from './../../assets/sintel-en.vtt';
77
import vttEs from './../../assets/sintel-es.vtt';
88

99
const sintelTrailer = 'https://download.blender.org/durian/trailer/sintel_trailer-720p.mp4';
1010
const bigBuckBunny = 'http://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_480p_h264.mov';
11-
const failingSource = 'https://github.com/mderrick/react-html5video';
1211

13-
const App = () => (
14-
<div className={styles.component}>
15-
<h1 className={styles.copy}>This is a demo for "{pkg.name}".</h1>
16-
<Video className={styles.video}>
17-
<source src={sintelTrailer} type="video/mp4" />
18-
<track
19-
label="English"
20-
kind="subtitles"
21-
srcLang="en"
22-
src={vttEn}
23-
default />
24-
<track
25-
label="Español"
26-
kind="subtitles"
27-
srcLang="es"
28-
src={vttEs} />
29-
</Video>
30-
<Video
31-
src={bigBuckBunny}
32-
className={styles.video}>
33-
</Video>
34-
<Video
35-
src={failingSource}
36-
className={styles.video}>
37-
</Video>
38-
<Video className={styles.video}>
39-
<source src={failingSource} type="video/mp4" />
40-
<source src={sintelTrailer} type="video/mp4" />
41-
</Video>
42-
<Video className={styles.video}>
43-
<source src={failingSource} type="video/mp4" />
44-
</Video>
45-
</div>
46-
);
12+
class App extends Component {
13+
render () {
14+
return (
15+
<div className={styles.component}>
16+
<header className={styles.header}>
17+
<h1 className={styles.title}>React HTML5 Video</h1>
18+
<a className={styles.link}
19+
href="https://github.com/mderrick/react-html5video">
20+
View on GitHub &raquo;
21+
</a>
22+
</header>
23+
<ul className={styles.videoList}>
24+
<li className={styles.videoListItem}>
25+
<Video
26+
autoPlay
27+
ref="video1"
28+
onPlay={() => {
29+
this.refs.video2.videoEl.pause();
30+
}}
31+
className={styles.video}>
32+
<source src={sintelTrailer} type="video/mp4" />
33+
<track
34+
label="English"
35+
kind="subtitles"
36+
srcLang="en"
37+
src={vttEn}
38+
default />
39+
<track
40+
label="Español"
41+
kind="subtitles"
42+
srcLang="es"
43+
src={vttEs} />
44+
</Video>
45+
</li>
46+
<li className={styles.videoListItem}>
47+
<Video
48+
ref="video2"
49+
onPlay={() => {
50+
this.refs.video1.videoEl.pause();
51+
}}
52+
src={bigBuckBunny}
53+
className={styles.video}>
54+
</Video>
55+
</li>
56+
</ul>
57+
</div>
58+
);
59+
}
60+
}
4761

4862
export default App;

demo/src/components/App.test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { shallow } from 'enzyme';
33

44
import App from './App';
55
import styles from './App.css';
6-
import pkg from './../../../package.json';
76

87
describe('App', () => {
98
let component;
@@ -16,7 +15,7 @@ describe('App', () => {
1615

1716
it('contains heading text', () => {
1817
expect(component.find('h1').text())
19-
.toEqual(`This is a demo for "${pkg.name}".`);
18+
.toEqual('React HTML5 Video');
2019
});
2120

2221
it('has a className', () => {

0 commit comments

Comments
 (0)