mirror of
https://github.com/ascribe/onion.git
synced 2024-11-14 09:05:08 +01:00
Add videojs and styles
This commit is contained in:
parent
3556e8c3c2
commit
7f8a36b99a
@ -73,22 +73,27 @@ let Video = React.createClass({
|
||||
},
|
||||
|
||||
componentDidMount() {
|
||||
this.inject('https://code.jquery.com/jquery-2.1.4.min.js')
|
||||
.then(() =>
|
||||
Promise.all([
|
||||
this.inject('https://cdnjs.cloudflare.com/ajax/libs/mediaelement/2.17.0/mediaelement-and-player.min.js'),
|
||||
this.inject('https://cdnjs.cloudflare.com/ajax/libs/mediaelement/2.17.0/mediaelementplayer.min.css')
|
||||
]).then(this.ready));
|
||||
Promise.all([
|
||||
this.inject('//vjs.zencdn.net/4.12/video-js.css'),
|
||||
this.inject('//vjs.zencdn.net/4.12/video.js')
|
||||
]).then(this.ready);
|
||||
},
|
||||
|
||||
componentDidUpdate() {
|
||||
if (this.state.ready && !this.state.videojs) {
|
||||
window.videojs(React.findDOMNode(this.refs.video));
|
||||
}
|
||||
},
|
||||
|
||||
ready() {
|
||||
this.setState({ready: true});
|
||||
this.setState({ready: true, videojs: false});
|
||||
},
|
||||
|
||||
render() {
|
||||
if (this.state.ready) {
|
||||
return (
|
||||
<video poster={this.props.preview} controls="controls" preload="none">
|
||||
<video ref="video" className="video-js vjs-default-skin" poster={this.props.preview}
|
||||
controls preload="none" width="auto" height="auto">
|
||||
{this.props.extraData.map((data, i) =>
|
||||
<source key={i} type={'video/' + data.type} src={data.url} />
|
||||
)}
|
||||
|
@ -14,5 +14,78 @@
|
||||
font-size: 500%;
|
||||
color: #cccccc;
|
||||
}
|
||||
|
||||
.video-js,
|
||||
.vjs-poster {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.video-js .vjs-tech {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.vjs-fullscreen {
|
||||
padding-top: 0px;
|
||||
}
|
||||
|
||||
.vjs-default-skin .vjs-play-progress,
|
||||
.vjs-default-skin .vjs-volume-level {
|
||||
background: $ascribe-color-full;
|
||||
}
|
||||
|
||||
.vjs-default-skin .vjs-big-play-button {
|
||||
border-radius: 6px;
|
||||
-o-border-radius: 6px;
|
||||
-moz-border-radius: 6px;
|
||||
-webkit-border-radius: 6px;
|
||||
|
||||
box-shadow: none;
|
||||
-o-box-shadow: none;
|
||||
-moz-box-shadow: none;
|
||||
-webkit-box-shadow: none;
|
||||
|
||||
width: 100px;
|
||||
height: 60px;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
margin: -30px -50px;
|
||||
|
||||
border: none;
|
||||
|
||||
background-color: rgba(0,0,0,.8);
|
||||
}
|
||||
|
||||
.vjs-default-skin:hover .vjs-big-play-button,
|
||||
.vjs-default-skin .vjs-big-play-button:focus {
|
||||
border-color: #fff;
|
||||
background-color: rgba(0,0,0,.9);
|
||||
|
||||
box-shadow: none;
|
||||
-o-box-shadow: none;
|
||||
-moz-box-shadow: none;
|
||||
-webkit-box-shadow: none;
|
||||
|
||||
transition: all 0s;
|
||||
-o-transition: all 0s;
|
||||
-moz-transition: all 0s;
|
||||
-webkit-transition: all 0s;
|
||||
}
|
||||
|
||||
.vjs-default-skin .vjs-big-play-button:before {
|
||||
line-height: 60px;
|
||||
}
|
||||
|
||||
.vjs-default-skin .vjs-slider-handle:before,
|
||||
.vjs-default-skin .vjs-big-play-button:before {
|
||||
text-shadow: none;
|
||||
}
|
||||
|
||||
.vjs-default-skin .vjs-volume-bar {
|
||||
height: .5em;
|
||||
}
|
||||
|
||||
.vjs-default-skin .vjs-control-bar {
|
||||
background-color: rgba(0,0,0,.7);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user