-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
70 lines (65 loc) · 1.91 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>MarkLogic Binaries with metadata</title>
<script src="node_modules/react/dist/react.js"></script>
<script src="node_modules/react-dom/dist/react-dom.js"></script>
<script src="node_modules/babel-core/browser.min.js"></script>
<script src="node_modules/jquery/dist/jquery.min.js"></script>
</head>
<body>
<div id="content"></div>
<script type="text/babel">
class VideoPlayer extends React.Component {
constructor() {
super();
this.state = {
data: []
}
}
loadVideoMetadataFromServer() {
$.ajax({
url: this.props.url,
dataType: 'json',
cache: false,
success: data => this.setState({data: data}),
error: (xhr, status, err) => console.log(this.props.url, status, err.toString())
});
}
componentDidMount() {
this.loadVideoMetadataFromServer();
}
render() {
return (
<div className="videoPlayer">
<Clip metadata={this.state.data} />
</div>
);
}
}
class Clip extends React.Component {
constructor() {
super();
this.uriToVideoClip = '/clips/bunny.mp4'
}
render() {
return (
<div className="clipMetadata">
<h3>Video clip with metadata</h3>
<p>Clip title: {this.props.metadata.title}</p>
<p>More information: <a href={this.props.metadata.info}>{this.props.metadata.info}</a></p>
<video controls preload="auto" width="640" height="360">
<source src={this.uriToVideoClip + "?data=content"} type="video/mp4" />
</video>
</div>
);
}
}
ReactDOM.render(
<VideoPlayer url="/clips/bunny.mp4?data=meta" />,
document.getElementById('content')
);
</script>
</body>
</html>